How to set axis values in matplotlib
<p>This is my first attempt to use <code>matplotlib</code> and failing... I have lists of data as:</p>

<p><code>years = [1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014]</code> </p>

<p><code>temps = [14.11, 7.54, 5.22, 3.81, 2.9, 2.7, 2.4, 1.82, 1.66, 1.52, 1.34, 1.19, 1.12, 1.17, 1.04, 0.87, 0.87, 0.89, 0.76, 0.75, 0.73, 0.72, 0.69, 0.64, 0.62, 0.62, 0.6, 0.64, 0.53, 0.49]</code></p>

<p><code>years</code> should be the x-axis and the <code>temps</code> should be the y-axis. Can't figure it how.</p>

<pre><code>`plt.hist([temps, years], bins=10)
plt.title('Temp_histogram')
plt.xlabel('year')
plt.ylabel('temp')
plt.grid(True)
plt.show()`
</code></pre>

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

<p>Are you sure that you want a histogram and not a simple bar chart? Something like this:</p>

<pre><code>plt.bar(years,temps, 1, color='r')
plt.title('Temp_histogram')
plt.xlabel('year')
plt.ylabel('temp')
plt.grid(True)
plt.show()
</code></pre>

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

<p>If you really want a histogram then think about (or tell us) by what quantity (a quantitiy is a physical entity, like "year" or "temp" in this case) you want to group the data.</p>

python matplotlib