Carlos Guâno Grohmann wrote:
> I am writing an app focused in structural geology, using wxpython and
> matplotlib. To be quite honest, I'm not sure if this question should
> go here or in the wxpython list

Well, that depends on whether the shift is a shift of the wxWindow, or 
if MPL is somehow putting your plot in a different place in the Figure. 
I do see the circle get smaller sometimes, though it doesn't shift for 
me -- I think it's an MPL issue:

OS-X 10.4 PPC, Python2.5.4, wxPython2.8.9.1, MPL 0.98.5.2

The issue may be that you are creating anew axis in each call, but I 
think what you want is to be using the same axis each time.



> Try this with the attached code:

Your code doesn't run as-is -- the images are expected to be in a 
particular directory. -- you really need to make it as easy as possible 
for folks to test your code:

http://wiki.wxpython.org/MakingSampleApps

A few other comments from a quick look.

  - You're using tabs to indent. Like it or not, 4 spaces is the python 
standard now.

  - hard coded IDs are a pretty old style:
     http://wiki.wxpython.org/wxPython%20Style%20Guide

  - you might want to look into wxPython's "img2py" scripts, for 
embedding small icons in Python code.

  - I think Your PlotPanel has one more sizer that required -- something 
like this should work:

                box1 = wx.BoxSizer(wx.VERTICAL)
                st1 = wx.StaticText(self, -1, 'Plot')
                box1.Add(st1, 0, wx.RIGHT)

                self.figure = Figure(figsize=(6,6))#
                self.canvas = FigureCanvas(self, -1, self.figure)

                box1.Add(self.canvas, 1, wx.EXPAND|wx.ALL, 4)
                self.SetSizer(box1)




  open the data (1st btn), create the
> plot (2nd btn), then plot the data as points (3rd and 4th btns) and
> then as lines (5th btn). OK, now clean the plot (2nd btn) and plot
> first as lines (5th btn) and then as points (3rd or 4th btns), and you
> will see that the plot moves to the left! At least for me (Ubuntu
> Linux).
> 
> If you could give me any advice on why this is happening (and how to
> prevent it), I will be very thankful.
> 
> PS. I know my code is not as good as it could. I'm new to
> OO-programing, so I still need to understand properly how to work with
> classes, etc, and I promisse I will improve the code in the near
> future! (any advices here are also welcome!)
> 
> Many thanks for your help
> 
> Carlos
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and 
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today. 
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to