SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S




1
(1)
2
(4)
3
(12)
4
(5)
5
(30)
6
(21)
7
(20)
8
(11)
9
(9)
10
(12)
11
(11)
12
(22)
13
(22)
14
(38)
15
(25)
16
(23)
17
(20)
18
(7)
19
(13)
20
(13)
21
(18)
22
(6)
23
(7)
24
(4)
25
(9)
26
(35)
27
(37)
28
(22)
29
(27)
30
(12)
31
(4)

Showing 25 results of 25

From: Chris F. <fon...@gm...> - 2009年01月15日 23:07:23
Is there any way of preventing tick label names from being cut off by
the plot canvas? Seems to happen every time:
http://a3.s3.p.quickshareit.com/files/validationb0e66.png
Thanks in advance.
-- 
Chris Fonnesbeck
Department of Mathematics and Statistics
PO Box 56, University of Otago
Dunedin, New Zealand
From: Chris F. <fon...@ma...> - 2009年01月15日 23:04:43
Is there any way of preventing tick label names from being cut off by
the plot canvas? Seems to happen every time:
http://a3.s3.p.quickshareit.com/files/validationb0e66.png
Thanks in advance.
-- 
Chris Fonnesbeck
Department of Mathematics and Statistics
PO Box 56, University of Otago
Dunedin, New Zealand
From: Jae-Joon L. <lee...@gm...> - 2009年01月15日 23:01:16
I presume that you're only interested in the math formula, and not in
any other graphical functionality of MPL. You may use mathtext module
directly in that case.
from matplotlib.mathtext import MathTextParser
p = MathTextParser("bitmap")
filename, texstr = "test.png", r"$\alpha$"
p.to_png(filename, texstr)
d = p.get_depth(texstr)
Take a look at the documentation for more details.
-JJ
On Thu, Jan 15, 2009 at 3:54 PM, <pro...@cl...> wrote:
> Indeed I would also use mpl to have png of formulas so as to put them in a
> HTML page.
>
> C.
>
>
>>va="baseline" does not work?
>>
>>-JJ
>>
>>
>>On Thu, Jan 15, 2009 at 3:05 AM, <pro...@cl...> wrote:
>>>>Dimension of a text in mpl is renderer-dependent in general.
>>>>Each renderer has "get_text_width_height_descent" method which
> returns
>>>>width, height, and descent of the given text.
>>>>If you're only interested in latex-rendered text, you may use the
>>>>get_text_width_height_descent() method in the TexManager.
>>>>
>>>>As you see, it is possible to know the dimension of the text, but
>>>>these functionalities are not exposed to the user, and a bit difficult
>>>> to use unless you're familiar with mpl. If you let us know for what
>>>>you need to use the depth of the text, we may come up with some
> simple
>>>>solution.
>>>>
>>>>Regards,
>>>>
>>>>-JJ
>
>
From: Hani N. <na...@gm...> - 2009年01月15日 22:56:36
The clean build and install worked! (I'm sorry I couldn't get it to work
before--I must not have cleaned it properly.) It's running without any
problems. Thank you very much!
Hani
On Thu, Jan 15, 2009 at 1:09 PM, John Hunter <jd...@gm...> wrote:
> On Mon, Jan 12, 2009 at 9:35 AM, Hani Nakhoul <na...@gm...> wrote:
> > I did use sudo--here are the shell command and the install output:
> >
> > sudo python setup.py install
>
> Please try doing a clean build and install following the instructions at
>
> http://matplotlib.sourceforge.net/faq/installing_faq.html#source-install
>
> Basically do the following
>
> > sudo rm -rf build
> > sudo rm -rf /usr/lib/python2.5/site-packages/mpl_toolkits
> /usr/lib/python2.5/site-packages/matplotlib*
> > python setup.py build > build.out
> > sudo python setup.py install > install.out
>
> and attach both build.out and install.out in your followup email.
>
> Good luck!
> JDH
>
From: <pro...@cl...> - 2009年01月15日 20:54:40
Indeed I would also use mpl to have png of formulas so as to put them in a 
HTML page.
C.
>va="baseline" does not work?
>
>-JJ
>
>
>On Thu, Jan 15, 2009 at 3:05 AM, <pro...@cl...> wrote:
>>>Dimension of a text in mpl is renderer-dependent in general.
>>>Each renderer has "get_text_width_height_descent" method which 
returns
>>>width, height, and descent of the given text.
>>>If you're only interested in latex-rendered text, you may use the
>>>get_text_width_height_descent() method in the TexManager.
>>>
>>>As you see, it is possible to know the dimension of the text, but
>>>these functionalities are not exposed to the user, and a bit difficult
>>> to use unless you're familiar with mpl. If you let us know for what
>>>you need to use the depth of the text, we may come up with some 
simple
>>>solution.
>>>
>>>Regards,
>>>
>>>-JJ
From: <pro...@cl...> - 2009年01月15日 20:31:03
----Message d'origine----
>Date: 2009年1月15日 13:05:21 -0600
>Sujet: Re: [Matplotlib-users] matplotlib and PyQt
>De: John Hunter 
>A: pro...@cl..., Paul Ivanov 
>Copie à: mat...@li...
>
>On Wed, Jan 14, 2009 at 11:28 AM, John Hunter <jd...@gm...> 
wrote:
>
>> Paul Ivanov recently wrote pong using the matplotlib event system, and
>> then provided a gtk and qt version of them that requires no additional
>> gui programming save for starting up the window and event loop.
>
>Oops, accidentally attached the gtk version twice and not the qt
>version -- here are the relevant files
>
>
>>>>>>>> Thanks. I will look how to adapt this PyQT3 example to PyQt4 
(which are realy differents).
Regards.
Christophe.
From: <pro...@cl...> - 2009年01月15日 20:29:20
>> Hello,
>> I would like to see the following example
>> 
http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_demo.
ht
>> 
ml<http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_de
mo.html>using the 2nd one
>> 
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_
qt
>> 
4.html<http://matplotlib.sourceforge.net/examples/user_interfaces/embed
ding_in_qt4.html>.
>> In fact, I don't undrestand how to add the figure to the screen (I'm a 
real
>> beginner with matplotlib but not with PyQt).
>>
>> Thanks for any kind of help.
>>
>
>Everything you need is in those two examples. You create a figure, then
>create a canvas by passing the figure to the FigureCanvasQTAgg()
>constructor. Create the axes using the figure methods, add the ellipses
>using the axes methods, and then you can either set the 
FigureCanvasQTAgg
>instance as the central widget or you can add the canvas to the layout of
>another widget and set the widget as the central widget.
>
>Darren
>
>>> Thanks a lot.
Now I would like to redraw the static graph of the first example. This would 
be my last question.
Regards.
Christophe.
PS : if you want I can give the final example to add it to your examples.
From: David G. <dg...@gm...> - 2009年01月15日 20:27:08
Well, that is something I *did not* try! But it works!
Thanks!
D.
Jae-Joon Lee wrote:
> If you use recent version of mpl, the size of the overall legend
> should scale with the font size.
> See below,
>
> import matplotlib.font_manager
> prop = matplotlib.font_manager.FontProperties(size=5)
> lagend(prop=prop)
>
> Just in case, my preference in your case is to move the legend outside
> of the axes area.
> Regards,
>
> -JJ
>
>
>
> On Wed, Jan 14, 2009 at 9:56 AM, David Geller <dg...@gm...> wrote:
> 
>> Is it possible to make the relative size of the legend smaller? On my
>> plots, the legend covers half the plot, and nothing I have tried so far
>> seems to shrink the legend.
>>
>> Thanks!
>>
>> David
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by:
>> SourcForge Community
>> SourceForge wants to tell your story.
>> http://p.sf.net/sfu/sf-spreadtheword
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>> 
>
> 
From: Darren D. <dsd...@gm...> - 2009年01月15日 19:36:34
On Thu, Jan 15, 2009 at 11:56 AM, <pro...@cl...> wrote:
> Hello,
> I would like to see the following example
> http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_demo.ht
> ml<http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_demo.html>using the 2nd one
> http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt
> 4.html<http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.html>.
> In fact, I don't undrestand how to add the figure to the screen (I'm a real
> beginner with matplotlib but not with PyQt).
>
> Thanks for any kind of help.
>
Everything you need is in those two examples. You create a figure, then
create a canvas by passing the figure to the FigureCanvasQTAgg()
constructor. Create the axes using the figure methods, add the ellipses
using the axes methods, and then you can either set the FigureCanvasQTAgg
instance as the central widget or you can add the canvas to the layout of
another widget and set the widget as the central widget.
Darren
From: John H. <jd...@gm...> - 2009年01月15日 19:09:16
On Mon, Jan 12, 2009 at 9:35 AM, Hani Nakhoul <na...@gm...> wrote:
> I did use sudo--here are the shell command and the install output:
>
> sudo python setup.py install
Please try doing a clean build and install following the instructions at
 http://matplotlib.sourceforge.net/faq/installing_faq.html#source-install
Basically do the following
 > sudo rm -rf build
 > sudo rm -rf /usr/lib/python2.5/site-packages/mpl_toolkits
/usr/lib/python2.5/site-packages/matplotlib*
 > python setup.py build > build.out
 > sudo python setup.py install > install.out
and attach both build.out and install.out in your followup email.
Good luck!
JDH
From: John H. <jd...@gm...> - 2009年01月15日 19:05:29
On Wed, Jan 14, 2009 at 11:28 AM, John Hunter <jd...@gm...> wrote:
> Paul Ivanov recently wrote pong using the matplotlib event system, and
> then provided a gtk and qt version of them that requires no additional
> gui programming save for starting up the window and event loop.
Oops, accidentally attached the gtk version twice and not the qt
version -- here are the relevant files
From: <pro...@cl...> - 2009年01月15日 18:48:56
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<title>Flashmail</title>
<style type="text/css">
BODY, TABLE, TR, TD, P {margin:0;padding:0;}
BODY {background:#FFFFFF;}
</style>
</head>
<body>
<P>&gt;Simson Garfinkel wrote: <BR>&gt;&gt; Why do you want to use PyQt and not wxwidgets? <BR>&gt;&gt; <BR>&gt;maybe because the Qt license changed ? <BR>&gt;That's a reason for me to be interested in the answer. <BR>&gt; <BR>&gt;cheers, <BR>&gt;Stef&nbsp;<BR></P>
<P>&nbsp;</P>
<P>Here something that could interest you.</P>
<P>Christophe</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>Dear Qt User: <BR><BR>Nokia is pleased to announce that with the release of Qt 4.5 you will <BR>be able to use Qt under the Lesser General Public License (LGPL) <BR>version 2.1 terms. When released in March 2009, Qt will be made <BR>available under three licensing options: Commercial, LGPL and GPL. <BR>Prior versions of Qt are not impacted by this announcement. <BR><BR>Nokia is committed to Qt and its continued development. By offering Qt <BR>under LGPL version 2.1 license terms alongside today’s
licensing <BR>options Nokia hopes to: <BR><BR>- facilitate wider adoption of Qt across industries, desktop, web and <BR>embedded platforms. <BR>- establish Qt as a de facto standard for application development. <BR>- receive more valuable feedback and increased user contributions to <BR>ensure that Qt remains the best-in-class, cross-platform framework. <BR>- extend Nokia’s existing platform commitment to the open source <BR>community. <BR><BR>By offering a cost-free LGPL license as well as commercial and
GPL <BR>licenses to Qt, you can choose the license model that best fits your <BR>development requirements. <BR><BR>Irrespective of which license model you choose: <BR><BR>- Qt Software is committed to continuing to provide our customers with <BR>the same level of professional support, services and regular releases <BR>you have come to expect of Qt Software. <BR>- We will continue to actively develop Qt, and with a greater degree <BR>of cooperation with the community through a new contribution model, we
<BR>hope to make Qt even more valuable to our users. <BR><BR>For more information on the introduction of the LGPL license and what <BR>this means for you, please consult the Frequently Asked Questions <BR>section on <A href="http://www.qtsoftware.com/" target=_blank>www.qtsoftware.com</A>. <BR><BR>Best regards <BR><BR>Tom Miller <BR>Director of Sales <BR>Nokia, Qt Software&nbsp;&nbsp;</P></body></html>
From: Stef M. <ste...@gm...> - 2009年01月15日 18:34:25
Simson Garfinkel wrote:
> Why do you want to use PyQt and not wxwidgets?
> 
maybe because the Qt license changed ?
That's a reason for me to be interested in the answer.
cheers,
Stef
From: Eric J. <jo...@MI...> - 2009年01月15日 18:15:16
I've looked in both the examples and the docs, and have yet to find a
clear way of accomplishing the following: 
I have a plot with two subplots: 
|-----------------------------------|
| |
| |
|-----------------------------------|
| |
| |
| |
. .
. .
That is, I want the top subplot (which shows aggregate data, using the
same x-axis) to always be, say, 80 pix high, and the bottom subplot
to scale with the number of things (in this case, sparkline-like
timelines) I add to it. So there's not a constant ratio between
the top and bottom subplots. Might anyone be able to point me in the
right direction, either to an explicit example or someplace in the
docs? 
Thanks!
			...Eric Jonas
From: <pro...@cl...> - 2009年01月15日 16:56:41
Hello,
I would like to see the following example http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_demo.ht
ml using the 2nd one http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt
4.html .
In fact, I don't undrestand how to add the figure to the screen (I'm a real 
beginner with matplotlib but not with PyQt).
Thanks for any kind of help.
From: Ryan M. <rm...@gm...> - 2009年01月15日 16:34:46
Oscar ¿? wrote:
> Hello folks,
> 
> I ́m a new user of this forum. I'm trying to work in Python at the moment
> but it ́s quite difficult for me. My first question is if it is possible
> to do Color Maps in Matplotlib in the same manner of the "mesh" function
> in Matlab. Could you help me anybody?
Since you're just starting out, I'd take a look at:
http://matplotlib.sourceforge.net/gallery.html
to get a feel for what's possible with matplotlib. It sounds like what you're
interested would be pcolor/pcolormesh.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Michael D. <md...@st...> - 2009年01月15日 15:03:33
Thanks for the report.
This issue is actually already fixed in matplotlib SVN as of r6283:
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib?view=rev&revision=6283
You can use the above patch to patch your local copy if you don't want 
to install entirely from SVN.
Mike
Philipp Lies wrote:
> Hi,
>
> I have a problem with pyplot. When I'm passing an numpy array with complex
> entries to imshow I receive the error message:
> TypeError: array cannot be safely cast to required type
> Which is ok, when I thereafter call imshow with a valid image (i)python
> segfaults. Sometimes it even segfaults instead of the above error message:
>
> Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
> [GCC 4.3.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> 
>>>> from matplotlib.pyplot import *
>>>> 
> /usr/lib/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module
> dateutil was already imported from
> /var/lib/python-support/python2.5/dateutil/__init__.py, but
> /var/lib/python-support/python2.5 is being added to sys.path
> from pkg_resources import resource_stream
> 
>>>> from numpy import *
>>>> X = random.uniform(size=(10,10))
>>>> Xc = X*1j
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x295e2d0>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x253efd0>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x2970f90>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x296d790>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x2973ed0>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x29752d0>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x2975610>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x29758d0>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x2975b90>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x2975e50>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x2975a50>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x297b390>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x297b6d0>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x297b990>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x297bc50>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x297bf10>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x297bb10>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x297f4d0>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x297f790>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x297fa50>
> 
>>>> imshow(X)
>>>> 
> <matplotlib.image.AxesImage object at 0x297fd10>
> 
>>>> imshow(Xc)
>>>> 
> Segmentation fault
>
> The only deterministic behaviour after calling imshow with a complex array
> is that it segfaults anytime. Quite annoying because I forget to convert to
> real quite often 8-).
>
> I use matplotlib, python, and numpy with the latest backport version
> available in Ubuntu Intrepid 8.10 amd64 (numpy 1.1.1, python 2.5.2,
> matplotlib
> 0.98.3). Does also crash in ipython 0.9.1 with and without -pylab flag
> started.
>
> I filed a bug but so far no one responded, so maybe here's some help.
> http://sourceforge.net/tracker2/?func=detail&aid=2502029&group_id=80706&atid=560720
>
> Cheers
>
> Phil
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: John H. <jd...@gm...> - 2009年01月15日 14:42:06
On Thu, Jan 15, 2009 at 7:56 AM, Michael Droettboom <md...@st...> wrote:
> The matplotlib-announce list is for announcements about releases of
> matplotlib and related projects only. Please ask user questions on
> matplotlib-users. (I have forwarded this message there).
>
> There is a table of which output formats are supported by each backend here:
>
> http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/FILETYPES?revision=3801&view=markup
>
> GtkAgg should be your best bet, but due to its reliance on Gtk, it can't
> be run on a headless server. If you need to run in such a mode (such as
> on a webserver), your best bet is probably to use Agg, save to png, and
> use PIL or ImageMagick etc. to convert afterward.
You may want to reevaluate *why* you need jpeg. We have intentionally
not provided a jpg output because png is so much better for graphs and
text. If all you are doing is image processing of natural scenes,
then yes jpeg is better in most cases, but if you are making graphs
which is the bread and butter of matplotlib, then png will be
superior.
JDH
From: Michael D. <md...@st...> - 2009年01月15日 13:56:28
The matplotlib-announce list is for announcements about releases of 
matplotlib and related projects only. Please ask user questions on 
matplotlib-users. (I have forwarded this message there).
There is a table of which output formats are supported by each backend here:
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/FILETYPES?revision=3801&view=markup
GtkAgg should be your best bet, but due to its reliance on Gtk, it can't 
be run on a headless server. If you need to run in such a mode (such as 
on a webserver), your best bet is probably to use Agg, save to png, and 
use PIL or ImageMagick etc. to convert afterward.
Mike
Emanuele Passera wrote:
> Hi all,
> I have always used .png format for my matplotlib applications but now i am 
> compelled to save many figures in .jpeg format.
> Those image should be automatically saved (no GUI) but i can't find out how to 
> save the images.
>
> Executing this scripts 
>
> import pylab as p
> p.rcParams['backend']='gdk'
> p.figure(1)
> p.plot([1,2,3,4,5,6],[3,7,5,4,6,3])
> p.savefig("example.jpg")
>
> It gives me this error
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 345, in 
> savefig
> return fig.savefig(*args, **kwargs)
> File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 990, in 
> savefig
> self.canvas.print_figure(*args, **kwargs)
> File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 
> 1373, in print_figure
> '%s.' % (format, ', '.join(formats)))
> ValueError: Format "jpg" is not supported.
> Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz.
>
> Can anyone help me ? (.jpeg extension it doesn't work too)
> By the way, what is the best backend to fulfill the task ? (better quality and 
> less memory leackage ?)
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Scott S. <sco...@gm...> - 2009年01月15日 13:46:07
> 2009年1月15日 Oscar ¿? <pi...@ho...>
> I ́m a new user of this forum. I'm trying to work in Python at the moment but it ́s quite difficult for me. My first question is if it is
> possible to do Color Maps in Matplotlib in the same manner of the "mesh" function in Matlab. Could you help me anybody?
Hi Oscar,
Matplotlib is a purely 2D plotting library, it doesn't provide similar
capability to the Matlab 'mesh' function. For 3D plotting you could
use Mayavi
http://code.enthought.com/projects/mayavi/
You can probably still get great visualization of your results using
the Matplotlib functions pcolor, pcolormesh, contour, contourf or
imshow. See the documentation and examples at these links to get
started.
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.pcolor
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.pcolormesh
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.imshow
http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo.html
http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo2.html
http://matplotlib.sourceforge.net/examples/pylab_examples/quadmesh_demo.html
http://matplotlib.sourceforge.net/examples/pylab_examples/contour_image.html
Also look at the pyplot tutorial and post to the list if you get stuck.
http://matplotlib.sourceforge.net/users/pyplot_tutorial.html
Cheers,
Scott
From: Emanuele P. <ema...@tr...> - 2009年01月15日 12:59:01
Hi all,
I have always used .png format for my matplotlib applications but now i am 
compelled to save many figures in .jpeg format.
Those image should be automatically saved (no GUI) but i can't find out how to 
save the images.
Executing this scripts 
import pylab as p
p.rcParams['backend']='gdk'
p.figure(1)
p.plot([1,2,3,4,5,6],[3,7,5,4,6,3])
p.savefig("example.jpg")
It gives me this error
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 345, in 
savefig
 return fig.savefig(*args, **kwargs)
 File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 990, in 
savefig
 self.canvas.print_figure(*args, **kwargs)
 File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 
1373, in print_figure
 '%s.' % (format, ', '.join(formats)))
ValueError: Format "jpg" is not supported.
Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz.
Can anyone help me ? (.jpeg extension it doesn't work too)
By the way, what is the best backend to fulfill the task ? (better quality and 
less memory leackage ?)
Thank you
-- 
------------------------------------------------------------
Emanuele Passera
Tele-Rilevamento Europa - T.R.E. s.r.l.
a POLIMI spin-off company
Via Vittoria Colonna, 7
20149 Milano - Italia
tel.: +39.02.4343.121
fax: +39.02.4343.1230
e-mail: ema...@tr...
web: www.treuropa.com
-------------------------------------------------------------
From: Oscar ¿? <pi...@ho...> - 2009年01月15日 11:09:36
Hello
folks,
I ́m a new user of this forum. I'm trying to work in Python at the moment but
it ́s quite difficult for me. My first question is if it is possible to do Color
Maps in Matplotlib in the same manner of the "mesh" function in
Matlab. Could you help me anybody?
Thanks in advance.
Regards.
_________________________________________________________________
Nuevo Windows Live, un mundo lleno de posibilidades. Descúbrelo.
http://www.microsoft.com/windows/windowslive/default.aspx 
From: Jae-Joon L. <lee...@gm...> - 2009年01月15日 09:23:11
va="baseline" does not work?
-JJ
On Thu, Jan 15, 2009 at 3:05 AM, <pro...@cl...> wrote:
>>Dimension of a text in mpl is renderer-dependent in general.
>>Each renderer has "get_text_width_height_descent" method which returns
>>width, height, and descent of the given text.
>>If you're only interested in latex-rendered text, you may use the
>>get_text_width_height_descent() method in the TexManager.
>>
>>As you see, it is possible to know the dimension of the text, but
>>these functionalities are not exposed to the user, and a bit difficult
>> to use unless you're familiar with mpl. If you let us know for what
>>you need to use the depth of the text, we may come up with some simple
>>solution.
>>
>>Regards,
>>
>>-JJ
> Hello,
>
> my purpose would be to align several formula for example.
>
>
>
> Regrads,
>
> Christophe.
>
>
From: Philipp L. <phi...@go...> - 2009年01月15日 08:27:10
Hi,
I have a problem with pyplot. When I'm passing an numpy array with complex
entries to imshow I receive the error message:
TypeError: array cannot be safely cast to required type
Which is ok, when I thereafter call imshow with a valid image (i)python
segfaults. Sometimes it even segfaults instead of the above error message:
Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib.pyplot import *
/usr/lib/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module
dateutil was already imported from
/var/lib/python-support/python2.5/dateutil/__init__.py, but
/var/lib/python-support/python2.5 is being added to sys.path
from pkg_resources import resource_stream
>>> from numpy import *
>>> X = random.uniform(size=(10,10))
>>> Xc = X*1j
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x295e2d0>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x253efd0>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x2970f90>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x296d790>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x2973ed0>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x29752d0>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x2975610>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x29758d0>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x2975b90>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x2975e50>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x2975a50>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x297b390>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x297b6d0>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x297b990>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x297bc50>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x297bf10>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x297bb10>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x297f4d0>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x297f790>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x297fa50>
>>> imshow(X)
<matplotlib.image.AxesImage object at 0x297fd10>
>>> imshow(Xc)
Segmentation fault
The only deterministic behaviour after calling imshow with a complex array
is that it segfaults anytime. Quite annoying because I forget to convert to
real quite often 8-).
I use matplotlib, python, and numpy with the latest backport version
available in Ubuntu Intrepid 8.10 amd64 (numpy 1.1.1, python 2.5.2,
matplotlib
0.98.3). Does also crash in ipython 0.9.1 with and without -pylab flag
started.
I filed a bug but so far no one responded, so maybe here's some help.
http://sourceforge.net/tracker2/?func=detail&aid=2502029&group_id=80706&atid=560720
Cheers
Phil
-- 
View this message in context: http://www.nabble.com/Segmentation-fault-when-calling-imshow-with-complex-array-tp21473274p21473274.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: <pro...@cl...> - 2009年01月15日 08:05:43
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<title>Flashmail</title>
<style type="text/css">
BODY, TABLE, TR, TD, P {margin:0;padding:0;}
BODY {background:#FFFFFF;}
</style>
</head>
<body>
<P>&gt;Dimension of a text in mpl is renderer-dependent in general. <BR>&gt;Each renderer has "get_text_width_height_descent" method which returns <BR>&gt;width, height, and descent of the given text. <BR>&gt;If you're only interested in latex-rendered text, you may use the <BR>&gt;get_text_width_height_descent() method in the TexManager. <BR>&gt; <BR>&gt;As you see, it is possible to know the dimension of the text, but <BR>&gt;these functionalities are not exposed to the user, and a bit difficult <BR>&gt;
to use unless you're familiar with mpl. If you let us know for what <BR>&gt;you need to use the depth of the text, we may come up with some simple <BR>&gt;solution. <BR>&gt; <BR>&gt;Regards, <BR>&gt; <BR>&gt;-JJ <BR>Hello,</P>
<P>my purpose would be to align several formula for example.</P>
<P>&nbsp;</P>
<P>Regrads,</P>
<P>Christophe.</P>
<P>&nbsp;</P></body></html>

Showing 25 results of 25

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /