No: from matplotlib.backends.backend_gtkagg import
> FigureCanvasGTK as FigureCanvas
> Yes: from matplotlib.backends.backend_gtkagg import
> FigureCanvasGTKAgg as FigureCanvas
To which I should add a bit of clarification.
You called
import pygtk
pygtk.require("2.0")
import os, gtk
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib.backends.backend_gtkagg import FigureCanvasGTK as FigureCanvas
from matplotlib.figure import Figure
The problem (aside from the fact that you need and not
FigureCanvasGTK) is that the 'use' directive is a pylab only
construct. It is used by the override the rc file backend setting
that the pylab module normally reads. It is irrelevant to the API
(and hence was ignored), where you can use an many different types of
FigureCanvases as make sense in your environment. Ie, there is no
concept of a default or current backend in the API, and the canvases
you import and create are the ones that will be used.
JDH
Bingo. The two plots are identical after this fix. Thanks for the help
and additional clarifications on the 'use' directive and canvases.
···
-----Original Message-----
From: John Hunter [mailto:jdhunter@…4…]
Sent: Wednesday, April 27, 2005 1:07 PM
To: Jeffrey Orrey
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] plot resolution discrepancy with
embeddingin gtk
> No: from matplotlib.backends.backend_gtkagg import
> FigureCanvasGTK as FigureCanvas
> Yes: from matplotlib.backends.backend_gtkagg import
> FigureCanvasGTKAgg as FigureCanvas
To which I should add a bit of clarification.
You called
import pygtk
pygtk.require("2.0")
import os, gtk
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib.backends.backend_gtkagg import FigureCanvasGTK as
FigureCanvas
from matplotlib.figure import Figure
The problem (aside from the fact that you need and not
FigureCanvasGTK) is that the 'use' directive is a pylab only construct.
It is used by the override the rc file backend setting that the pylab
module normally reads. It is irrelevant to the API (and hence was
ignored), where you can use an many different types of FigureCanvases as
make sense in your environment. Ie, there is no concept of a default or
current backend in the API, and the canvases you import and create are
the ones that will be used.
JDH