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

Showing results of 30

1 2 > >> (Page 1 of 2)
From: David G. <d_l...@ya...> - 2008年10月06日 23:41:40
The "solution" which worked well for me was to bite the bullet and switch to PIL for my image generating/processing needs. FWIW,
DG
--- On Mon, 10/6/08, Eric Firing <ef...@ha...> wrote:
> From: Eric Firing <ef...@ha...>
> Subject: Re: [Matplotlib-users] canvas.print_figure printing a variable amount of my figure
> To: "Christopher Barker" <Chr...@no...>
> Cc: "David Goldsmith" <d_l...@ya...>, mat...@li...
> Date: Monday, October 6, 2008, 11:56 AM
> Christopher Barker wrote:
> > David Goldsmith wrote:
> >> I feel like I must be missing something
> > 
> > yup -- though it's an understandable miss...
> 
> I think the longstanding separation between the figure.dpi
> and the 
> savefig.dpi is a continual gotcha that we can and should
> eliminate. 
> Savefig should use the figure dpi, so that what is saved
> corresponds to 
> what is on the screen, unless explicitly overridden. One
> way to reduce 
> the problem, with what I hope is an adequate level of
> backwards 
> compatibility, would be to have the savefig.dpi default to
> a special 
> flag setting that means "track the figure.dpi". 
> For example, 
> savefig.dpi could be the string, 'screen', by
> default. This could still 
> be overridden by a numerical rcParams setting, or by the
> explicit dpi 
> kwarg setting in savefig() or print_figure().
> 
> There are still other highly confusing dpi things
> internally--such as a 
> renderer.dpi setting that is ignored during rendering.
> 
> Comments?
> 
> Eric
> 
> > 
> > 
> >> Attached are the results on my computer (see usage
> details below).
> >> Granted, I'm increasing the resolution each
> iteration,
> > 
> > you are increasing the resolution of the figure, and
> of your 
> > calculations, but NOT of the output image. The hint
> was that every image 
> > was the same size: 1200X900 , which is
> 12"x9" at 100 dpi.
> > 
> > It turns out that print_figure() doesn't respect
> the figures (native 
> > DPI), it defaults to 100 dpi, but you can override it:
> > 
> > >
> canvas.print_figure("test"+str(DPI)+"dpi.png",
> dpi=DPI)
> > 
> > Then you'll get what I think you want.
> > 
> > Maybe this will help:
> > 
> >
> http://www.scipy.org/Cookbook/Matplotlib/AdjustingImageSize
> > 
> > though it there, I talked about Figure.savefig(). I
> don't know if there 
> > is a difference between that and Figure.print_figure()
> > 
> > -Chris
> > 
> >
 
From: Christopher B. <Chr...@no...> - 2008年10月06日 20:00:43
Eric Firing wrote:
> I think the longstanding separation between the figure.dpi and the 
> savefig.dpi is a continual gotcha that we can and should eliminate. 
+1
I've never understood the separation -- why wouldn't it default to the 
figure.dpi -- it could always be overridden by the keyword arg anyway.
> One way to reduce 
> the problem, with what I hope is an adequate level of backwards 
> compatibility, would be to have the savefig.dpi default to a special 
> flag setting that means "track the figure.dpi". For example, 
> savefig.dpi could be the string, 'screen', by default.
the thing is, this problem occurs even if there is no screen -- i.e. 
with just the Agg back-en, maybe "figure" or "preserve" or something?
 > This could still
> be overridden by a numerical rcParams setting, or by the explicit dpi 
> kwarg setting in savefig() or print_figure().
well, either the default behavior is changed, or it's not. Are you 
proposing that the default rcParams setting be "screen" (or whatever), 
in which case it could be returned to the old behavior (set to 100?) 
with a change, if the user so chooses?
If so, I think I'd not bother. if the default change,s let folks learn 
to add a dpi keyword arg in their code.
If you were thinking that the default rcParam would be the current 
behavior, then I'm not sure we're removing the "gotcha".
I suppose another option would be to make the dpi argument non-optional 
-- then everyone would KNOW that needed to specify the dpi. Ugly, but no 
ones code would break without them knowing it broke.
Does MPL have a deprecation warning policy?
> There are still other highly confusing dpi things internally--such as a 
> renderer.dpi setting that is ignored during rendering.
I'm not familiar with this one, but I think it does make sense to 
address these all at once.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: John H. <jd...@gm...> - 2008年10月06日 19:19:36
On Mon, Oct 6, 2008 at 1:40 PM, Eric Firing <ef...@ha...> wrote:
> Jon Froehlich wrote:
>> Hi Eric,
>>
>> Thanks for the response. I am just calling show() within pylab and a GUI
>> automatically pops-up. A screenshot is attached. It looks like the
>> underlying GUI is TK? I am on Vista (unfortunately).
>
>
> The problem is TK-specific, not Vista-specific. I can reproduce it with
> svn mpl on ubuntu hardy if I start with
> import matplotlib
> matplotlib.use('tkagg')
>
> I have never looked into the tkagg backend; I hope there is a tk guru
> waiting in the wings to track this down and fix it.
>
It looks like noone ever added support for it in tkagg -- I think all
that needs to be done is add
 self.resize_event()
to FigureCanvasTkAgg.resize. I just committed these changes to svn
r6159 -- it appears to work for the test case Jon posted...
JDH
From: Ryan M. <rm...@gm...> - 2008年10月06日 19:17:28
Eric Firing wrote:
> Christopher Barker wrote:
>> David Goldsmith wrote:
>>> I feel like I must be missing something
>> yup -- though it's an understandable miss...
> 
> I think the longstanding separation between the figure.dpi and the 
> savefig.dpi is a continual gotcha that we can and should eliminate. 
> Savefig should use the figure dpi, so that what is saved corresponds to 
> what is on the screen, unless explicitly overridden. One way to reduce 
> the problem, with what I hope is an adequate level of backwards 
> compatibility, would be to have the savefig.dpi default to a special 
> flag setting that means "track the figure.dpi". For example, 
> savefig.dpi could be the string, 'screen', by default. This could still 
> be overridden by a numerical rcParams setting, or by the explicit dpi 
> kwarg setting in savefig() or print_figure().
> 
> There are still other highly confusing dpi things internally--such as a 
> renderer.dpi setting that is ignored during rendering.
> 
> Comments?
+1 On your suggestion. I agree this is confusing at times.
Unfortunately, I don't have any time to offer for code at this time.
(Hopefully more time for MPL soon!)
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Jeff W. <js...@fa...> - 2008年10月06日 19:06:34
Mathew Yeates wrote:
> I found example I wish to build on. It's embedding_in_gtk2.py under 
> mpl_examples/user_interfaces. I'll put a menu at the top. But how can 
> I add a Basemap instead of a Figure?
>
> Mathew
Mathew: A basemap plot is just like any other matplotlib plot, it's 
associated with a figure instance and an axes instance.
-Jeff
>
>
> Jeff Whitaker wrote:
>> Mathew Yeates wrote:
>>> Hi
>>> How easy is it to customize the Basemap class? I seem to remember an 
>>> example where something is added to the toolbar but I can't remember 
>>> which example it was. What if I want to add a menu at the top of the 
>>> window?
>>>
>>> Mathew
>>>
>>> 
>>
>> Mathew:
>>
>>
>> Basemap doesn't handle any GUI stuff - this is all done by matplotlib 
>> proper. So, you'll need to look at the matplotlib docs to see how to 
>> customize the toolbar.
>>
>> -Jeff
>>
>
>
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Eric F. <ef...@ha...> - 2008年10月06日 19:01:55
Jon Froehlich wrote:
> Back in March, 2007, a user asked about getting the resize_even to work. 
> No one responded to his question. I have the same problem. I tried 
> hooking up a method that I hoped would be called every time the graph 
> was resized (using the UI that is displayed by a show() call).
> 
> connect('resize_event', plotutils.recalculateTimeSeriesXLabels)
> 
> However, my method is never called, even when I maximize the window.
> 
> Here is his email as well:
> 
> Trying to get resize event to work, but either I don't understand the 
> definition of when resize_event should work, or it's broken.
> 
> for example
> =======================
> from matplotlib import pylab , numerix
> 
> def GotResizeEvent( event ):
> print 'Resize event detected'
> 
> def GotDrawEvent( event ):
> print 'Draw event detected'
> 
> X = range(0, 200)
> Y = pylab.sin(X)
> 
> r = pylab.plot(X,Y)
> pylab.connect( 'resize_event', GotResizeEvent)
> pylab.connect( 'draw_event', GotDrawEvent)
> pylab.show()
> =========================
> Will only get draw_events as I zoom in on the data, never a resize event?
> I also get draw_events as I resize the window itself, but never a 
> resize_event.
> 
> So my question, .. what user activity triggers a resize event?
This sounds like a problem with a specific backend. It works for me 
(i.e., I get resize events when resizing the window) with mpl from svn, 
linux, gtkagg backend.
What are you using?
Eric
> 
> 
From: Eric F. <ef...@ha...> - 2008年10月06日 19:00:54
Christopher Barker wrote:
> David Goldsmith wrote:
>> I feel like I must be missing something
> 
> yup -- though it's an understandable miss...
I think the longstanding separation between the figure.dpi and the 
savefig.dpi is a continual gotcha that we can and should eliminate. 
Savefig should use the figure dpi, so that what is saved corresponds to 
what is on the screen, unless explicitly overridden. One way to reduce 
the problem, with what I hope is an adequate level of backwards 
compatibility, would be to have the savefig.dpi default to a special 
flag setting that means "track the figure.dpi". For example, 
savefig.dpi could be the string, 'screen', by default. This could still 
be overridden by a numerical rcParams setting, or by the explicit dpi 
kwarg setting in savefig() or print_figure().
There are still other highly confusing dpi things internally--such as a 
renderer.dpi setting that is ignored during rendering.
Comments?
Eric
> 
> 
>> Attached are the results on my computer (see usage details below).
>> Granted, I'm increasing the resolution each iteration,
> 
> you are increasing the resolution of the figure, and of your 
> calculations, but NOT of the output image. The hint was that every image 
> was the same size: 1200X900 , which is 12"x9" at 100 dpi.
> 
> It turns out that print_figure() doesn't respect the figures (native 
> DPI), it defaults to 100 dpi, but you can override it:
> 
> > canvas.print_figure("test"+str(DPI)+"dpi.png", dpi=DPI)
> 
> Then you'll get what I think you want.
> 
> Maybe this will help:
> 
> http://www.scipy.org/Cookbook/Matplotlib/AdjustingImageSize
> 
> though it there, I talked about Figure.savefig(). I don't know if there 
> is a difference between that and Figure.print_figure()
> 
> -Chris
> 
> 
From: Andrew S. <str...@as...> - 2008年10月06日 18:43:18
Dear Mathew, most of the basemap methods take an "ax=" keyword
(drawparallels, drawmeridians, drawmapboundary and so on). Furthermore,
you can transform your lat/long coordinates to projected coordinates
with the __call__ method and then simply plot those directly. You can
thus plot basemaps on any Axes instance. For an example of all this, I
can point you to my script
make_buchner_interommatidial_distance_figure.py in the most recent
release of http://code.astraw.com/drosophila_eye_map/ . There may be
good examples distributed with basemap, too -- I can't remember.
Hope that helps,
-Andrew
Mathew Yeates wrote:
> I found example I wish to build on. It's embedding_in_gtk2.py under 
> mpl_examples/user_interfaces. I'll put a menu at the top. But how can I 
> add a Basemap instead of a Figure?
> 
> Mathew
> 
> 
> Jeff Whitaker wrote:
>> Mathew Yeates wrote:
>>> Hi
>>> How easy is it to customize the Basemap class? I seem to remember an 
>>> example where something is added to the toolbar but I can't remember 
>>> which example it was. What if I want to add a menu at the top of the 
>>> window?
>>>
>>> Mathew
>>>
>>> 
>> Mathew:
>>
>>
>> Basemap doesn't handle any GUI stuff - this is all done by matplotlib 
>> proper. So, you'll need to look at the matplotlib docs to see how to 
>> customize the toolbar.
>>
>> -Jeff
>>
> 
> 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Eric F. <ef...@ha...> - 2008年10月06日 18:41:52
Jon Froehlich wrote:
> Hi Eric,
> 
> Thanks for the response. I am just calling show() within pylab and a GUI 
> automatically pops-up. A screenshot is attached. It looks like the 
> underlying GUI is TK? I am on Vista (unfortunately).
The problem is TK-specific, not Vista-specific. I can reproduce it with 
svn mpl on ubuntu hardy if I start with
import matplotlib
matplotlib.use('tkagg')
I have never looked into the tkagg backend; I hope there is a tk guru 
waiting in the wings to track this down and fix it.
Eric
> 
> 
> 
> Jon
> 
> Eric Firing wrote:
>> Jon Froehlich wrote:
>>> Back in March, 2007, a user asked about getting the resize_even to 
>>> work. No one responded to his question. I have the same problem. I 
>>> tried hooking up a method that I hoped would be called every time the 
>>> graph was resized (using the UI that is displayed by a show() call).
>>>
>>> connect('resize_event', plotutils.recalculateTimeSeriesXLabels)
>>>
>>> However, my method is never called, even when I maximize the window.
>>>
>>> Here is his email as well:
>>>
>>> Trying to get resize event to work, but either I don't understand the 
>>> definition of when resize_event should work, or it's broken.
>>>
>>> for example
>>> =======================
>>> from matplotlib import pylab , numerix
>>>
>>> def GotResizeEvent( event ):
>>> print 'Resize event detected'
>>>
>>> def GotDrawEvent( event ):
>>> print 'Draw event detected'
>>>
>>> X = range(0, 200)
>>> Y = pylab.sin(X)
>>>
>>> r = pylab.plot(X,Y)
>>> pylab.connect( 'resize_event', GotResizeEvent)
>>> pylab.connect( 'draw_event', GotDrawEvent)
>>> pylab.show()
>>> =========================
>>> Will only get draw_events as I zoom in on the data, never a resize 
>>> event?
>>> I also get draw_events as I resize the window itself, but never a 
>>> resize_event.
>>>
>>> So my question, .. what user activity triggers a resize event?
>>
>> This sounds like a problem with a specific backend. It works for me 
>> (i.e., I get resize events when resizing the window) with mpl from 
>> svn, linux, gtkagg backend.
>>
>> What are you using?
>>
>> Eric
>>>
>>>
>>
> 
> -- 
> Jon Froehlich
> PhD Student
> Computer Science and Engineering
> University of Washington
> http://www.cs.washington.edu/homes/jfroehli
> 
From: Mathew Y. <my...@jp...> - 2008年10月06日 18:34:22
Thanks for the help!!
Jeff Whitaker wrote:
> Mathew Yeates wrote:
>> I found example I wish to build on. It's embedding_in_gtk2.py under 
>> mpl_examples/user_interfaces. I'll put a menu at the top. But how can 
>> I add a Basemap instead of a Figure?
>>
>> Mathew
>
> Mathew: A basemap plot is just like any other matplotlib plot, it's 
> associated with a figure instance and an axes instance.
>
> -Jeff
>>
>>
>> Jeff Whitaker wrote:
>>> Mathew Yeates wrote:
>>>> Hi
>>>> How easy is it to customize the Basemap class? I seem to remember 
>>>> an example where something is added to the toolbar but I can't 
>>>> remember which example it was. What if I want to add a menu at the 
>>>> top of the window?
>>>>
>>>> Mathew
>>>>
>>>> 
>>>
>>> Mathew:
>>>
>>>
>>> Basemap doesn't handle any GUI stuff - this is all done by 
>>> matplotlib proper. So, you'll need to look at the matplotlib docs 
>>> to see how to customize the toolbar.
>>>
>>> -Jeff
>>>
>>
>>
>
>
From: Jon F. <jfr...@cs...> - 2008年10月06日 18:27:10
Attachments: moz-screenshot-4.jpg
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Eric,<br>
<br>
Thanks for the response. I am just calling show() within pylab and a
GUI automatically pops-up. A screenshot is attached. It looks like the
underlying GUI is TK? I am on Vista (unfortunately).<br>
<br>
<img src="cid:par...@cs..." alt=""><br>
<br>
Jon<br>
<br>
Eric Firing wrote:
<blockquote cite="mid:48E...@ha..." type="cite">Jon
Froehlich wrote:
 <br>
 <blockquote type="cite">Back in March, 2007, a user asked about
getting the resize_even to work. No one responded to his question. I
have the same problem. I tried hooking up a method that I hoped would
be called every time the graph was resized (using the UI that is
displayed by a show() call).
 <br>
 <br>
connect('resize_event', plotutils.recalculateTimeSeriesXLabels)
 <br>
 <br>
However, my method is never called, even when I maximize the window.
 <br>
 <br>
Here is his email as well:
 <br>
 <br>
Trying to get resize event to work, but either I don't understand the
definition of when resize_event should work, or&nbsp; it's broken.
 <br>
 <br>
for example
 <br>
=======================
 <br>
from matplotlib import pylab , numerix
 <br>
 <br>
def GotResizeEvent( event ):
 <br>
&nbsp;&nbsp;&nbsp; print 'Resize event detected'
 <br>
 <br>
def GotDrawEvent( event ):
 <br>
&nbsp;&nbsp;&nbsp; print 'Draw event detected'
 <br>
 <br>
X = range(0, 200)
 <br>
Y = pylab.sin(X)
 <br>
 <br>
r = pylab.plot(X,Y)
 <br>
pylab.connect( 'resize_event', GotResizeEvent)
 <br>
pylab.connect( 'draw_event', GotDrawEvent)
 <br>
pylab.show()
 <br>
=========================
 <br>
Will only get draw_events as I zoom in on the data, never a resize
event?
 <br>
I also get draw_events as I resize the window itself, but never a
resize_event.
 <br>
 <br>
So my question, .. what user activity triggers a resize event?
 <br>
 </blockquote>
 <br>
This sounds like a problem with a specific backend.&nbsp; It works for me
(i.e., I get resize events when resizing the window) with mpl from svn,
linux, gtkagg backend.
 <br>
 <br>
What are you using?
 <br>
 <br>
Eric
 <br>
 <blockquote type="cite"><br>
 <br>
 </blockquote>
 <br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
Jon Froehlich
PhD Student
Computer Science and Engineering
University of Washington
<a class="moz-txt-link-freetext" href="http://www.cs.washington.edu/homes/jfroehli">http://www.cs.washington.edu/homes/jfroehli</a></pre>
</body>
</html>
From: Christopher B. <Chr...@no...> - 2008年10月06日 18:16:50
David Goldsmith wrote:
> I feel like I must be missing something
yup -- though it's an understandable miss...
> Attached are the results on my computer (see usage details below).
> Granted, I'm increasing the resolution each iteration,
you are increasing the resolution of the figure, and of your 
calculations, but NOT of the output image. The hint was that every image 
was the same size: 1200X900 , which is 12"x9" at 100 dpi.
It turns out that print_figure() doesn't respect the figures (native 
DPI), it defaults to 100 dpi, but you can override it:
 > canvas.print_figure("test"+str(DPI)+"dpi.png", dpi=DPI)
Then you'll get what I think you want.
Maybe this will help:
http://www.scipy.org/Cookbook/Matplotlib/AdjustingImageSize
though it there, I talked about Figure.savefig(). I don't know if there 
is a difference between that and Figure.print_figure()
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: John H. <jd...@gm...> - 2008年10月06日 16:53:49
On Mon, Oct 6, 2008 at 11:23 AM, Jeff Whitaker <js...@fa...> wrote:
> Basemap doesn't handle any GUI stuff - this is all done by matplotlib
> proper. So, you'll need to look at the matplotlib docs to see how to
> customize the toolbar.
Mathew,
To do stuff like adding menus and customizing the toolbar, you need to
embed mpl in the GUI of your choice. A good starting point are the
examples in http://matplotlib.sf.net/examples/user_interfaces
JDH
From: Mathew Y. <my...@jp...> - 2008年10月06日 16:43:06
I found example I wish to build on. It's embedding_in_gtk2.py under 
mpl_examples/user_interfaces. I'll put a menu at the top. But how can I 
add a Basemap instead of a Figure?
Mathew
Jeff Whitaker wrote:
> Mathew Yeates wrote:
>> Hi
>> How easy is it to customize the Basemap class? I seem to remember an 
>> example where something is added to the toolbar but I can't remember 
>> which example it was. What if I want to add a menu at the top of the 
>> window?
>>
>> Mathew
>>
>> 
>
> Mathew:
>
>
> Basemap doesn't handle any GUI stuff - this is all done by matplotlib 
> proper. So, you'll need to look at the matplotlib docs to see how to 
> customize the toolbar.
>
> -Jeff
>
From: Jeff W. <js...@fa...> - 2008年10月06日 16:23:52
Mathew Yeates wrote:
> Hi
> How easy is it to customize the Basemap class? I seem to remember an 
> example where something is added to the toolbar but I can't remember 
> which example it was. What if I want to add a menu at the top of the window?
>
> Mathew
>
> 
Mathew:
Basemap doesn't handle any GUI stuff - this is all done by matplotlib 
proper. So, you'll need to look at the matplotlib docs to see how to 
customize the toolbar.
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Mathew Y. <my...@jp...> - 2008年10月06日 16:16:31
Hi
How easy is it to customize the Basemap class? I seem to remember an 
example where something is added to the toolbar but I can't remember 
which example it was. What if I want to add a menu at the top of the window?
Mathew
From: Henry P. <hen...@en...> - 2008年10月06日 15:21:30
On Mon, 2008年10月06日 at 08:04 -0500, John Hunter wrote:
> On Mon, Oct 6, 2008 at 3:52 AM, Henry Proudhon <hen...@en...> wrote:
> > Hi everyone,
> >
> > I wonder if there is a simple way to apply a multiplication factor to
> > the ticks labels of an axis.
> >
> > say I'm plotting a 100 x 100 matrix with imshow and want the axis to
> > show (0 to 70) instead of (0 to 100), while still displaying the whole
> > matrix. In that case the coefficient would be 0.7.
> >
> > I had a look at the Formatter class but I cannot find a method to do
> > that, do I've to implement a custom formatter or I'm missing something
> > obvious here ?
> 
> Use the "extent" keyword argument to imshow to set the [xmin, xmax,
> ymin, ymax] extent of the image
> 
> JDH
Thanks a lot John, works great.
Henry
From: Gregor T. <gre...@gm...> - 2008年10月06日 14:47:05
jcarnes schrieb:
> I am writing a GUI application in wxPython and using MPL that plots figures,
> saves them to image files, and then closes them all from within a thread to
> keep the GUI responsive. Using the Enthought 2.3 install I would
> sporatically have crashes that were hard to reproduce, but now that I've
> upgrade to Enthought 2.5 (Python 2.5 and MPL 0.91.2.0001) it started
> throwing exceptions when attempting to close a figure that I don't
> understand. I've created an example script that excites the exception. I'm
> not sure if the syptoms are a combination of problems caused by my use of
> threads but this problem does not occur if threading is removed from the
> script. I've read of others experiencing memory leaks and such when closing
> figures, but no situations quite like this.
>
> I am working from a desktop in Windows XP and I use the WXAgg backend.
>
> Does anyone have any ideas, or any feedback on my use of threads? Thanks,
> Josh
> 
wxPython and multithreading don't go well together. Have a look at the 
wxWidgets docs about multithreading. Changes to the GUI (this includes 
closing a window) should only be done from the main thread.
Continously creating and destroying a figure window seems not necessary 
in your application. Create it once in the main thread ((have a look at 
the embedding_in_wx examples of matplotlib) and only clear/replot it in 
your thread. In my experience replotting from the main thread is fast 
enough, saving to a file takes more time, this is worth to be done in 
another thread.
Gregor
From: John H. <jd...@gm...> - 2008年10月06日 13:15:59
On Mon, Oct 6, 2008 at 3:52 AM, Henry Proudhon <hen...@en...> wrote:
> Hi everyone,
>
> I wonder if there is a simple way to apply a multiplication factor to
> the ticks labels of an axis.
>
> say I'm plotting a 100 x 100 matrix with imshow and want the axis to
> show (0 to 70) instead of (0 to 100), while still displaying the whole
> matrix. In that case the coefficient would be 0.7.
>
> I had a look at the Formatter class but I cannot find a method to do
> that, do I've to implement a custom formatter or I'm missing something
> obvious here ?
Use the "extent" keyword argument to imshow to set the [xmin, xmax,
ymin, ymax] extent of the image
JDH
From: John H. <jd...@gm...> - 2008年10月06日 13:09:03
On Mon, Oct 6, 2008 at 7:15 AM, Michael Droettboom <md...@st...> wrote:
> In 0.98 ellipse is drawn using bezier curves, which do not scale
> correctly in log-scaled plots.
>
> As an alternative, you can use a RegularPolygon with a high number of
> vertices (this is exactly what 0.91 did).
Here is some example code which compares the polygonal ellipse with
the spline version to get you started if you decide to go with the
polygonal appromximation Michal suggest:
import numpy as npy
from matplotlib import patches
from pylab import figure, show
xcenter, ycenter = 0.38, 0.52
#xcenter, ycenter = 0., 0.
width, height = 1e-1, 3e-1
angle = -30
theta = npy.arange(0.0, 360.0, 1.0)*npy.pi/180.0
x = width/2. * npy.cos(theta)
y = height/2. * npy.sin(theta)
rtheta = angle*npy.pi/180.
R = npy.array([
 [npy.cos(rtheta), -npy.sin(rtheta)],
 [npy.sin(rtheta), npy.cos(rtheta)],
 ])
x, y = npy.dot(R, npy.array([x, y]))
x += xcenter
y += ycenter
fig = figure()
ax = fig.add_subplot(211, aspect='auto')
ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow',
linewidth=1, zorder=1)
e1 = patches.Arc((xcenter, ycenter), width, height,
 angle=angle, linewidth=2, fill=False, zorder=2)
ax.add_patch(e1)
ax = fig.add_subplot(212, aspect='equal')
ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1)
e2 = patches.Arc((xcenter, ycenter), width, height,
 angle=angle, linewidth=2, fill=False, zorder=2)
ax.add_patch(e2)
#fig.savefig('ellipse_compare.png')
fig.savefig('ellipse_compare')
show()
From: Michael D. <md...@st...> - 2008年10月06日 12:23:03
imshow always assumes a regular rectangular grid of pixels. To plot 
image data on a non-rectilinear projection, you need to use pcolor or 
pcolormesh.
You may also want to look at the basemap toolkit, which provides much 
better support for geographic projections. The ones included in 
matplotlib are essentially "toy" examples to test the infrastructure, 
but aren't really intended for advanced usage.
Cheers,
Mike
dasratsel wrote:
> Hi,
>
> I've done some poking an I can't find a way to use imshow() to plot a
> luminosity map on a hammer projection. (looking to generate a plot like
> http://en.wikipedia.org/wiki/Image:WMAP_2008.png). Just setting the
> projection in a call to subplot gives some axes and an off-center retangular
> image of my array. Bearing in mind that I am completely new to matplotlib,
> does anyone have an idea of how to get this sort of plot?
>
> Thanks,
> Kris
>
> (PS. Apologies if this shows up in two places, I'm not used to using mailing
> lists)
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Jeff W. <js...@fa...> - 2008年10月06日 12:19:54
Eric Firing wrote:
> dasratsel wrote:
> 
>> Hi,
>>
>> I've done some poking an I can't find a way to use imshow() to plot a
>> luminosity map on a hammer projection. (looking to generate a plot like
>> http://en.wikipedia.org/wiki/Image:WMAP_2008.png). Just setting the
>> projection in a call to subplot gives some axes and an off-center retangular
>> image of my array. Bearing in mind that I am completely new to matplotlib,
>> does anyone have an idea of how to get this sort of plot?
>>
>> Thanks,
>> Kris
>>
>> (PS. Apologies if this shows up in two places, I'm not used to using mailing
>> lists)
>> 
>
> Kris,
>
> For any sort of mapping like this, you will probably want to use basemap 
> matplotlib toolkit, except that I don't see "hammer" among the supported 
> projections.
>
> With straight mpl, imshow does not support projections. You could use 
> pcolor (very slow) or pcolormesh. In neither case will you get 
> interpolation; you will be specifying colored quadrilaterals.
>
> Eric
>
>
> 
Kris: Basemap does not support the 'hammer' projection, but it does 
have mollweide, which is very similar. Something like this ought to do it:
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
# lon_0 is the center longitude of the data.
map = Basemap(projection='moll',lon_0=180)
# lons, lats are the longitudes and latitudes of the data
# lons.shape, lats.shape = data.shape
x, y = map(lons,lats)
# make a filled mesh plot.
im = map.pcolormesh(x,y,data,cmap=plt.cm.jet)
# draw a boundary around the map
map.drawmapboundary()
plt.show()
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328
From: Darren D. <dsd...@gm...> - 2008年10月06日 12:18:15
On Monday 29 September 2008 13:35:57 Buz Barstow wrote:
> Dear All,
>
> Does anyone know of a citation that I can use for Numpy?
>
> Thanks! and all the best,
I found the following link that discusses a few options, but you may want to 
ask on the numpy-discussion mailing list if there is a more up-to-date and 
preferred option:
http://www.mail-archive.com/num...@sc.../msg04303.html
From: Michael D. <md...@st...> - 2008年10月06日 12:17:11
In 0.98 ellipse is drawn using bezier curves, which do not scale 
correctly in log-scaled plots.
As an alternative, you can use a RegularPolygon with a high number of 
vertices (this is exactly what 0.91 did).
Mike
Yves Revaz wrote:
> Dear list,
>
> How is it possible to draw a nice ellipse in a log-log plot using 
> patches.Ellipse ?
> With matplotlib 0.91 I was able to to that using :
> Ellipse((log10(100),log10(100)), width=100, height=100,alpha=0.5)
>
> Now, it seems that something has changed in version 0.98 and I do not 
> need to ad the log10
> in Ellipse. However, instead of having a nice ellipse, I get a kind of 
> patatoïd ?
> See the example below.
> How can I fix it ?
>
> Thanks in advance,
>
> yves
>
>
>
>
>
> from numpy import *
> import pylab as pt
> from matplotlib.patches import Ellipse
>
>
> ax = pt.gca()
>
> e = Ellipse((100,100), width=100, height=100,alpha=0.5)
> ax.add_artist(e) 
>
> pt.semilogx()
> pt.semilogy()
>
> pt.axis([1,1e3,1,1e3])
>
> pt.show()
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Henry P. <hen...@en...> - 2008年10月06日 10:20:36
Hi everyone,
I wonder if there is a simple way to apply a multiplication factor to
the ticks labels of an axis.
say I'm plotting a 100 x 100 matrix with imshow and want the axis to
show (0 to 70) instead of (0 to 100), while still displaying the whole
matrix. In that case the coefficient would be 0.7.
I had a look at the Formatter class but I cannot find a method to do
that, do I've to implement a custom formatter or I'm missing something
obvious here ?
many thanks
Henry

Showing results of 30

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