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
(1)
3
(15)
4
(8)
5
(2)
6
(6)
7
(11)
8
(2)
9
(3)
10
(5)
11
(1)
12
(8)
13
(15)
14
(11)
15
16
17
(1)
18
19
20
(5)
21
(17)
22
(6)
23
(3)
24
(9)
25
(8)
26
(20)
27
(9)
28
(15)
29
30
31
(2)





Showing 13 results of 13

From: Humufr <hu...@ya...> - 2004年05月03日 22:23:58
There are something I did't see in the list (but perhaps it's possible 
to do now) and that I think will be useful for astronomer. it's to plot 
an image with axes in astronomical unit (RA and Dec)
like this function in pgplot:
http://www.astro.caltech.edu/~tjp/pgplot/subroutines.html#PGTBOX
thanks for this software who are very good,
 Nicolas Gruel
John Hunter wrote:
>Perry Greenfield has spent a fair amount of time talking with me and
>the folks working at stsci on matplotlib to come up with a set of
>goals and priorities for near term development, and has thoroughly
>revamped the goals page
>
> http://matplotlib.sourceforge.net/goals.html
>
>We hope that this page will stay much more current than the last page,
>which grew fairly static as most of the goals at the time the page was
>created were fulfilled.
>
>Take a look over the list and speak up for anything we may have
>overlooked. 
>
>JDH
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: Oracle 10g
>Get certified on the hottest thing ever to hit the market... Oracle 10g. 
>Take an Oracle 10g class now, and we'll give you the exam FREE. 
>http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
>_______________________________________________
>Matplotlib-users mailing list
>Mat...@li...
>https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
>
From: Al S. <a.d...@wo...> - 2004年05月03日 21:53:49
On Mon, 2004年05月03日 at 17:17, John Hunter wrote:
> Perry Greenfield has spent a fair amount of time talking with me and
> the folks working at stsci on matplotlib to come up with a set of
> goals and priorities for near term development, and has thoroughly
> revamped the goals page
> 
> http://matplotlib.sourceforge.net/goals.html
> 
> We hope that this page will stay much more current than the last page,
> which grew fairly static as most of the goals at the time the page was
> created were fulfilled.
> 
> Take a look over the list and speak up for anything we may have
> overlooked. 
> 
> JDH
Just so it doesn't slip through the cracks, please add support for
multi-line text (embedded '\n's) especially in ticklabels to the near
term goals.
Thanks.
	-Al Schapira
From: John H. <jdh...@ac...> - 2004年05月03日 21:39:53
Perry Greenfield has spent a fair amount of time talking with me and
the folks working at stsci on matplotlib to come up with a set of
goals and priorities for near term development, and has thoroughly
revamped the goals page
 http://matplotlib.sourceforge.net/goals.html
We hope that this page will stay much more current than the last page,
which grew fairly static as most of the goals at the time the page was
created were fulfilled.
Take a look over the list and speak up for anything we may have
overlooked. 
JDH
From: John H. <jdh...@ac...> - 2004年05月03日 21:14:50
>>>>> "John" == John Hunter <jdh...@ac...> writes:
 John> The example is included below. I'll add it to the examples
 John> dir for people who want to work directly with the Agg canvas
 John> and renderer.
oops, left out a critical line - adding the axes to the figure.
Here is a modified example, which also demonstrates initializing a
Numeric array from the string and passing the image off to PIL....
"""
This is an example that shows you how to work directly with the agg
figure canvas to create a figure using the pythonic API.
In this example, the contents of the agg canvas are extracted to a
string, which can in turn be passed off to PIL or put in a numeric
array
"""
#!/usr/bin/env python
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
from matplotlib.axes import Subplot
from matplotlib.mlab import normpdf
from matplotlib.numerix import randn
fig = Figure(figsize=(5,4), dpi=100)
ax = Subplot(fig, 111)
fig.add_axis(ax)
canvas = FigureCanvasAgg(fig)
mu, sigma = 100, 15
x = mu + sigma*randn(10000)
# the histogram of the data
n, bins, patches = ax.hist(x, 50, normed=1)
# add a 'best fit' line
y = normpdf( bins, mu, sigma)
line, = ax.plot(bins, y, 'r--')
line.set_linewidth(1)
ax.set_xlabel('Smarts')
ax.set_ylabel('Probability')
ax.set_title(r'$\rm{Histogram of IQ: }\mu=100, \sigma=15$')
ax.set_xlim( (40, 160))
ax.set_ylim( (0, 0.03))
canvas.draw()
s = canvas.tostring_rgb() # save this and convert to bitmap as needed
# get the figure dimensions for creating bitmaps or numeric arrays,
# etc.
l,b,w,h = fig.bbox.get_bounds()
w, h = int(w), int(h)
if 0:
 # convert to a Numeric array
 X = fromstring(s, UInt8)
 X.shape = h, w, 3
if 0:
 # pass off to PIL
 import Image
 im = Image.fromstring( "RGB", (w,h), s)
 im.show()
From: John H. <jdh...@ac...> - 2004年05月03日 20:44:09
>>>>> "Engelsma," == Engelsma, Dave <D.E...@La...> writes:
 Dave> Hello -- I'm having a dickens of a time getting this to
 Dave> work...
I totally understand. A more extensive users guide is sorely needed.
There is just so much to do on the development front that I haven't
made time for it.
 Dave> I believe I understand what you mean about maintaining
 Dave> a list of FigureCanvasAggs and using string & bitmap
 Dave> methods to get the figures into my wxDialog.
 Dave> Where I'm stuck is in plotting a histogram to a
 Dave> FigureCanvasAgg... I've checked out your examples, but
 Dave> there doesn't appear to be anything that directly uses
 Dave> FigureCanvasAgg. I've tried many different ways (mostly
 Dave> based on the embedded_in_wx.py and histogram_demo.py
 Dave> examples).
 Dave> Based on the example "histogram_demo.py" could you
 Dave> please give some pointers as to how to plot the
 Dave> histogram to a FigureCanvasAgg? I think I can handle
 Dave> things after that...
The example is included below. I'll add it to the examples dir for
people who want to work directly with the Agg canvas and renderer.
Let me know if you need some more help. Note that after you get the
RGB string from Agg, you may want to destroy the figure and canvas if
the figure is static to conserve memory. 
As repayment, if you have a nice screenshot showing your application
in action, with the list box and figures etc, that I can include on
the screenshots page, send it my way.
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
from matplotlib.axes import Subplot
from matplotlib.mlab import normpdf
from matplotlib.numerix import randn
fig = Figure(figsize=(5,4), dpi=100)
ax = Subplot(fig, 111)
canvas = FigureCanvasAgg(fig)
mu, sigma = 100, 15
x = mu + sigma*randn(10000)
# the histogram of the data
n, bins, patches = ax.hist(x, 50, normed=1)
# add a 'best fit' line
y = normpdf( bins, mu, sigma)
line, = ax.plot(bins, y, 'r--')
line.set_linewidth(1)
ax.set_xlabel('Smarts')
ax.set_ylabel('Probability')
ax.set_title(r'$\rm{Histogram of IQ: }\mu=100, \sigma=15$')
ax.set_xlim( (40, 160))
ax.set_ylim( (0, 0.03))
canvas.draw()
s = canvas.tostring_rgb() # save this and convert to bitmap as needed
From: Engelsma, D. <D.E...@La...> - 2004年05月03日 20:15:58
Hello --
I'm having a dickens of a time getting this to work...
I believe I understand what you mean about maintaining a list of
FigureCanvasAggs and using string & bitmap methods to get the figures into
my wxDialog.
Where I'm stuck is in plotting a histogram to a FigureCanvasAgg... I've
checked out your examples, but there doesn't appear to be anything that
directly uses FigureCanvasAgg. I've tried many different ways (mostly based
on the embedded_in_wx.py and histogram_demo.py examples).
Based on the example "histogram_demo.py" could you please give some pointers
as to how to plot the histogram to a FigureCanvasAgg? I think I can handle
things after that...
Thanks for your assistance!
Dave Engelsma
Lacks Wheel Trim Systems
> -----Original Message-----
> From: John Hunter [mailto:jdh...@ac...]
> Sent: Saturday, April 24, 2004 9:53 AM
> To: Engelsma, Dave
> Cc: mat...@li...
> Subject: Re: [Matplotlib-users] wxList and FigureCanvasWx
> 
> >>>>> "Engelsma," == Engelsma, Dave <D.E...@La...> writes:
> 
> Dave> Hello - I''ve got a wxDialog where, among other
> Dave> controls, I have a wxList and a
> Dave> FigureCanvasWx. Depending on what single item is
> Dave> selected in the wxList, the FigureCanvasWx should show
> Dave> the appropriate graph. It's important that the
> Dave> matplotlib-generated graph stay in the dialog along
> Dave> with the other controls (I don't want to generate a
> Dave> separate frame for the graph).
> 
> I'm not a wx guru, so this may not be the best way, but it I think it
> is a pretty good way. Instead of putting a FigureCanvasWX in your,
> use a wxPanel instead. Maintain a list of FigureCanvasAgg and use
> them to draw your figures. Transfer these to the wxPanel using string
> and bitmap methods. This is effectively what wxagg does. The main
> difference is that you will have one canvas and a list of
> FigureCanvasAggs.
> 
> You can get the width and height of the figure you need to draw with
> 
> 
> 
> Suppose agg below is an FigureCanvasAgg instance
> 
> agg.draw()
> s = agg.tostring_rgb()
> l,b,w,h = agg.figure.get_window_extent().get_bounds()
> image = wxEmptyImage( w,h )
> image.SetData(s)
> bitmap = image.ConvertToBitmap()
> 
> You can then transfer the bitmap to the wxpanel. If you want to do
> all the 'draw' calls upfront so you don't have to repeatedly draw if
> the user selects one figure, then another, then the original, that
> will be fine.
> 
> Agg is a pretty fast renderer, which may more than make up for the
> performance hit of having to go through the string->bitmap->canvas.
> 
> Let me know how it goes.
> 
> JDH
From: John H. <jdh...@ac...> - 2004年05月03日 16:49:04
>>>>> "Flavio" == Flavio Codeco Coelho <fcc...@fi...> writes:
 Flavio> cannot import name FigureManager
Right, I was just winging it off the top of my head, as I am now :-).
Remember you have the src code which is the ultimate reference so
when I say something stupid you can always get the real names by
looking at backend_wx.py and backend_wxagg.py. FYI, they are
identical except backend_wxagg subclasses FigureFrameWx and
FigureCanvasWx to make the agg variants.
How about something like
from matplotlib.backends_wx import FigureManagerWx as FigureManager
from matplotlib.backends_wx import NavigationToolbarWx as NavigationToolbar
from matplotlib.backends_wxagg import FigureCanvasWxAgg as FigureCanvas
I *think* that should do it.
 Flavio> Well, Here I was misled by the example embedded_in_wx,
 Flavio> which has that line.:-/ Should I just delete the darn
 Flavio> line?:)
I think you should keep it. I am not sure what you are doing in all
your code (ie, whether you use the matlab interface). Since we know
it could do harm to remove it and can't do harm to keep it, I say keep
it.
 Flavio> well maybe in CVS it works but in 0.53.1 I can' t import
 Flavio> FigureManager from backend_wxagg.:~(
See above
 Flavio> Should I not import FigureCanvasWxAgg instead of
 Flavio> FigureCanvasWx?
Yep...
Good luck!
JDH
From: Darren D. <dd...@co...> - 2004年05月03日 16:19:05
> > * make sure no conflicting gui is loaded in sys.modules. If another
> > is, go with that (issue a warning)
> >
> > * if no other is loaded, try and load the required GUI lib in a
> > try/except block. If the load fails, look for an alternative and
> > use that instead (issue a warning)
John, you are right, too much behind the scenes work is not justified, but 
the uninitiated user should have as easy an "entry" as is reasonable. So 
this seems like a good solution. If a shell wont play nice with the 
backend, a warning stating as much is better than a frozen window. 
From: John H. <jdh...@ac...> - 2004年05月03日 14:37:40
>>>>> "Flavio" == Flavio Codeco Coelho <fcc...@fi...> writes:
 Flavio> from matplotlib.backends.backend_wx import Toolbar,
 Flavio> FigureCanvasWx, FigureManager
 Flavio> do you think this can be the problem? If So How should I
 Flavio> change it to make it right?
Oh... so now you tell me :-) ! 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: Perry G. <pe...@st...> - 2004年05月03日 14:10:06
John Hunter writes:
> >>>>> "Perry" == Perry Greenfield <pe...@st...> writes:
> 
> Perry> One more thought along this line. Perhaps it's possible for
> Perry> matplotlib to inspect whether or not any of the supported
> Perry> gui's has already been imported and make that the
> Perry> default. It seems like a sensible rule to me. If none are
> Perry> found, then all the other mechanisms apply.
> 
> I've given a little thought to this and it is certainly possible. In
> the backend selection code we can detect the case when the backend has
> not been *explicity* set by either -d or matplotlib.use. In the case
> that we are using the default from matplotlib rc, and the default is a
> GUI, we could do two things to help prevent mistakes
> 
> * make sure no conflicting gui is loaded in sys.modules. If another
> is, go with that (issue a warning)
> 
> * if no other is loaded, try and load the required GUI lib in a
> try/except block. If the load fails, look for an alternative and
> use that instead (issue a warning)
> 
> I don't see a major problem with this approach. I want to avoid the
> microsoft approach of doing too much behind the scenes to try and
> accommodate the careless user, since this often runs afoul of the
> power user, and often leads to situations that are difficult to debug.
> I think if we issue warnings we can at least make clear what is
> happening which should satisfy both potential problems.
> 
> Any forseeable problems with this approach?
> 
It sounds like a good thing to try. As time goes on, perhaps
ways of making different gui's coexist may be found and implemented.
But that may take some time even if possible. This proposal
seems the best short term solution.
Perry
From: John H. <jdh...@ac...> - 2004年05月03日 11:27:01
>>>>> "Sajec," == Sajec, Mike TQO <ms...@tq...> writes:
 Sajec,> Hello, I recently installed version 0.53.1, and it's
 Sajec,> great! The only problem is that I'm unable to save plots
 Sajec,> to file. I've tried a few different approaches (from
 Sajec,> displayed WXAgg, and GTK plots as well as running
 Sajec,> savefig() on undisplayed figures (png & jpg), but have had
 Sajec,> no luck. Any help is much appreciated.
This is something I haven't seen before. 
What platform are you on: windows, linux, os x?
I recommend the following
 * make sure your hard drive isn't full 
 * open up a shell and change into a directory you have write
 permission to and make sure you can write a file to that dir
 * create the following test script
from matplotlib.matlab import *
plot([1,2,3])
savefig('testfig')
 * run this from the shell with
python testscript.py -dAgg
 * see if the file testfig.png is created
 * if so, figure out what is different about what you are doing and
 what the test script is doing
 * if not, did you get any error messages to the screen?
JDH
From: Sajec, M. T. <ms...@tq...> - 2004年05月03日 03:58:48
Hello,
I recently installed version 0.53.1, and it's great! The only problem is
that I'm unable to save plots to file. I've tried a few different
approaches (from displayed WXAgg, and GTK plots as well as running savefig()
on undisplayed figures (png & jpg), but have had no luck. Any help is much
appreciated.
Thanks,
Mike
From: John H. <jdh...@ac...> - 2004年05月03日 02:26:48
Please add this print line
 for i in range(len(eqlist)):
 print eqlist[i]
 a.text(1,9-i,eqlist[i], fontsize=15)
and the post the results.
Also, as a test, if you write a mathtext string like
xlabel('$\\alpha$)
does it work? Ie, does using the slash slash manually rather than the
raw string do you have any troubles? Can't see why you would...
JDH
2 messages has been excluded from this view by a project administrator.

Showing 13 results of 13

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 によって変換されたページ (->オリジナル) /