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



Showing results of 432

1 2 3 .. 18 > >> (Page 1 of 18)
From: Christopher B. <c-...@as...> - 2008年12月31日 22:48:47
Hi Jae-Joon,
Your simpler suggestion of drawing the fig twice is just fine for my 
needs. Thank you.
JL> The exact location of the legend is known at drawing time. Thus, the
JL> location of the text needs to be calculated at the drawing. I may
JL> help you with this but it is quite tricky and you need some
JL> knowledge on internals of the mpl.
JL>
JL> Or, you may simply draw the figure twice (with same renderer), where
JL> the first one is just to calculate the location of the text.
JL> Here is an example.
JL>
JL> ------------------
JL> import matplotlib.pyplot as plt
JL> plt.plot([1, 3, 2], label="test2")
JL> l = plt.legend()
JL> plt.draw() # the location of the legend is now known
JL>
JL> ax = gca()
JL> bbox = l.legendPatch.get_bbox().inverse_transformed(ax.transAxes) #
JL> bbox in axes coordinate.
JL> x = bbox.x0+bbox.width/2. # center
JL>
JL> ax.text(x, 0, "test", va="bottom", ha="center",
JL> transform=ax.transAxes) plt.draw()
JL> ---------------------
JL>
JL> Note that if you want save the figure, you need to save it with a
JL> same dpi, or save the figure twice as above.
JL>
JL> -JJ
-- 
Christopher Brown, Ph.D.
Department of Speech and Hearing Science
Arizona State University
From: Eric F. <ef...@ha...> - 2008年12月31日 22:35:57
James Boyle wrote:
> As far as I can tell, you cannot specify the color that contourf uses 
> for masked values.
> The examples enclosed with matplotlib ( 0.98.3) specifically comment 
> that this is the case.
> It appears that contourf just does not plot anything where the masked 
> values occur and the background ( usually white ) is what is seen.
> This is very useful but ....
> 
> I would like to have a bit more choice in how the areas of masked 
> data are represented.
> I came up with the following hack which seems to work, but being far 
> from expert I wanted to know if anyone wished to help or give advice.
> Is this reasonable or what ?
Jim,
It strikes me as the right way to do what you want; it is not a kludge 
or a hack at all. Contourf generates patches for unmasked regions, not 
for the masked region, so it is indeed up to you to set the background 
as you have done.
I see that there is also an Axes.set_axis_bgcolor method, which I would 
expect to be preferred; but it is strangely named. Should it not be 
just Axes.set_bg or Axes.set_bgcolor? It corresponds to the axisbg 
kwarg in the Axes initializer, perhaps another unfortunate choice of 
names.
(Contourf has a longstanding bug in handling internal masked regions; I 
hope you don't run into it. Both Mike D and I have tried to figure out 
how to fix that bug, but so far without success.)
> 
> In the code below data is a masked array with some areas masked.
> The result is that the missing areas are now black rather than white 
> ( the default background, I guess)
> 
> fig = pylab.figure()
> ax = fig.add_subplot(111)
> ax.axesPatch.set_facecolor('k')
> cs = ax.contourf(data)
> pylab.savefig('example')
> 
> I am aware that pcolor , pcolormesh and using cm.set_bad will work 
> but I also wanted the option for contourf - it produces nice looking 
> plots.
I have not checked just now, but as I recall, pcolor acts like contourf 
with respect to masked regions--it plots nothing there, leaving the 
background showing through.
Eric
From: James B. <bo...@ll...> - 2008年12月31日 19:30:53
As far as I can tell, you cannot specify the color that contourf uses 
for masked values.
The examples enclosed with matplotlib ( 0.98.3) specifically comment 
that this is the case.
It appears that contourf just does not plot anything where the masked 
values occur and the background ( usually white ) is what is seen.
This is very useful but ....
I would like to have a bit more choice in how the areas of masked 
data are represented.
I came up with the following hack which seems to work, but being far 
from expert I wanted to know if anyone wished to help or give advice.
Is this reasonable or what ?
In the code below data is a masked array with some areas masked.
The result is that the missing areas are now black rather than white 
( the default background, I guess)
fig = pylab.figure()
ax = fig.add_subplot(111)
ax.axesPatch.set_facecolor('k')
cs = ax.contourf(data)
pylab.savefig('example')
I am aware that pcolor , pcolormesh and using cm.set_bad will work 
but I also wanted the option for contourf - it produces nice looking 
plots.
Thanks for any help.
--Jim
From: Rob F. <fr...@wa...> - 2008年12月31日 17:27:26
Thanks Jeff! That is just wonderful! No need for a non-spherical earth
model for me.
Again, thanks!
Rob
Jeff Whitaker wrote:
> 
> Rob Frohne wrote:
>> Hi Jeff,
>>
>> I am an amateur radio operator, and I am writing a little application to
>> display where the major lobe of my antenna is pointing. I can control
>> the
>> direction of my antenna with the computer, and it would be nice to have a
>> display of the whole world, as well as circles representing how far the
>> station I am talking to is, and radial lines showing the bearings. I'd
>> like
>> to show the bearings along the edge of the map. For this type of map, a
>> circle is a much better boundary than a square, but if it has to be a
>> square, we should be able to make it a square bounding the circle, not
>> the
>> other way around. I think I can even plot the station's location given
>> data
>> I get from the Internet using this software. I am just learning Python,
>> but
>> it appears to be ideal for what I'm doing. 
>>
>> Right now I'm trying to figure out how to get the Eclipse IDE I am trying
>> out to show me the source code for Basemap. :-)
>>
>> Thanks for the expert help!
>>
>> Rob
>> 
> 
> Rob: I've updated basemap in SVN so that if neither a width/height or 
> corner lat/lons are provided, the whole world is plotted in a circle 
> with projection='aeqd'. If you can access SVN please try it out and let 
> me know how it works for you. If not, I can provide you with a tarball.
> 
> The full-disk aeqd will not work right now with ellipsoids, only for 
> perfect spheres. Is that a problem for you?
> 
> -Jeff
>> Jeff Whitaker wrote:
>> 
>>> Rob Frohne wrote:
>>> 
>>>> Hi,
>>>>
>>>> I think I am running into the same thing John is here. When you want
>>>> to
>>>> display the whole earth in 'aeqd' mode, the projection needs to be onto
>>>> a
>>>> circle. As it is, what is plotted is a square that just fits inside
>>>> the
>>>> circle I want. Here is a link to a photo of the kind of projection I
>>>> want.
>>>>
>>>> http://www.wm7d.net/az_proj/images/lon_anim_shaded.gif
>>>>
>>>> Is there a way to get the whole earth plotted with 'aeqd'?
>>>> 
>>>> 
>>> Rob: No, you can't get the whole earth - the most you can get is the 
>>> cube that fits within it. I can look into adding that functionality for 
>>> the aeqd projection if there's a real use case. Note that there are 
>>> other whole-earth projections available (mollweide, vandergrinten, 
>>> robinson, sinuisoidal etc). These projections have much less distortion 
>>> far away from the center of the map than the azimuthal equidistant 
>>> does. Why do you want to use aeqd to plot the whole globe?
>>>
>>> -Jeff
>>> 
>>>> Thanks,
>>>>
>>>> Rob
>>>> 
>>>> 
>>> 
>>>> John [H2O] wrote:
>>>> 
>>>> 
>>>>> Hello, 
>>>>>
>>>>> I'm creating a web application that will take user input from a
>>>>> javascript
>>>>> map to give me bounding coordinates (i.e. urcrnrlat, urcrnrlon,
>>>>> llcrnrlat,
>>>>> llcrnrlon) and possibly a switch for polar projection. Other than that
>>>>> I
>>>>> have no further information. Which projection is the most suitable to
>>>>> handle anything from a 'global' plot to a zoom say over a state? I
>>>>> don't
>>>>> see the zoom being too tight, but global projections are likely. I
>>>>> personally prefer Equal Area, hence right now I'm working with 'aeqd',
>>>>> but
>>>>> I seem to have problems if the plot is global with that projection.
>>>>>
>>>>> Just looking for advice, opinions, and ideally examples if anyone has
>>>>> created a similar function / module to use in a web environment.
>>>>>
>>>>> Thanks!
>>>>> -john
>>>>>
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> -- 
>>> 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
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>> 
>>
>> 
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/dynamic-basemap-tp20121594p21234584.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jouni K. S. <jk...@ik...> - 2008年12月31日 15:28:05
Michael Droettboom <md...@st...>
writes:
> Passing solid_joinstyle='bevel' does resolve the problem on both 0.91.x 
> and 0.98.x. Additionally, path simplification (which is a new feature 
> on 0.98.x) also resolves this problem (set rcParam path.simplify to True).
It seems that agg and pdf have different ways to render small angles
when the join style is 'miter'. Pdf has a limit (settable in the pdf
file) beyond which it reverts to bevel-style angles, agg seems to always
do the miter join but cuts it off at some distance.
Here's a test script, and screenshots of (a part of) the agg and pdf
outputs when the join style is 'miter'.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Jeff W. <js...@fa...> - 2008年12月31日 14:49:57
Rob Frohne wrote:
> Hi Jeff,
>
> I am an amateur radio operator, and I am writing a little application to
> display where the major lobe of my antenna is pointing. I can control the
> direction of my antenna with the computer, and it would be nice to have a
> display of the whole world, as well as circles representing how far the
> station I am talking to is, and radial lines showing the bearings. I'd like
> to show the bearings along the edge of the map. For this type of map, a
> circle is a much better boundary than a square, but if it has to be a
> square, we should be able to make it a square bounding the circle, not the
> other way around. I think I can even plot the station's location given data
> I get from the Internet using this software. I am just learning Python, but
> it appears to be ideal for what I'm doing. 
>
> Right now I'm trying to figure out how to get the Eclipse IDE I am trying
> out to show me the source code for Basemap. :-)
>
> Thanks for the expert help!
>
> Rob
> 
Rob: I've updated basemap in SVN so that if neither a width/height or 
corner lat/lons are provided, the whole world is plotted in a circle 
with projection='aeqd'. If you can access SVN please try it out and let 
me know how it works for you. If not, I can provide you with a tarball.
The full-disk aeqd will not work right now with ellipsoids, only for 
perfect spheres. Is that a problem for you?
-Jeff
> Jeff Whitaker wrote:
> 
>> Rob Frohne wrote:
>> 
>>> Hi,
>>>
>>> I think I am running into the same thing John is here. When you want to
>>> display the whole earth in 'aeqd' mode, the projection needs to be onto a
>>> circle. As it is, what is plotted is a square that just fits inside the
>>> circle I want. Here is a link to a photo of the kind of projection I
>>> want.
>>>
>>> http://www.wm7d.net/az_proj/images/lon_anim_shaded.gif
>>>
>>> Is there a way to get the whole earth plotted with 'aeqd'?
>>> 
>>> 
>> Rob: No, you can't get the whole earth - the most you can get is the 
>> cube that fits within it. I can look into adding that functionality for 
>> the aeqd projection if there's a real use case. Note that there are 
>> other whole-earth projections available (mollweide, vandergrinten, 
>> robinson, sinuisoidal etc). These projections have much less distortion 
>> far away from the center of the map than the azimuthal equidistant 
>> does. Why do you want to use aeqd to plot the whole globe?
>>
>> -Jeff
>> 
>>> Thanks,
>>>
>>> Rob
>>> 
>>> 
>> 
>>> John [H2O] wrote:
>>> 
>>> 
>>>> Hello, 
>>>>
>>>> I'm creating a web application that will take user input from a
>>>> javascript
>>>> map to give me bounding coordinates (i.e. urcrnrlat, urcrnrlon,
>>>> llcrnrlat,
>>>> llcrnrlon) and possibly a switch for polar projection. Other than that I
>>>> have no further information. Which projection is the most suitable to
>>>> handle anything from a 'global' plot to a zoom say over a state? I don't
>>>> see the zoom being too tight, but global projections are likely. I
>>>> personally prefer Equal Area, hence right now I'm working with 'aeqd',
>>>> but
>>>> I seem to have problems if the plot is global with that projection.
>>>>
>>>> Just looking for advice, opinions, and ideally examples if anyone has
>>>> created a similar function / module to use in a web environment.
>>>>
>>>> Thanks!
>>>> -john
>>>>
>>>> 
>>>> 
>>> 
>>> 
>> -- 
>> 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
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> 
>
> 
From: Mauro C. <mau...@gm...> - 2008年12月31日 11:13:07
Attachments: Gaia.py
Dear ALL,
Could you please someone test the attached Python code (of my map
displaying test program written with MPL/Basemap/wxPython) under
MS-Windows and send me a screenshot? I have received reports saying
that the map does not fill the entire figure under MS-Windows;
however, under Ubuntu Linux it appears correctly. I have included a
conditional test before creating the figure when running under
MS-Windows to create a figure twice the size of that created under
Linux.
Thanks in advance!
With warmest regards, and Happy New Year!
-- 
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: mau...@gm...
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."
From: Jae-Joon L. <lee...@gm...> - 2008年12月31日 07:33:43
The exact location of the legend is known at drawing time. Thus, the
location of the text needs to be calculated at the drawing. I may help
you with this but it is quite tricky and you need some knowledge on
internals of the mpl.
Or, you may simply draw the figure twice (with same renderer), where
the first one is just to calculate the location of the text.
Here is an example.
------------------
import matplotlib.pyplot as plt
plt.plot([1, 3, 2], label="test2")
l = plt.legend()
plt.draw() # the location of the legend is now known
ax = gca()
bbox = l.legendPatch.get_bbox().inverse_transformed(ax.transAxes) #
bbox in axes coordinate.
x = bbox.x0+bbox.width/2. # center
ax.text(x, 0, "test", va="bottom", ha="center", transform=ax.transAxes)
plt.draw()
---------------------
Note that if you want save the figure, you need to save it with a same
dpi, or save the figure twice as above.
-JJ
On Tue, Dec 30, 2008 at 5:16 PM, Christopher Brown <c-...@as...> wrote:
> Hi,
>
> How can I get the position, in x coordinates/units, of the legend?
> Specifically, I'd like to get the center of the legend box, because I
> want to add some text that is centered-aligned with the legend. Thanks.
>
> --
> Christopher Brown, Ph.D.
> Department of Speech and Hearing Science
> Arizona State University
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: davev <dv...@li...> - 2008年12月31日 02:13:20
Please feel free to do so. If you need anything from me, I will be glad to
provide it.
dave
John Hunter-4 wrote:
> 
> On Tue, Dec 30, 2008 at 1:31 PM, davev <dv...@li...> wrote:
>>
>> Thank you John, that made the difference. I had read that you needed to
>> call
>> the draw function for the canvas first but it wasn't clear from the
>> examples. Now that you have given me the correct place to make the call,
>> things are working as expected.
>>
>> If we wanted to, this small project could easily be turned into an
>> additional example for the animation example code so that others could
>> potentially benefit from it as well. If you think that is a good idea,
>> let
>> me know and I'll look at making it happen. At the very least, the final
>> version of the files could be posted so that others could easily
>> view/download the files as example code. I would include the wxGlade file
>> so
>> that there would also be an example of that available as well.
> 
> Sure, that sounds great. I think the example with the start and stop
> buttons would be nice, as would the wxglade part. I can add them to
> the animations examples dir.
> 
> JDH
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/python-and-matplotlib-animation-tp21185506p21226091.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Rob F. <fr...@wa...> - 2008年12月31日 01:00:15
Hi Jeff,
I am an amateur radio operator, and I am writing a little application to
display where the major lobe of my antenna is pointing. I can control the
direction of my antenna with the computer, and it would be nice to have a
display of the whole world, as well as circles representing how far the
station I am talking to is, and radial lines showing the bearings. I'd like
to show the bearings along the edge of the map. For this type of map, a
circle is a much better boundary than a square, but if it has to be a
square, we should be able to make it a square bounding the circle, not the
other way around. I think I can even plot the station's location given data
I get from the Internet using this software. I am just learning Python, but
it appears to be ideal for what I'm doing. 
Right now I'm trying to figure out how to get the Eclipse IDE I am trying
out to show me the source code for Basemap. :-)
Thanks for the expert help!
Rob
Jeff Whitaker wrote:
> 
> Rob Frohne wrote:
>> Hi,
>>
>> I think I am running into the same thing John is here. When you want to
>> display the whole earth in 'aeqd' mode, the projection needs to be onto a
>> circle. As it is, what is plotted is a square that just fits inside the
>> circle I want. Here is a link to a photo of the kind of projection I
>> want.
>>
>> http://www.wm7d.net/az_proj/images/lon_anim_shaded.gif
>>
>> Is there a way to get the whole earth plotted with 'aeqd'?
>> 
> 
> Rob: No, you can't get the whole earth - the most you can get is the 
> cube that fits within it. I can look into adding that functionality for 
> the aeqd projection if there's a real use case. Note that there are 
> other whole-earth projections available (mollweide, vandergrinten, 
> robinson, sinuisoidal etc). These projections have much less distortion 
> far away from the center of the map than the azimuthal equidistant 
> does. Why do you want to use aeqd to plot the whole globe?
> 
> -Jeff
>> Thanks,
>>
>> Rob
>> 
> 
> 
>>
>> John [H2O] wrote:
>> 
>>> Hello, 
>>>
>>> I'm creating a web application that will take user input from a
>>> javascript
>>> map to give me bounding coordinates (i.e. urcrnrlat, urcrnrlon,
>>> llcrnrlat,
>>> llcrnrlon) and possibly a switch for polar projection. Other than that I
>>> have no further information. Which projection is the most suitable to
>>> handle anything from a 'global' plot to a zoom say over a state? I don't
>>> see the zoom being too tight, but global projections are likely. I
>>> personally prefer Equal Area, hence right now I'm working with 'aeqd',
>>> but
>>> I seem to have problems if the plot is global with that projection.
>>>
>>> Just looking for advice, opinions, and ideally examples if anyone has
>>> created a similar function / module to use in a web environment.
>>>
>>> Thanks!
>>> -john
>>>
>>> 
>>
>> 
> 
> 
> -- 
> 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
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/dynamic-basemap-tp20121594p21225725.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Eric Emsellem wrote:
> Hi,
> 
> I am trying to run a relatively large code, which includes some calls to and
> import from pylab/matplotlib, on a remote machine: the part of the code I am
> running is NOT performing any plot so there is no direct access to a display.
> Unfortunately it still crashes with something like:
> 
> ---> 40 cursors.MOVE : gdk.Cursor(gdk.FLEUR),
> 41 cursors.HAND : gdk.Cursor(gdk.HAND2),
> 42 cursors.POINTER : gdk.Cursor(gdk.LEFT_PTR),
> 
> RuntimeError: could not create GdkCursor object
> 
> when it tries to reach the display when importing pylab I guess.
> 
> I am now doing this from my laptop from a non-fixed IP and there is no easy way
> for me to forward the display (loging e.g. with ssh -X), or to just isolate the
> pylab part of the code (lots of files, lots of lines, etc).
> 
> I am desperately trying to run this long calculation on that remote machine (and
> do it while my laptop is off, using "screen") because I need a lot of memory and
> CPU.... How can I overpass this easily (just allowing for the code not to crash
> with that initialisation and go on with the rest) ???
Eric,
You need to set a non-interactive backend, typically agg. The method 
depends on exactly what you are doing and what your constraints are. 
The easiest may be to put a matplotlibrc file in the directory from 
which you are starting your ipython session, or running your script. 
All it needs to contain is the single line:
backend : Agg
Alternatively, any script can start with
import matplotlib
matplotlib.use('agg')
This has to come before pylab is imported.
Eric
> 
> thanks for any input there
> 
> Eric
> ========
> running: matplotlib version 0.98.3 Python 2.5.1 (r251:54863, Aug 1 2008,
> 00:35:20) via IPython 0.9.1
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Eric Emsellem wrote:
> Hi,
>
> I am trying to run a relatively large code, which includes some calls to and
> import from pylab/matplotlib, on a remote machine: the part of the code I am
> running is NOT performing any plot so there is no direct access to a display.
> Unfortunately it still crashes with something like:
>
> ---> 40 cursors.MOVE : gdk.Cursor(gdk.FLEUR),
> 41 cursors.HAND : gdk.Cursor(gdk.HAND2),
> 42 cursors.POINTER : gdk.Cursor(gdk.LEFT_PTR),
>
> RuntimeError: could not create GdkCursor object
>
> when it tries to reach the display when importing pylab I guess.
>
> I am now doing this from my laptop from a non-fixed IP and there is no easy way
> for me to forward the display (loging e.g. with ssh -X), or to just isolate the
> pylab part of the code (lots of files, lots of lines, etc).
>
> I am desperately trying to run this long calculation on that remote machine (and
> do it while my laptop is off, using "screen") because I need a lot of memory and
> CPU.... How can I overpass this easily (just allowing for the code not to crash
> with that initialisation and go on with the rest) ???
>
> thanks for any input there
>
> Eric
> 
Eric: That looks like the error you get from pygtk when there's no X11 
running. Can you just use a non-gui backend, like plain Agg? See 
http://matplotlib.sourceforge.net/faq/installing_faq.html#backends for 
how to change the default backend.
-Jeff
> ========
> running: matplotlib version 0.98.3 Python 2.5.1 (r251:54863, Aug 1 2008,
> 00:35:20) via IPython 0.9.1
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
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 E. <ems...@ob...> - 2008年12月30日 23:12:35
sorry, I just found the simple way out and so I am answering my own post: use
Agg instead of GtkAgg...
sorry for the dummy question and the inconvenience,
and have a nice end of 2008
cheers
> I am trying to run a relatively large code, which includes some calls to and
> import from pylab/matplotlib, on a remote machine: the part of the code I am
> running is NOT performing any plot so there is no direct access to a display.
> Unfortunately it still crashes with something like:
> 
> ---> 40 cursors.MOVE : gdk.Cursor(gdk.FLEUR),
> 41 cursors.HAND : gdk.Cursor(gdk.HAND2),
> 42 cursors.POINTER : gdk.Cursor(gdk.LEFT_PTR),
> 
> RuntimeError: could not create GdkCursor object
> 
> when it tries to reach the display when importing pylab I guess.
> 
> I am now doing this from my laptop from a non-fixed IP and there is no easy way
> for me to forward the display (loging e.g. with ssh -X), or to just isolate the
> pylab part of the code (lots of files, lots of lines, etc).
> 
> I am desperately trying to run this long calculation on that remote machine (and
> do it while my laptop is off, using "screen") because I need a lot of memory and
> CPU.... How can I overpass this easily (just allowing for the code not to crash
> with that initialisation and go on with the rest) ???
> 
> thanks for any input there
From: Jeff W. <js...@fa...> - 2008年12月30日 23:11:14
Rob Frohne wrote:
> Hi,
>
> I think I am running into the same thing John is here. When you want to
> display the whole earth in 'aeqd' mode, the projection needs to be onto a
> circle. As it is, what is plotted is a square that just fits inside the
> circle I want. Here is a link to a photo of the kind of projection I want.
>
> http://www.wm7d.net/az_proj/images/lon_anim_shaded.gif
>
> Is there a way to get the whole earth plotted with 'aeqd'?
> 
Rob: No, you can't get the whole earth - the most you can get is the 
cube that fits within it. I can look into adding that functionality for 
the aeqd projection if there's a real use case. Note that there are 
other whole-earth projections available (mollweide, vandergrinten, 
robinson, sinuisoidal etc). These projections have much less distortion 
far away from the center of the map than the azimuthal equidistant 
does. Why do you want to use aeqd to plot the whole globe?
-Jeff
> Thanks,
>
> Rob
> 
>
> John [H2O] wrote:
> 
>> Hello, 
>>
>> I'm creating a web application that will take user input from a javascript
>> map to give me bounding coordinates (i.e. urcrnrlat, urcrnrlon, llcrnrlat,
>> llcrnrlon) and possibly a switch for polar projection. Other than that I
>> have no further information. Which projection is the most suitable to
>> handle anything from a 'global' plot to a zoom say over a state? I don't
>> see the zoom being too tight, but global projections are likely. I
>> personally prefer Equal Area, hence right now I'm working with 'aeqd', but
>> I seem to have problems if the plot is global with that projection.
>>
>> Just looking for advice, opinions, and ideally examples if anyone has
>> created a similar function / module to use in a web environment.
>>
>> Thanks!
>> -john
>>
>> 
>
> 
-- 
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 E. <ems...@ob...> - 2008年12月30日 23:05:18
Hi,
I am trying to run a relatively large code, which includes some calls to and
import from pylab/matplotlib, on a remote machine: the part of the code I am
running is NOT performing any plot so there is no direct access to a display.
Unfortunately it still crashes with something like:
---> 40 cursors.MOVE : gdk.Cursor(gdk.FLEUR),
 41 cursors.HAND : gdk.Cursor(gdk.HAND2),
 42 cursors.POINTER : gdk.Cursor(gdk.LEFT_PTR),
RuntimeError: could not create GdkCursor object
when it tries to reach the display when importing pylab I guess.
I am now doing this from my laptop from a non-fixed IP and there is no easy way
for me to forward the display (loging e.g. with ssh -X), or to just isolate the
pylab part of the code (lots of files, lots of lines, etc).
I am desperately trying to run this long calculation on that remote machine (and
do it while my laptop is off, using "screen") because I need a lot of memory and
CPU.... How can I overpass this easily (just allowing for the code not to crash
with that initialisation and go on with the rest) ???
thanks for any input there
Eric
========
running: matplotlib version 0.98.3 Python 2.5.1 (r251:54863, Aug 1 2008,
00:35:20) via IPython 0.9.1
From: Christopher B. <c-...@as...> - 2008年12月30日 22:16:14
Hi,
How can I get the position, in x coordinates/units, of the legend? 
Specifically, I'd like to get the center of the legend box, because I 
want to add some text that is centered-aligned with the legend. Thanks.
-- 
Christopher Brown, Ph.D.
Department of Speech and Hearing Science
Arizona State University
From: Rob F. <fr...@wa...> - 2008年12月30日 22:02:07
I just thought I would include some code so you can see what I mean.
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
map=Basemap(projection='aeqd', lat_0=46, lon_0=-118.4, width=28300000,
height=28300000,
 resolution='c', area_thresh=1000.)
map.drawcoastlines()
map.drawcountries()
map.fillcontinents(color='coral')
map.drawmapboundary()
plt.show()
Rob Frohne wrote:
> 
> Hi,
> 
> I think I am running into the same thing John is here. When you want to
> display the whole earth in 'aeqd' mode, the projection needs to be onto a
> circle. As it is, what is plotted is a square that just fits inside the
> circle I want. Here is a link to a photo of the kind of projection I
> want.
> 
> http://www.wm7d.net/az_proj/images/lon_anim_shaded.gif
> 
> Is there a way to get the whole earth plotted with 'aeqd'?
> 
> Thanks,
> 
> Rob
> 
> 
> John [H2O] wrote:
>> 
>> Hello, 
>> 
>> I'm creating a web application that will take user input from a
>> javascript map to give me bounding coordinates (i.e. urcrnrlat,
>> urcrnrlon, llcrnrlat, llcrnrlon) and possibly a switch for polar
>> projection. Other than that I have no further information. Which
>> projection is the most suitable to handle anything from a 'global' plot
>> to a zoom say over a state? I don't see the zoom being too tight, but
>> global projections are likely. I personally prefer Equal Area, hence
>> right now I'm working with 'aeqd', but I seem to have problems if the
>> plot is global with that projection.
>> 
>> Just looking for advice, opinions, and ideally examples if anyone has
>> created a similar function / module to use in a web environment.
>> 
>> Thanks!
>> -john
>> 
> 
> 
-- 
View this message in context: http://www.nabble.com/dynamic-basemap-tp20121594p21223795.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Rob F. <fr...@wa...> - 2008年12月30日 22:00:15
Hi,
I think I am running into the same thing John is here. When you want to
display the whole earth in 'aeqd' mode, the projection needs to be onto a
circle. As it is, what is plotted is a square that just fits inside the
circle I want. Here is a link to a photo of the kind of projection I want.
http://www.wm7d.net/az_proj/images/lon_anim_shaded.gif
Is there a way to get the whole earth plotted with 'aeqd'?
Thanks,
Rob
John [H2O] wrote:
> 
> Hello, 
> 
> I'm creating a web application that will take user input from a javascript
> map to give me bounding coordinates (i.e. urcrnrlat, urcrnrlon, llcrnrlat,
> llcrnrlon) and possibly a switch for polar projection. Other than that I
> have no further information. Which projection is the most suitable to
> handle anything from a 'global' plot to a zoom say over a state? I don't
> see the zoom being too tight, but global projections are likely. I
> personally prefer Equal Area, hence right now I'm working with 'aeqd', but
> I seem to have problems if the plot is global with that projection.
> 
> Just looking for advice, opinions, and ideally examples if anyone has
> created a similar function / module to use in a web environment.
> 
> Thanks!
> -john
> 
-- 
View this message in context: http://www.nabble.com/dynamic-basemap-tp20121594p21223766.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: John H. <jd...@gm...> - 2008年12月30日 19:50:34
On Tue, Dec 30, 2008 at 1:10 PM, Eric Firing <ef...@ha...> wrote:
> Michael Hearne wrote:
>> I am posting yet another question about colormaps, as I am having
>> trouble grasping the fundamentals of the way the color model works in
>> Matplotlib.
>
> Mike,
>
> I recently added examples/pylab_examples/custom_cmap.py with an
> extensive docstring, partly stolen from the cookbook, to try to explain
> and illustrate the use of LinearSegmentedColormap.
Online here
http://matplotlib.sourceforge.net/examples/pylab_examples/custom_cmap.html
JDH
From: John H. <jd...@gm...> - 2008年12月30日 19:48:56
On Tue, Dec 30, 2008 at 1:31 PM, davev <dv...@li...> wrote:
>
> Thank you John, that made the difference. I had read that you needed to call
> the draw function for the canvas first but it wasn't clear from the
> examples. Now that you have given me the correct place to make the call,
> things are working as expected.
>
> If we wanted to, this small project could easily be turned into an
> additional example for the animation example code so that others could
> potentially benefit from it as well. If you think that is a good idea, let
> me know and I'll look at making it happen. At the very least, the final
> version of the files could be posted so that others could easily
> view/download the files as example code. I would include the wxGlade file so
> that there would also be an example of that available as well.
Sure, that sounds great. I think the example with the start and stop
buttons would be nice, as would the wxglade part. I can add them to
the animations examples dir.
JDH
From: Michael H. <mh...@us...> - 2008年12月30日 19:38:19
Looking at Eric's documentation, I now understand that my cdict will not 
work. I retract my question for now until I can figure out how to make 
a cdict that looks like what I want.
Thanks.
Eric Firing wrote:
> Michael Hearne wrote:
>> I am posting yet another question about colormaps, as I am having 
>> trouble grasping the fundamentals of the way the color model works in 
>> Matplotlib.
>
> Mike,
>
> I recently added examples/pylab_examples/custom_cmap.py with an 
> extensive docstring, partly stolen from the cookbook, to try to 
> explain and illustrate the use of LinearSegmentedColormap.
>
> examples/api/colorbar_only.py gives an example of a ListedColormap, 
> although it sounds to me like what you want really is the 
> LinearSegmentedColormap.
>
> Eric
From: davev <dv...@li...> - 2008年12月30日 19:31:25
Thank you John, that made the difference. I had read that you needed to call
the draw function for the canvas first but it wasn't clear from the
examples. Now that you have given me the correct place to make the call,
things are working as expected.
If we wanted to, this small project could easily be turned into an
additional example for the animation example code so that others could
potentially benefit from it as well. If you think that is a good idea, let
me know and I'll look at making it happen. At the very least, the final
version of the files could be posted so that others could easily
view/download the files as example code. I would include the wxGlade file so
that there would also be an example of that available as well.
Thanks again for the help.
dave
John Hunter-4 wrote:
> 
> On Mon, Dec 29, 2008 at 2:04 PM, davev <dv...@li...> wrote:
>> Will do (done actually). Here is the list of files: MyFrame.py
>> HeartPanel.py
>> app.py anim.wxg I've included the wxGlade file just to be complete.
>> Please
>> let me know if you see anything that is obviously wrong here. It's not
>> much
>> different from some of the examples I've looked at but doesn't produce
>> similar results. dave
> 
> The problem was that you did not call "draw" in your plot init method
> before saving the background region. Unless you are in interactive
> mode in pylab, you must manually force a figure draw with a call to
> figure.canvas.draw. Eg, the method should look like::
> 
> def init_plot(self):
> '''
> Method to initialize the plot that is used to animate the display.
> '''
> self.figure.subplots_adjust(left=0, top=1, right=1, bottom=0)
> self.axes = self.figure.add_subplot(111)
> self.axes.set_axis_bgcolor('black')
> self.figure.canvas.draw()
> if self.bgnd == None:
> self.bgnd = self.canvas.copy_from_bbox(self.axes.bbox)
> 
> self.x_data = num.arange(0, 2*num.pi, 0.01)
> self.line = self.axes.plot(self.x_data, \
> num.sin(self.x_data), \
> color='green', \
> figure=self.figure, \
> lw=2, \
> animated=True)
> self.axes.hold(False)
> 
> 
> I was able to run your example, and with these changes it works as
> expected.
> 
> JDH
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://www.nabble.com/python-and-matplotlib-animation-tp21185506p21222019.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2008年12月30日 19:10:26
Michael Hearne wrote:
> I am posting yet another question about colormaps, as I am having 
> trouble grasping the fundamentals of the way the color model works in 
> Matplotlib.
Mike,
I recently added examples/pylab_examples/custom_cmap.py with an 
extensive docstring, partly stolen from the cookbook, to try to explain 
and illustrate the use of LinearSegmentedColormap.
examples/api/colorbar_only.py gives an example of a ListedColormap, 
although it sounds to me like what you want really is the 
LinearSegmentedColormap.
Eric
From: Michael H. <mh...@us...> - 2008年12月30日 17:56:02
I am posting yet another question about colormaps, as I am having 
trouble grasping the fundamentals of the way the color model works in 
Matplotlib.
There are many examples on-line of very nice looking continuous color 
images, such as the one that would be produced by using this code:
/delta = 0.005
extent = (-3,4,-4,3)
x = arange(-3.0, 4.001, delta)
y = arange(-4.0, 3.001, delta)
X, Y = meshgrid(x, y)
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = (Z1 - Z2) * 10
#normalize the example Z data to be between 0 and 10
Z = ((Z - Z.min())/(Z.max() - Z.min()))*10
jet()
imshow(Z)
show()
/However, I can't find any similar examples for custom colormaps. Below 
is some test code I wrote to try to understand this. In it I have 
hard-coded a color dictionary (suitable for use with a 
LinearSegmentedColormap), a color list (suitable for use with a 
ListedColormap), and an array of Z values (appropriate for a Boundary 
norm). I have tried various combinations of Listed and LinearSegmented 
colormaps, and they either show patches of very discrete colors, or no 
colors, or the resulting image blows up when I call savefig().
My goal here is to display the Z data in a continuous colormap where the 
values are interpolated according to either the color dictionary or 
color list I have defined.
A final side question: Does a tutorial on the matplotlib color model 
exist anywhere? This would be a really useful resource for me, and 
perhaps for others.
Code is appended below.
Thanks,
Mike
#!/usr/bin/env python
'''
Trying to figure out how to make a smooth continuous image with my 
custom colormap
'''
from pylab import *
from matplotlib.colors import 
ListedColormap,LinearSegmentedColormap,Normalize,BoundaryNorm
isListed = True
delta = 0.005
extent = (-3,4,-4,3)
x = arange(-3.0, 4.001, delta)
y = arange(-4.0, 3.001, delta)
X, Y = meshgrid(x, y)
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = (Z1 - Z2) * 10
#normalize the example Z data to be between 0 and 10 (to match my 
colormap data)
Z = ((Z - Z.min())/(Z.max() - Z.min()))*10
cdict = {'blue': [1.0,
 1.0,
 1.0,
 1.0,
 1.0,
 0.57647058823529407,
 0.0,
 0.0,
 0.0,
 0.0,
 0.0,
 0.0],
 'green': [1.0,
 1.0,
 0.80000000000000004,
 0.90196078431372551,
 1.0,
 1.0,
 1.0,
 0.78431372549019607,
 0.56862745098039214,
 0.0,
 0.0,
 0.0],
 'red': [1.0,
 1.0,
 0.74901960784313726,
 0.62745098039215685,
 0.50196078431372548,
 0.47843137254901963,
 1.0,
 1.0,
 1.0,
 1.0,
 0.78431372549019607,
 0.50196078431372548]}
clist = array([[ 1. , 1. , 1. ],
 [ 1. , 1. , 1. ],
 [ 0.74901961, 0.8 , 1. ],
 [ 0.62745098, 0.90196078, 1. ],
 [ 0.50196078, 1. , 1. ],
 [ 0.47843137, 1. , 0.57647059],
 [ 1. , 1. , 0. ],
 [ 1. , 0.78431373, 0. ],
 [ 1. , 0.56862745, 0. ],
 [ 1. , 0. , 0. ],
 [ 0.78431373, 0. , 0. ],
 [ 0.50196078, 0. , 0. ]])
boundaries = array([ 0., 1., 2., 3., 4., 5., 6., 7., 
8., 9., 10., 13.])
From: B C. <clo...@ya...> - 2008年12月30日 15:32:02
Christian,
The answer to your second question is a little more involved and I think there are a few posts regarding custom colormaps on the mailing list that may be of interest...I'd try searching through those. I may not be the best person to answer that question. 
Also you may be interested in exploring the *kwargs vmin and vmax of the imshow command. They may do what you need as well:
http://matplotlib.sourceforge.net/api/axes_api.html?highlight=imshow#matplotlib.axes.Axes.imshow
As for your first question try the following in ipython with the -pylab flag:
import numpy as N
a = N.random.rand(50)
a*=100
plot(a)
ax = gca()
ax.set_xlim(0,25) # The set_xlim and set_ylim may be what you're looking for...
ax.set_ylim(0,50)
show()
--- On Mon, 12/29/08, Christian Lerrahn <li...@pe...> wrote:
From: Christian Lerrahn <li...@pe...>
Subject: [Matplotlib-users] Manually limiting value ranges
To: mat...@li...
Date: Monday, December 29, 2008, 11:19 PM
Hi,
I've been trying to do this for a while but just can't get it to
work. :(
There are 2 things I want to do.
1. I want to limit the value range in a line plot from
matplotlib.pyplot.plot(). I thought that clip_box would do exactly
that but setting something like [[-1,1],[-5,5]] or the like doesn't
seem to have any effect.
2. In a 2D map plot from matplotlib.pyplot.imshow(), I would like to
set the limits for the colour bar manually. I.e. I want the colours to
be equally distributed over a fixed range.
In both cases, the background to my attempt of using fixed values is
that I'm producing a time series of plots via script and want all the
plots to be directly comparable.
Did I overlook this in the examples (or the documentation) or is there
really no simple way of doing this?
Cheers,
Christian
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
5 messages has been excluded from this view by a project administrator.

Showing results of 432

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