Xlator and Mathtext

from matplotlib.backends.backend_wx import Toolbar,

    > FigureCanvasWx, FigureManager

    > do you think this can be the problem? If So How should I
    > change it to make it right?

Oh... so now you tell me :slight_smile: ! This is definitely a problem.

Yes, you should do

from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWx, FigureManager

The backend switching mechanisms (eg -d, matplotlib.use, matplotlibrc)
are for the matlab interface. You are using the API directly and so
these do not apply.

Note that the toolbar and the figure manager are the same in
backend_wx and backend_wxagg (the latter just imports them directly
from the former). So if you want to easily switch between backend_wx
or backend_wxagg (ie to test performance or use a different one if yo
encounter troubles) you can do

from matplotlib.backends.backend_wxagg import Toolbar, FigureManager
from matplotlib.backends.backend_wxagg import FigureCanvasWx as FigureCanvas

Then use FigureCanvas in your code to instantiate new canvases.
Switching back to the wx canvas (native wx drawing rather than agg
drawing) is as simple as changing the one line to

from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas

Hope this helps,
John

*

from matplotlib.backends.backend_wx import Toolbar,
FigureCanvasWx, FigureManager
do you think this can be the problem? If So How should I
change it to make it right?
Oh… so now you tell me :slight_smile: ! This is definitely a problem.
Yes, you should do
from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWx, FigureManager*

While I waited for your response, I tried just that, but the version I have (0.53.1) of matplotlib.backends.backend_wxagg does not have the class and FigureManager So I get an Import error…

Traceback (most recent call last):

File “PyMB.py”, line 32, in ?

import wxFrame1

File “/home/fccoelho/Documents/Projects_software/modelbuilder/wxFrame1.py”, line 43, in ?

import PlotFigure as PF

File “/home/fccoelho/Documents/Projects_software/modelbuilder/PlotFigure.py”, line 20, in ?

from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWx, FigureManager

ImportError: cannot import name FigureManager

*The backend switching mechanisms (eg -d, matplotlib.use, matplotlibrc)
are for the matlab interface. You are using the API directly and so
these do not apply.*

Well, Here I was misled by the example embedded_in_wx, which has that line.smiley-9.png Should I just delete the darn line?smiley-3.png

*Note that the toolbar and the figure manager are the same in
backend_wx and backend_wxagg (the latter just imports them directly
from the former).*

well maybe in CVS it works but in 0.53.1 I can’ t import FigureManager from backend_wxagg.smiley-11.png

*
So if you want to easily switch between backend_wx
or backend_wxagg (ie to test performance or use a different one if yo
encounter troubles) you can do
from matplotlib.backends.backend_wxagg import Toolbar, FigureManager
from matplotlib.backends.backend_wxagg import FigureCanvasWx as FigureCanvas*

Should I not import FigureCanvasWxAgg instead of FigureCanvasWx?

*
Then use FigureCanvas in your code to instantiate new canvases.
Switching back to the wx canvas (native wx drawing rather than agg
drawing) is as simple as changing the one line to
from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas
Hope this helps,
John*

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

Programa de Computação Científica

Fundação Oswaldo Cruz

Rio de Janeiro – Brasil

···

On Mon, 2004-05-03 at 14:15, John Hunter wrote: