General question about set_xlim() vs. set_xbound() and why both are overriden by set_xticks()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

General question about set_xlim() vs. set_xbound() and why both are overriden by set_xticks()

hagertmb
This post has NOT been accepted by the mailing list yet.
Looking around, there seems to be confusion about ax.set_xlim() vs. ax_set_xbound().
It seems that ax.set_xlim() is to limit that data range that is plotted (?), but that
ax.set_xbound() explicitly limits the axis range (?)

However, set_xbound() is overriden whenever the data exceeds its range ?

This doesn't make a lot of sense to me.

What's worse, if I explicitly set the tick locations beyond set limits of the axis, neither
set_xlim() nor set_xbounds() limits the axis range!

Is this intentional behavior ??  I'm using matplotlib v.1.5.1

Example script:

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.gca()
ax.set_xlim([0.3, 0.7])
ax.set_xbound(lower=0.3, upper=0.7)
ax.set_xticks([0.2, 0.4, 0.6, 0.8])       ## This line overrides the x-axis range limits!
plt.show()
Loading...