Hello everyone on the list, I try to use the matplotlib class
> interface for my plotting application. I have a question which
> I hope you can help me with. The attached file contains a test
> case for my problem. From the example 'embedding_in_gtk2.py' I
> figured the proper way to use the class interface was to
> 1. create a Figure() instance 2. create a FigureCanvas
> instance, using the Figure as argument 3. create a subplot by
> using FigureCanvas.subplot
I think you mean "create a subplot by using Figure.add_subplot"
> This works fine; however now I was trying to set the limits of
> the plot using the Axes.set_xlim and Axes.set_ylim functions.
Call set_xlim and set_ylim after calling plot. Plot automatically
calls autoscale on the axes to incorporate the new data into its
range. This should become an rc param and a kwarg (and this question
will soon become a FAQ!)
> As you can see from the test, it won't affect the plot! On the
> other hand, this method works fine if you use the pylab 'show'
> method as in 'poly_editor.py'. Is this a bug or should I use
> another function to set the limits?
It has nothing to do with show and everything to do that setting the
lim come after creating the plot elements
> BTW, the documentation recommends passing two arguments to
> set_xlim, set_ylim, while the examples pass a list/tuple. Are
> both ways correct?
Yes.
JDH