|
From: Florian L. <mai...@xg...> - 2005-05-13 16:34:54
|
Hello, taken form the tutorial http://matplotlib.sourceforge.net/leftwich_tut.txt I use the code: from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure fig = Figure() canvas = FigureCanvas(fig) ax = fig.add_subplot(111) ax.plot([1,2,3]) ax.set_title('hi mom') ax.grid(True) ax.set_xlabel('time') ax.set_ylabel('volts') canvas.print_figure('test') Which IMO uses the AGG backend (which works fine for my using the pylab interface). But upon excecution I get: No module named pygtk PyGTK version 1.99.16 or greater is required to run the GTK Matplotlib backends What is wrong there? Thx, Florian |
|
From: Alan G I. <ai...@am...> - 2005-05-13 16:40:57
|
On Fri, 13 May 2005, Florian Lindner apparently wrote: > No module named pygtk > PyGTK version 1.99.16 or greater is required to run the GTK Matplotlib > backends > What is wrong there? Sorry if this is otiose but: do you have pygtk? http://www.pygtk.org/ Cheers, Alan Isaac |
|
From: Florian L. <mai...@xg...> - 2005-05-13 16:44:37
|
Am Freitag, 13. Mai 2005 18:41 schrieb Alan G Isaac: > On Fri, 13 May 2005, Florian Lindner apparently wrote: > > No module named pygtk > > PyGTK version 1.99.16 or greater is required to run the GTK Matplotlib > > backends > > What is wrong there? > > Sorry if this is otiose but: > do you have pygtk? > http://www.pygtk.org/ No, and I don't want it. I want to use the AGG backend for generating graphics. Florian |
|
From: John H. <jdh...@ac...> - 2005-05-13 16:41:00
|
>>>>> "Florian" == Florian Lindner <mai...@xg...> writes:
Florian> Which IMO uses the AGG backend (which works fine for my
Florian> using the pylab interface).
Florian> But upon excecution I get:
Florian> No module named pygtk PyGTK version 1.99.16 or greater is
Florian> required to run the GTK Matplotlib backends
Florian> What is wrong there?
My guess is that you are importing pylab somewhere in your script. Is
this the case?
JDH
|
|
From: Florian L. <mai...@xg...> - 2005-05-13 16:43:37
|
Am Freitag, 13. Mai 2005 18:40 schrieb John Hunter: > >>>>> "Florian" == Florian Lindner <mai...@xg...> writes: > > Florian> Which IMO uses the AGG backend (which works fine for my > Florian> using the pylab interface). > > Florian> But upon excecution I get: > > Florian> No module named pygtk PyGTK version 1.99.16 or greater is > Florian> required to run the GTK Matplotlib backends > > > Florian> What is wrong there? > > My guess is that you are importing pylab somewhere in your script. Is > this the case? No. I pasted the complete script into the mail. There is nothing else I execute... Thx, Florian |
|
From: John H. <jdh...@ac...> - 2005-05-13 16:50:13
|
>>>>> "Florian" == Florian Lindner <mai...@xg...> writes:
Florian> No. I pasted the complete script into the mail. There is
Florian> nothing else I execute...
Please post the following commands, or their equivalent for your
platform, and their output. Please include the commands you actually
type in your post.
> cat test.py
> /usr/bin/python2.4 ./test.py --verbose-helpful
JDH
|
|
From: Chris B. <Chr...@no...> - 2005-05-13 17:53:37
|
Florian Lindner wrote: > Hello, > taken form the tutorial http://matplotlib.sourceforge.net/leftwich_tut.txt I > use the code: > > from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas > from matplotlib.figure import Figure > > fig = Figure() > canvas = FigureCanvas(fig) > ax = fig.add_subplot(111) > ax.plot([1,2,3]) > ax.set_title('hi mom') > ax.grid(True) > ax.set_xlabel('time') > ax.set_ylabel('volts') > canvas.print_figure('test') > > Which IMO uses the AGG backend (which works fine for my using the pylab > interface). > > But upon excecution I get: > > No module named pygtk > PyGTK version 1.99.16 or greater is required to run the GTK Matplotlib > backends while this shouldn't be necessary for this script, you might try: import matplotlib matplotlib.use("AGG") # I may have that string wrong. before any of the other imports. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
|
From: Florian L. <mai...@xg...> - 2005-05-13 23:56:17
|
Am Freitag, 13. Mai 2005 18:49 schrieb John Hunter:
> >>>>> "Florian" == Florian Lindner <mai...@xg...> writes:
>
> Florian> No. I pasted the complete script into the mail. There is
> Florian> nothing else I execute...
>
> Please post the following commands, or their equivalent for your
> platform, and their output. Please include the commands you actually
> type in your post.
>
> > cat test.py
> > /usr/bin/python2.4 ./test.py --verbose-helpful
Here we go:
florian@horus ~/visualizer $ cat test.py
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.plot([1,2,3])
ax.set_title('hi mom')
ax.grid(True)
ax.set_xlabel('time')
ax.set_ylabel('volts')
canvas.print_figure('test')
florian@horus ~/visualizer $ /usr/bin/python2.4 ./test.py --verbose-helpful
bash: /usr/bin/python2.4: Datei oder Verzeichnis nicht gefunden
florian@horus ~/visualizer $ /usr/bin/python ./test.py --verbose-helpful
matplotlib data path /usr/share/matplotlib
loaded rc file /usr/share/matplotlib/.matplotlibrc
matplotlib version 0.80
verbose.level helpful
interactive is False
platform is linux2
numerix Numeric 23.7
font search path ['/usr/share/matplotlib']
loaded ttfcache file /home/florian/.ttffont.cache
No module named pygtk
PyGTK version 1.99.16 or greater is required to run the GTK Matplotlib
backends
Ok, I admin I've just seen that the .matplotlibrc sets GTK as the default
backend. But isn't that being overwritten?
florian@horus ~/visualizer $ cat /usr/share/matplotlib/.matplotlibrc | grep
backend
backend : GTKAgg # the default backend
[...]
Regards,
Florian
|
|
From: John H. <jdh...@ac...> - 2005-05-14 21:05:24
|
>>>>> "Florian" == Florian Lindner <mai...@xg...> writes:
Florian> Am Freitag, 13. Mai 2005 18:49 schrieb John Hunter:
>> >>>>> "Florian" == Florian Lindner <mai...@xg...>
>> writes:
>>
Florian> No. I pasted the complete script into the mail. There is
Florian> nothing else I execute...
>> Please post the following commands, or their equivalent for
>> your platform, and their output. Please include the commands
>> you actually type in your post.
>>
>> > cat test.py > /usr/bin/python2.4 ./test.py --verbose-helpful
Florian> Here we go:
Well, I'll be damned. I really can't believe this hasn't cropped up
before -- it's a real bug.
The errant code is in matplotlib/backends/__init___.py
# Import the requested backend into a generic module object
backend_name = 'backend_'+backend.lower()
backend_mod = __import__('matplotlib.backends.'+backend_name,
globals(),locals(),[backend_name])
Where the default backend is being imported. These changes were
introduced many moons ago by Fernando when he was cleaning up the
backend import for ipython/pylab. Then need top be moved to a
function or otherwise deferred until pylab asks for them, to prevent
the kind of problem you are seeing.
As a workaround, add these two lines at the top of your script:
import matplotlib
matplotlib.use('Agg')
or change the default backend in the rc file to 'Agg'. Even though
there are 2 good workarounds, I still consider this to be a little bug,
because the OO interface shouldn't be doing any magic like importing a
backend implicitly. Would you be willing to file a bug report on the
sourceforge site?
Thanks,
JDH
|
|
From: <Fer...@co...> - 2005-05-14 21:21:10
|
Quoting John Hunter <jdh...@ni...>:
> Well, I'll be damned. I really can't believe this hasn't cropped up
> before -- it's a real bug.
>
> The errant code is in matplotlib/backends/__init___.py
>
> # Import the requested backend into a generic module object
> backend_name = 'backend_'+backend.lower()
> backend_mod = __import__('matplotlib.backends.'+backend_name,
> globals(),locals(),[backend_name])
>
> Where the default backend is being imported. These changes were
> introduced many moons ago by Fernando when he was cleaning up the
> backend import for ipython/pylab. Then need top be moved to a
> function or otherwise deferred until pylab asks for them, to prevent
> the kind of problem you are seeing.
sorry 'bout that, a pure effect of my modifying code in an overall system (the
mpl OO structure) I knew nothing about...
Cheers,
f
|
|
From: Florian L. <mai...@xg...> - 2005-05-15 17:06:23
|
Am Samstag, 14. Mai 2005 23:05 schrieb John Hunter:
> >>>>> "Florian" == Florian Lindner <mai...@xg...> writes:
>
> Florian> Am Freitag, 13. Mai 2005 18:49 schrieb John Hunter:
> >> >>>>> "Florian" == Florian Lindner <mai...@xg...>
> >>
> >> writes:
>
> Florian> No. I pasted the complete script into the mail. There is
> Florian> nothing else I execute...
>
> >> Please post the following commands, or their equivalent for
> >> your platform, and their output. Please include the commands
> >> you actually type in your post.
> >>
> >> > cat test.py > /usr/bin/python2.4 ./test.py --verbose-helpful
>
> Florian> Here we go:
>
> Well, I'll be damned. I really can't believe this hasn't cropped up
> before -- it's a real bug.
>
> The errant code is in matplotlib/backends/__init___.py
>
> # Import the requested backend into a generic module object
> backend_name = 'backend_'+backend.lower()
> backend_mod = __import__('matplotlib.backends.'+backend_name,
> globals(),locals(),[backend_name])
>
> Where the default backend is being imported. These changes were
> introduced many moons ago by Fernando when he was cleaning up the
> backend import for ipython/pylab. Then need top be moved to a
> function or otherwise deferred until pylab asks for them, to prevent
> the kind of problem you are seeing.
>
> As a workaround, add these two lines at the top of your script:
>
> import matplotlib
> matplotlib.use('Agg')
>
> or change the default backend in the rc file to 'Agg'. Even though
> there are 2 good workarounds, I still consider this to be a little bug,
> because the OO interface shouldn't be doing any magic like importing a
> backend implicitly. Would you be willing to file a bug report on the
> sourceforge site?
Could you file the backreport? I'm not very involved in the matplotlib
development and therefore I'm sure your report could be much more precise.
Regards,
Florian
|
|
From: Alan G I. <ai...@am...> - 2005-05-15 17:34:32
|
On Sun, 15 May 2005, Florian Lindner apparently wrote: > Could you file the backreport? I'm not very involved in > the matplotlib development and therefore I'm sure your > report could be much more precise. I think before asking this you might ask yourself: Would I prefer John to spend his time on this, or on development? Just my opion, Alan Isaac |
|
From: Florian L. <mai...@xg...> - 2005-05-16 13:22:30
|
Am Sonntag, 15. Mai 2005 19:35 schrieb Alan G Isaac: > On Sun, 15 May 2005, Florian Lindner apparently wrote: > > Could you file the backreport? I'm not very involved in > > the matplotlib development and therefore I'm sure your > > report could be much more precise. > > I think before asking this you might ask yourself: > Would I prefer John to spend his time on this, > or on development? > > Just my opion, Whatever. Done. |