X axis was inverted automatically and unexpectedly when plotting a series of data against another series of data using pandas. Please look at my code below. How can I ensure
You can enforce a direction for each plot:
(t,b)= ax.get_xlim() ## Added for clarity if t > b: ax.set_xlim((b,t))
or
if ax.xaxis_inverted(): ax.invert_xaxis()
(the latter just do the explicit three-line version, though.)