Histogram from NetworkX Degree Values - Python 2 vs. Python 3
<p>I have the following code, which worked in Python 2.7, using NetworkX. Basically, it just plots a histogram of degree nodes like so:</p>

<pre><code>plt.hist(nx.degree(G).values())
plt.xlabel('Degree')
plt.ylabel('Number of Subjects')
plt.savefig('network_degree.png') #Save as file, format specified in argument
</code></pre>

<p><a href="https://i.stack.imgur.com/duM1G.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/duM1G.png" alt="enter image description here"></a></p>

<p>When I try running this same code under Python 3, I get the following error:</p>

<pre><code>Traceback (most recent call last):
  File "filename.py", line 71, in &lt;module&gt;
    plt.hist(nx.degree(G).values())
  File "/Users/user/anaconda/envs/py3/lib/python3.5/site-packages/matplotlib/pyplot.py", line 2958, in hist
    stacked=stacked, data=data, **kwargs)
  File "/Users/user/anaconda/envs/py3/lib/python3.5/site-packages/matplotlib/__init__.py", line 1812, in inner
    return func(ax, *args, **kwargs)
  File "/Users/user/anaconda/envs/py3/lib/python3.5/site-packages/matplotlib/axes/_axes.py", line 5960, in hist
    x = _normalize_input(x, 'x')
  File "/Users/user/anaconda/envs/py3/lib/python3.5/site-packages/matplotlib/axes/_axes.py", line 5902, in _normalize_input
    "{ename} must be 1D or 2D".format(ename=ename))
ValueError: x must be 1D or 2D
</code></pre>

<p>I'm just now starting to mess around with Python 3, using what I hoped would be pretty straightforward code. What's changed?</p>