xlim changes without explicit calling of set_xlim

Hi, all
I found a problem about xlim. It sometimes changes when there is no explicit calling of set_xlim.
My application scenario is : at some situation replot the second one of two subplots, which shares x axis with the first one. To finish the replot operation, i first use clear() method to remove the previous image, and then plot a new one. The problem is that, there is an ‘unexpected’ change of xlim.
The attached code is tried to reproduce the problem. I’m sorry for that it is not small enough and that it even seems ugly. But after all, the problem can be showed by it. Its text output simply shows the ‘unexpected’ changes.
As it can be seen, plot operation causes change of xlim. While, i’d like to see that xlim changes only when responding to call ing set_xlim().
What’s the possible reason? How should i do to avoid the unexpected change? As the sample code shows, the unexpected change can be reverted by calling set_xlim(). but this solution doesn’t seem a graceful one.
Thank you for your any help.

xlim-change.py (3.42 KB)

···


sunzen
<<freedom & enjoyment>>