axis method embedded in wx

Jeremy, how can I set axes limits on a figure embedded in

    > WX? I am plotting with

    > a = self.figmgr.add_subplot(111) a.plot(x,y)

    > just like in your example.

    > I would like to do someting like:

    > axis([0,10,0,10])

There is no axis command in the OO interface (though is would be easy
to add..). You can always go to matlab.py and see how it is
interacting with the gca instance. If you use your 'a' instance
everywhere it uses gca(), you can duplicate it's functionality.

    > set(gca(),'xticklabels',[]) set(gca(),'yticklabels',[])
    > set(gca(),'xticks',[]) set(gca(),'yticks',[])

the syntax of set is

  set(object or sequence, somestring, attribute)

if called with an object, set calls

  object.set_somestring(attribute)

if called with a sequence, set does

  for object in sequence:
       object.set_somestring(attribute)

So for your example, gca() is an object, so

  a.set_xticklabels([])
  a.set_yticklabels([])
  a.set_xticks([])
  a.set_yticks([])

You may want to take another look at the tutorial section "Controlling
axes properties" which gives examples of both the matlab and OO
methods

To replicate axis, do

  a.set_xlim((xmin, xmax))
  a.set_ylim((ymin, ymax))

Should help!
JDH

Thanks a lot John! sorry for not seeing that this was on the tutorial.

As soon as mathtext is supported in WX (next release right?) my code will be fully functional.

AS soon as I get the parsing thing figured out (see my other message), I’ll upgrade the equation box example to parse a list of math expressions in standard python notation, and plot them in all their glory.

I will also have to figure out how to resize the plot to fit longer equations or break them (which would probably be easier).

Thanks again!


fiocruz4.jpg
Flávio Codeço Coelho, PhD

Programa de Computação Científica

Fundação Oswaldo Cruz

Rio de Janeiro – Brasil

···

On Fri, 2004-04-16 at 16:28, John Hunter wrote:

*
  the syntax of set is
set(object or sequence, somestring, attribute)
if called with an object, set calls
object.set_somestring(attribute)
if called with a sequence, set does
for object in sequence:
object.set_somestring(attribute)
So for your example, gca() is an object, so a.set_xticklabels([])
a.set_yticklabels([])
a.set_xticks([])
  a.set_yticks([])*