Single origin value for python matplotlib plot
<p>I have a simple plot executed using matplotlib. My x and y axes start at 0,0 respectively. A matplotlib plot shows 2 zeros corresponding to the 2 axes. I want only one zero (somewhere in the middle of the start point, if possible).
How can this be done?</p>

<p>Here's what I used:</p>

<pre><code>import matplotlib.pyplot as plt

plt.plot([1,2,3], [4,5,6])
plt.xlim([0,5])
plt.ylim([0,10])
plt.show()
</code></pre>

<p><a href="http://i.stack.imgur.com/6gzPl.png" rel="nofollow"><img src="http://i.stack.imgur.com/6gzPl.png" alt="Matplotlib Plot"></a></p>

<p>UPDATE: </p>

<p>I used @nostradamus' solution and it got rid of one of the zeros. I want the zero a little centred if possible. </p>

<p>I used: </p>

<pre><code>plt.gca().xaxis.set_major_locator(MaxNLocator(prune='lower')) 
plt.gca().yaxis.get_majorticklabels()[0].set_x(-0.05)
</code></pre>

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

<p>I want the reverse of this. I want the zero on the y axis to move down or the one from x axis left. So tried:</p>

<pre><code>plt.gca().yaxis.set_major_locator(MaxNLocator(prune='lower')) 
plt.gca().xaxis.get_majorticklabels()[0].set_x(-0.05)
</code></pre>

<p>It doesn't work. I think the bottom and left boundaries for the zeros are set to ensure they don't go beyond the area.</p>

<p>The keyword is <code>prune</code>, which allows you to kill the <code>upper</code>, <code>lower</code> or <code>both</code> tick labels. Here is a working examples that gets rid of the 0 of the x-axis:</p>

<pre><code>import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator

plt.plot([1,2,3], [4,5,6])
plt.xlim([0,5])
plt.ylim([0,10])
plt.gca().xaxis.set_major_locator(MaxNLocator(prune='lower'))
plt.show()
</code></pre>

<p>The second part (to move the remaining zero to the corner) seems to be much more difficult. It seems that you can move single tick labels using</p>

<pre><code>plt.gca().yaxis.get_majorticklabels()[0].set_x(-0.05)
</code></pre>

<p>However, I was unable to figure out how to move it below the lower limit of the corresponding axis (i.e. <code>plt.gca().yaxis.get_majorticklabels()[0].set_y(-0.05)</code> is doing nothing).</p>

python matplotlib plot