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
(28) |
2
(11) |
3
(15) |
4
(11) |
5
(13) |
6
(33) |
7
(13) |
8
(9) |
9
(2) |
10
(9) |
11
(27) |
12
(5) |
13
(10) |
14
(6) |
15
(9) |
16
(4) |
17
(2) |
18
(19) |
19
(11) |
20
(9) |
21
(16) |
22
(16) |
23
(5) |
24
(2) |
25
(8) |
26
(2) |
27
(11) |
28
(10) |
29
(5) |
30
(1) |
31
(2) |
|
|
|
|
|
|
Patrick Marsh wrote: > Hi Jeff (and others): > > Sorry for the misunderstanding. After your second email the first > makes more sense. > > However, I still cannot figure out how to extract the lat,lon pairs > from the LineCollection object. Searching on the web and based on > Scott's suggestion from another email, I see that in the past you > could use a get_vertex() option. However it appears to have been > discontinued in mpl v 0.98.1. <http://0.98.1.> Scott: Sorry, you're right - it's far from obvious how to get the x,y coordinates pairs out of a LineCollection. Each contour has a 'collections' attribute that is a LineCollections object. The get_paths() method of the LineCollections object returns a list of a matplotlib.path.Path objects, each of which has a 'vertices' attribute. So, something like this works for me in 0.98: for xy in CS.collections[0].get_paths(): # get the paths for the first contour for xy in xy.vertices: # iterate over the Path objects # xy[0],xy[1] are the x,y coordinates # these are the lon,lat coords (map is the Basemap instance) lon, lat = map(xy[0],xy[1],inverse=True) > > I'm a relative newcomer to Python (less than 6 months) and even > greener when it comes to the inner workings of matplotlib. I'm sure > I'm going to kick myself when this is figured out... > > -Patrick No worries - don't kick yourself. Although matplotlib is quite easy to use in general, the 'inner workings' take a while to grok. -Jeff > > > On Sat, Aug 2, 2008 at 7:33 PM, Jeff Whitaker <js...@fa... > <mailto:js...@fa...>> wrote: > > Patrick Marsh wrote: > > Thanks for the quick reply. > > I may not have been totally clear on what I'm trying to save > (or I totally misunderstood what you were trying to say - > which is certainly possible). > > I'm not wanting to save the lat, lon pairs from the map > projection. I'm trying to save the lat, lon pairs of the > contour. Using my original example, if I'm plotting winds > every 5 m/s, I'm wanting to pull off the lat, lon pairs for > the 5 m/s contours. > > > Patrick: I know - that's what I was trying to explain. You can > get the x,y coordinates of the *contours* from the collections > attribute of the ContourSet object returned by contour. Then you > convert those x,y values back to lon,lat values using the Basemap > instance. > > -Jeff > > > I'll check out the website and see if I find anything there. > > -Patrick > > > > On Sat, Aug 2, 2008 at 6:13 PM, Jeff Whitaker > <js...@fa... <mailto:js...@fa...> > <mailto:js...@fa... <mailto:js...@fa...>>> wrote: > > Patrick Marsh wrote: > > Hi Everyone, > > First email here... > > I am plotting meteorological data using matplotlib and > basemap - and can do this just fine. However, I would > like to backout the coordinates being used for the > contours that are plotted. > > For example, if I were to contour windspeed every 5 m/s > and plot this (which I can do just fine), I would > like to > save a copy of the lat, lon pairs as a text file. > However, I cannot for the life of me figure out > how to do > this. I have a feeling it is pretty simple and I'm > just > over looking something that can do this. Any help > would > be appreciated. > > Thanks, > > -Patrick Marsh > Graduate Student > School of Meteorology > University of Oklahoma > > > Patrick: contour and contourf return a ContourSet object. > ContourSet.collections is a matplotlib LineCollection (for > contour) or a PolyCollection (for contourf). You can > retrieve > the x,y (map projection) coordinates from these, and > transfer > them back to lat/lon coordinates using the Basemap > instance via > > lons,lats = map(x,y,inverse=True) # map is a Basemap > instance. > > See > > http://matplotlib.sourceforge.net/doc/html/api/collections_api.html > for more info on matplotlib collection objects. > > HTH, > -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=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/> > > <http://moblin-contest.org/redirect.php?banner_id=100&url=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/>> > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > <mailto:Mat...@li...> > <mailto:Mat...@li... > <mailto:Mat...@li...>> > > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > -- Jeffrey S. Whitaker Phone : (303)497-6313 > NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 > 325 Broadway Boulder, CO, USA 80305-3328 > > > > > > -- > Jeffrey S. Whitaker Phone : (303)497-6313 > NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 > 325 Broadway Boulder, CO, USA 80305-3328 > > -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328
Twas brillig at 20:40:17 31.07.2008 UTC+02 when mat...@gm... did gyre and gimble: ST> The doc compilation is fine, the show-inheritance is fixed, but ST> just a confirmation: what was the page with the "clickable" image? ST> I seem to remember 'api/artist_api.html' but now the image in it ST> doesn't allow to be "browsable". As Lenny is already in freeze, I backported fix to 0.4.1 and now trying to get the confirmation from release team to upload it to testing-proposed-updates. Please test the package: http://dottedmag.net/~mag/sphinx/ --
the vertex list should just be a list of two element tuples... which are the XY positions of the verticies.. For example here is a function I used to split up individual closed contours: -------------------------- def split_features(vertex_list): #This function takes a list of verticies and breaks #it into a list of shapes (ie a list of list of verticies) #splits occur where a lon or lat jump of greater than 2 degrees # is found... and given that most contouring algorithums #work across the x-cord and our resolution is 1 degree this works.. jump_loc=[0] for i in range(len(vertex_list)-1): lon_jump=vertex_list[i+1][0]-vertex_list[i][0] lat_jump=vertex_list[i+1][1]-vertex_list[i][1] if (abs(lon_jump) > 2.0) or (abs(lat_jump) > 2.0): jump_loc.append(i+1) jump_loc.append(len(vertex_list)-1) print jump_loc shapes=[] for i in range(len(jump_loc)-1): shapes.append(vertex_list[jump_loc[i]:jump_loc[i+1]]) return shapes ------------------ Dr Scott Collis Postdoctoral Researcher Centre for Australian Weather and Climate Research (CAWCR) Atmosphere and Land Observation and Assessment Group Australian Bureau of Meteorology Room 9.57 Level 9 700 Collins Street Docklands 3008 Desk: (+613) 96694766 MB: 0412177550 http://www.bom.gov.au/bmrc/wefor/staff/scollis/ ________________________________ Message: 3 Date: Sat, 2 Aug 2008 21:14:02 -0500 From: "Patrick Marsh" <mar...@gm...> Subject: Re: [Matplotlib-users] Retrieve Coordinates from Contour To: "Jeff Whitaker" <js...@fa...> Cc: matplotlib-users <mat...@li...> Message-ID: <ea0...@ma...> Content-Type: text/plain; charset="iso-8859-1" Hi Jeff (and others): Sorry for the misunderstanding. After your second email the first makes more sense. However, I still cannot figure out how to extract the lat,lon pairs from the LineCollection object. Searching on the web and based on Scott's suggestion from another email, I see that in the past you could use a get_vertex() option. However it appears to have been discontinued in mpl v 0.98.1. I'm a relative newcomer to Python (less than 6 months) and even greener when it comes to the inner workings of matplotlib. I'm sure I'm going to kick myself when this is figured out... -Patrick On Sat, Aug 2, 2008 at 7:33 PM, Jeff Whitaker <js...@fa...> wrote: > Patrick Marsh wrote: > >> Thanks for the quick reply. >> >> I may not have been totally clear on what I'm trying to save (or I totally >> misunderstood what you were trying to say - which is certainly possible). >> >> I'm not wanting to save the lat, lon pairs from the map projection. I'm >> trying to save the lat, lon pairs of the contour. Using my original >> example, if I'm plotting winds every 5 m/s, I'm wanting to pull off the lat, >> lon pairs for the 5 m/s contours. >> > > Patrick: I know - that's what I was trying to explain. You can get the > x,y coordinates of the *contours* from the collections attribute of the > ContourSet object returned by contour. Then you convert those x,y values > back to lon,lat values using the Basemap instance. > > -Jeff > >> >> I'll check out the website and see if I find anything there. >> >> -Patrick >> >> >> >> On Sat, Aug 2, 2008 at 6:13 PM, Jeff Whitaker <js...@fa... >> <mailto:js...@fa...>> wrote: >> >> Patrick Marsh wrote: >> >> Hi Everyone, >> >> First email here... >> >> I am plotting meteorological data using matplotlib and >> basemap - and can do this just fine. However, I would >> like to backout the coordinates being used for the >> contours that are plotted. >> >> For example, if I were to contour windspeed every 5 m/s >> and plot this (which I can do just fine), I would like to >> save a copy of the lat, lon pairs as a text file. >> However, I cannot for the life of me figure out how to do >> this. I have a feeling it is pretty simple and I'm just >> over looking something that can do this. Any help would >> be appreciated. >> >> Thanks, >> >> -Patrick Marsh >> Graduate Student >> School of Meteorology >> University of Oklahoma >> >> >> Patrick: contour and contourf return a ContourSet object. >> ContourSet.collections is a matplotlib LineCollection (for >> contour) or a PolyCollection (for contourf). You can retrieve >> the x,y (map projection) coordinates from these, and transfer >> them back to lat/lon coordinates using the Basemap instance via >> >> lons,lats = map(x,y,inverse=True) # map is a Basemap instance. >> >> See >> >> http://matplotlib.sourceforge.net/doc/html/api/collections_api.html >> for more info on matplotlib collection objects. >> >> HTH, >> -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=/ >> <http://moblin-contest.org/redirect.php?banner_id=100&url=/> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> <mailto:Mat...@li...> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> >> -- Jeffrey S. Whitaker Phone : (303)497-6313 >> NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 >> 325 Broadway Boulder, CO, USA 80305-3328 >> >> >> >> > > -- > Jeffrey S. Whitaker Phone : (303)497-6313 > NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 > 325 Broadway Boulder, CO, USA 80305-3328 > > -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ ------------------------------------------------------------------------- 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 End of Matplotlib-users Digest, Vol 27, Issue 10 ************************************************
Jonathan, If you did not get a response by now, you can try the following. import os# set HOME environment variable to a directory the httpd server can write to os.environ[ 'HOME' ] = 'c:/www/app/tmp/' Good luck. -Rodney _____ From: mat...@li... [mailto:mat...@li...] On Behalf Of "Jonathan Hayward, http://JonathansCorner.com" Sent: Friday, August 01, 2008 11:26 AM To: Matplotlib Subject: [Matplotlib-users] Crash on import with CGI wrapped by PHP--unhappywith .matplotlib directory? I have a PHP script which authenticates a user and I am trying to get the PHP script to wrap a Python script using matplotlib. As it is, the script mostly works when invoked from the command line or as its own CGI script. When I call it from a PHP script, it doesn't produce output, and testing found that when I call a Python script from a PHP script, output works before but not after "import matplotlib": if the PHP script calls a script of: #!/usr/bin/python print "Before import matplotlib." import matplotlib; print "After import matplotlib." the first print statement succeeds but the second one fails; the server log shows a crash of: Before import matplotlib.Traceback (most recent call last): File "/home/jhayward/bintmp/test.py", line 5, in <module> import matplotlib; File "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line 639, in <module> rcParams = rc_params() File "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line 562, in rc_params fname = matplotlib_fname() File "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line 513, in matplotlib_fname fname = os.path.join(get_configdir(), 'matplotlibrc') File "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line 207, in wrapper ret = func(*args, **kwargs) File "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line 403, in _get_configdir raise RuntimeError("Failed to create %s/.matplotlib; consider setting MPLCONFIGDIR to a writable directory for matplotlib configuration data"%h) RuntimeError: Failed to create /root/.matplotlib; consider setting MPLCONFIGDIR to a writable directory for matplotlib configuration data I think this error is somewhat misleading; it persisted after I ran a "chmod -R 1777 /root/.matplotlib". What is the proper way to adjust things so matplotlib will be happy with its .matplotlib directory? -- -- Jonathan Hayward, chr...@gm... ** To see an award-winning website with stories, essays, artwork, ** games, and a four-dimensional maze, why not visit my home page? ** All of this is waiting for you at http://JonathansCorner.com ++ Would you like to curl up with one of my hardcover books? ++ You can now get my books from http://CJSHayward.com
Hi Jeff (and others): Sorry for the misunderstanding. After your second email the first makes more sense. However, I still cannot figure out how to extract the lat,lon pairs from the LineCollection object. Searching on the web and based on Scott's suggestion from another email, I see that in the past you could use a get_vertex() option. However it appears to have been discontinued in mpl v 0.98.1. I'm a relative newcomer to Python (less than 6 months) and even greener when it comes to the inner workings of matplotlib. I'm sure I'm going to kick myself when this is figured out... -Patrick On Sat, Aug 2, 2008 at 7:33 PM, Jeff Whitaker <js...@fa...> wrote: > Patrick Marsh wrote: > >> Thanks for the quick reply. >> >> I may not have been totally clear on what I'm trying to save (or I totally >> misunderstood what you were trying to say - which is certainly possible). >> >> I'm not wanting to save the lat, lon pairs from the map projection. I'm >> trying to save the lat, lon pairs of the contour. Using my original >> example, if I'm plotting winds every 5 m/s, I'm wanting to pull off the lat, >> lon pairs for the 5 m/s contours. >> > > Patrick: I know - that's what I was trying to explain. You can get the > x,y coordinates of the *contours* from the collections attribute of the > ContourSet object returned by contour. Then you convert those x,y values > back to lon,lat values using the Basemap instance. > > -Jeff > >> >> I'll check out the website and see if I find anything there. >> >> -Patrick >> >> >> >> On Sat, Aug 2, 2008 at 6:13 PM, Jeff Whitaker <js...@fa... >> <mailto:js...@fa...>> wrote: >> >> Patrick Marsh wrote: >> >> Hi Everyone, >> >> First email here... >> >> I am plotting meteorological data using matplotlib and >> basemap - and can do this just fine. However, I would >> like to backout the coordinates being used for the >> contours that are plotted. >> >> For example, if I were to contour windspeed every 5 m/s >> and plot this (which I can do just fine), I would like to >> save a copy of the lat, lon pairs as a text file. >> However, I cannot for the life of me figure out how to do >> this. I have a feeling it is pretty simple and I'm just >> over looking something that can do this. Any help would >> be appreciated. >> >> Thanks, >> >> -Patrick Marsh >> Graduate Student >> School of Meteorology >> University of Oklahoma >> >> >> Patrick: contour and contourf return a ContourSet object. >> ContourSet.collections is a matplotlib LineCollection (for >> contour) or a PolyCollection (for contourf). You can retrieve >> the x,y (map projection) coordinates from these, and transfer >> them back to lat/lon coordinates using the Basemap instance via >> >> lons,lats = map(x,y,inverse=True) # map is a Basemap instance. >> >> See >> >> http://matplotlib.sourceforge.net/doc/html/api/collections_api.html >> for more info on matplotlib collection objects. >> >> HTH, >> -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=/ >> <http://moblin-contest.org/redirect.php?banner_id=100&url=/> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> <mailto:Mat...@li...> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> >> -- Jeffrey S. Whitaker Phone : (303)497-6313 >> NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 >> 325 Broadway Boulder, CO, USA 80305-3328 >> >> >> >> > > -- > Jeffrey S. Whitaker Phone : (303)497-6313 > NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 > 325 Broadway Boulder, CO, USA 80305-3328 > >
Hi Patrick, I had to deal with this as well as I used Matplotlib's contourer to return position of features (eg certain levels of vorticity or MSLP) instead of basemapping it I just made a contour from the lat lons (ie cs=countour(lats, lons, field, levels=linspace(min,max,nl)) --code---code-- def generate_contour(lat,lon,data,level): #This program uses the matplotlib contouring program to generate a list of #verticies at a constant contour level f=figure() C=contour(lon,lat,data, [level]) col=C.collections vertex_list=col[0].get_verts() close(f) return vertex_list --code--code--code-- Dr Scott Collis Postdoctoral Researcher Centre for Australian Weather and Climate Research (CAWCR) Atmosphere and Land Observation and Assessment Group Australian Bureau of Meteorology Room 9.57 Level 9 700 Collins Street Docklands 3008 Desk: (+613) 96694766 MB: 0412177550 http://www.bom.gov.au/bmrc/wefor/staff/scollis/ Message: 1 Date: Sat, 2 Aug 2008 16:53:40 -0500 From: "Patrick Marsh" <mar...@gm...> Subject: [Matplotlib-users] Retrieve Coordinates from Contour To: matplotlib-users <mat...@li...> Message-ID: <ea0...@ma...> Content-Type: text/plain; charset="iso-8859-1" Hi Everyone, First email here... I am plotting meteorological data using matplotlib and basemap - and can do this just fine. However, I would like to backout the coordinates being used for the contours that are plotted. For example, if I were to contour windspeed every 5 m/s and plot this (which I can do just fine), I would like to save a copy of the lat, lon pairs as a text file. However, I cannot for the life of me figure out how to do this. I have a feeling it is pretty simple and I'm just over looking something that can do this. Any help would be appreciated. Thanks, -Patrick Marsh Graduate Student School of Meteorology University of Oklahoma
Patrick Marsh wrote: > Thanks for the quick reply. > > I may not have been totally clear on what I'm trying to save (or I > totally misunderstood what you were trying to say - which is certainly > possible). > > I'm not wanting to save the lat, lon pairs from the map projection. > I'm trying to save the lat, lon pairs of the contour. Using my > original example, if I'm plotting winds every 5 m/s, I'm wanting to > pull off the lat, lon pairs for the 5 m/s contours. Patrick: I know - that's what I was trying to explain. You can get the x,y coordinates of the *contours* from the collections attribute of the ContourSet object returned by contour. Then you convert those x,y values back to lon,lat values using the Basemap instance. -Jeff > > I'll check out the website and see if I find anything there. > > -Patrick > > > > On Sat, Aug 2, 2008 at 6:13 PM, Jeff Whitaker <js...@fa... > <mailto:js...@fa...>> wrote: > > Patrick Marsh wrote: > > Hi Everyone, > > First email here... > > I am plotting meteorological data using matplotlib and > basemap - and can do this just fine. However, I would > like to backout the coordinates being used for the > contours that are plotted. > > For example, if I were to contour windspeed every 5 m/s > and plot this (which I can do just fine), I would like to > save a copy of the lat, lon pairs as a text file. > However, I cannot for the life of me figure out how to do > this. I have a feeling it is pretty simple and I'm just > over looking something that can do this. Any help would > be appreciated. > > Thanks, > > -Patrick Marsh > Graduate Student > School of Meteorology > University of Oklahoma > > > Patrick: contour and contourf return a ContourSet object. > ContourSet.collections is a matplotlib LineCollection (for > contour) or a PolyCollection (for contourf). You can retrieve > the x,y (map projection) coordinates from these, and transfer > them back to lat/lon coordinates using the Basemap instance via > > lons,lats = map(x,y,inverse=True) # map is a Basemap instance. > > See > http://matplotlib.sourceforge.net/doc/html/api/collections_api.html > for more info on matplotlib collection objects. > > HTH, > -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=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/> > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > <mailto:Mat...@li...> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > -- > Jeffrey S. Whitaker Phone : (303)497-6313 > NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 > 325 Broadway Boulder, CO, USA 80305-3328 > > > -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328
Thank you Michael, I tried switching the matplotlib font to Dejavu Sans but it also does not seem to recognize the lunate epsilon ε. When I wrote title(u'ε-Fe'), it printed ε-Fe instead. I tried several other fonts but the problem did not disappear. It seems that the bes choice after all is to write r'$\rm{\epsilon-Fe}$'. Thanks again Eli On Thu, Jul 31, 2008 at 9:03 AM, Michael Droettboom <md...@st...> wrote: > (Sorry for the delay -- just back from vacation) > > It looks like the default Vera Sans font that matplotlib uses doesn't > actually have the lunate epsilon character. If you have it installed, you > could have matplotlib use the DejaVu Sans font instead (which is essentially > Vera Sans with a larger set of characters). > > In your matplotlibrc, set font.sans to DejaVu Sans > > Cheers, > Mike > > Eli Brosh wrote: > >> Thanks, >> This unicode thing works like magic. >> The only thing I am still unable to do is to insert the symbol \epsilon >> (as distinct from \varepsilon). >> For some reason, the varepsilon ε is printed fine, but a blank square is >> printed instead of the lunate epsilon ε. >> That is u' ε ' works, while u' ε' does not. >> >> Any idea why this is happening ? >> >> Eli >> >> >> 2008年7月22日 Michael Droettboom <md...@st... <mailto:md...@st...>>: >> >> Yes, you would put it at the top of your .py file. >> >> In order to use Unicode in Python source code, you have to tell >> the Python interpreter what encoding the file is in. That's done >> with a little "magic" comment at the top of the file. The popular >> Unixy editors (emacs, vim etc.) also understand this comment and >> will save the file correctly. Possibly other editors do as well. >> >> For more gory details that you probably need, see this: >> >> http://www.amk.ca/python/howto/unicode >> >> particularly the section "Unicode Literals in Python Source Code". >> >> >> Cheers, >> Mike >> >> Eli Brosh wrote: >> >> Thanks, >> This seems to be a solution. >> I have an editor that supports unicode. >> But, can you please explain better how do I make the coding >> directive at the top of my source files ? >> Where do I write the command: >> # -*- coding: utf-8 -*- >> >> Is it inside the python script ? >> >> >> Sorry for the ignorance. >> Eli >> >> On Tue, Jul 22, 2008 at 10:14 AM, Michael Droettboom >> <md...@st... <mailto:md...@st...> >> <mailto:md...@st... <mailto:md...@st...>>> wrote: >> >> As an alternative, you could just use Unicode to insert the >> Greek >> characters: >> >> r"α-Fe (Someone 2003)" >> >> The default font used by matplotlib, Vera Sans, includes a full >> set of Greek characters. This, of course, requires an >> editor that >> supports Unicode and a coding directive at the top of your >> source >> files, eg.: >> >> # -*- coding: utf-8 -*- >> >> >> Cheers, >> Mike >> >> Eli Brosh wrote: >> >> Here is the use case I have in mind: >> Plotting properties of various phases of iron, I need a >> legend >> with greek letters and normal text: >> \alpha-Fe, Someone (2003) >> >> Now, I need the names e.g. someone to be upright. >> Also, the relbar between \alpha and Fe is shorter with >> normal >> text fonts than with italics. >> >> I can solve the problem by using r'\rm{\alpha-Fe, Someone >> (2003)}' but it would be easier if I could just change the >> defaults. >> >> Eli >> >> >> On Mon, Jul 21, 2008 at 6:21 PM, Michael Droettboom >> <md...@st... <mailto:md...@st...> >> <mailto:md...@st... <mailto:md...@st...>> >> <mailto:md...@st... <mailto:md...@st...> >> <mailto:md...@st... <mailto:md...@st...>>>> wrote: >> >> Unfortunately there isn't. This is *theoretically* >> possible >> with >> the STIX fonts, but that hasn't been implemented. >> However, with >> the Computer Modern fonts, many of the glyphs simply >> aren't >> present (upright Greek, for example) to make this >> happen. >> >> That said, I'm not sure this is necessarily a good idea. >> Math has >> a set of commonly accepted conventions about when to >> use italic >> vs. upright that may only confuse the reader when >> not followed. >> Can you provide a use case? >> >> Cheers, >> Mike >> >> Eli Brosh wrote: >> >> Hello >> I there a way to change the default mathtext >> font from >> cal to rm ? >> I would like to use the rm (serif) font without >> stating >> rm{...} or mathrm{...}. >> Is it possible to do using the matplotlibrc ? >> can you give me an example of how this is done ? >> >> Thanks >> Eli >> >> ------------------------------------------------------------------------ >> >> >> ------------------------------------------------------------------------- >> 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=/ >> <http://moblin-contest.org/redirect.php?banner_id=100&url=/> >> < >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>> >> < >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> <http://moblin-contest.org/redirect.php?banner_id=100&url=/> >> < >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> <mailto:Mat...@li...> >> <mailto:Mat...@li... >> <mailto:Mat...@li...>> >> <mailto:Mat...@li... >> <mailto:Mat...@li...> >> <mailto:Mat...@li... >> <mailto:Mat...@li...>>> >> >> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> >> >> -- Michael Droettboom >> Science Software Branch >> Operations and Engineering Division >> Space Telescope Science Institute >> Operated by AURA for NASA >> >> >> >> -- Michael Droettboom >> Science Software Branch >> Operations and Engineering Division >> Space Telescope Science Institute >> Operated by AURA for NASA >> >> >> > -- > Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > >
Thanks for the quick reply. I may not have been totally clear on what I'm trying to save (or I totally misunderstood what you were trying to say - which is certainly possible). I'm not wanting to save the lat, lon pairs from the map projection. I'm trying to save the lat, lon pairs of the contour. Using my original example, if I'm plotting winds every 5 m/s, I'm wanting to pull off the lat, lon pairs for the 5 m/s contours. I'll check out the website and see if I find anything there. -Patrick On Sat, Aug 2, 2008 at 6:13 PM, Jeff Whitaker <js...@fa...> wrote: > >> Patrick Marsh wrote: >> >>> Hi Everyone, >>> >>> First email here... >>> >>> I am plotting meteorological data using matplotlib and basemap - and can >>> do this just fine. However, I would like to backout the coordinates being >>> used for the contours that are plotted. >>> >>> For example, if I were to contour windspeed every 5 m/s and plot this >>> (which I can do just fine), I would like to save a copy of the lat, lon >>> pairs as a text file. However, I cannot for the life of me figure out how >>> to do this. I have a feeling it is pretty simple and I'm just over looking >>> something that can do this. Any help would be appreciated. >>> >>> Thanks, >>> >>> -Patrick Marsh >>> Graduate Student >>> School of Meteorology >>> University of Oklahoma >>> >> >> Patrick: contour and contourf return a ContourSet object. >> ContourSet.collections is a matplotlib LineCollection (for contour) or a >> PolyCollection (for contourf). You can retrieve the x,y (map projection) >> coordinates from these, and transfer them back to lat/lon coordinates using >> the Basemap instance via >> >> lons,lats = map(x,y,inverse=True) # map is a Basemap instance. >> >> See http://matplotlib.sourceforge.net/doc/html/api/collections_api.htmlfor more info on matplotlib collection objects. >> >> HTH, >> -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 >>> >>> >> >> >> -- >> Jeffrey S. Whitaker Phone : (303)497-6313 >> NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 >> 325 Broadway Boulder, CO, USA 80305-3328 >> >> >
Patrick Marsh wrote: > Hi Everyone, > > First email here... > > I am plotting meteorological data using matplotlib and basemap - and > can do this just fine. However, I would like to backout the > coordinates being used for the contours that are plotted. > > For example, if I were to contour windspeed every 5 m/s and plot this > (which I can do just fine), I would like to save a copy of the lat, > lon pairs as a text file. However, I cannot for the life of me figure > out how to do this. I have a feeling it is pretty simple and I'm just > over looking something that can do this. Any help would be appreciated. > > Thanks, > > -Patrick Marsh > Graduate Student > School of Meteorology > University of Oklahoma Patrick: contour and contourf return a ContourSet object. ContourSet.collections is a matplotlib LineCollection (for contour) or a PolyCollection (for contourf). You can retrieve the x,y (map projection) coordinates from these, and transfer them back to lat/lon coordinates using the Basemap instance via lons,lats = map(x,y,inverse=True) # map is a Basemap instance. See http://matplotlib.sourceforge.net/doc/html/api/collections_api.html for more info on matplotlib collection objects. HTH, -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 > -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328
Hi Everyone, First email here... I am plotting meteorological data using matplotlib and basemap - and can do this just fine. However, I would like to backout the coordinates being used for the contours that are plotted. For example, if I were to contour windspeed every 5 m/s and plot this (which I can do just fine), I would like to save a copy of the lat, lon pairs as a text file. However, I cannot for the life of me figure out how to do this. I have a feeling it is pretty simple and I'm just over looking something that can do this. Any help would be appreciated. Thanks, -Patrick Marsh Graduate Student School of Meteorology University of Oklahoma
On Sat, Aug 2, 2008 at 4:18 AM, sa6113 <s.p...@gm...> wrote: > > No, unfortuantly matplotlib.axes dosen't have this attribute. > You can find demos in matplotlib examples of set_xlim() : in manual_axis.py : fig = figure(facecolor='white') ax = fig.add_subplot(111, frame_on=False) ax.plot(x, y, 'd', markersize=8, markerfacecolor='blue') ax.set_xlim(0, 200) ax.set_ylim(-1.5, 1.5)
On Saturday 02 August 2008 4:56:06 am David Cournapeau wrote: > Hi, > > I am using matplotlib for all my figure needs in academic papers, > but I would like to convert some of my figures (generally exported ni > eps and pdf) in black and white. I tried using colormaps, but when using > several axes, I can't convert them all in one shot. Is there any way to > say (in say savefig) to use a given colormap (gray levels in my case) > for the whole figure ? Or is colormap not the way to go ? Have you tried setting the default colormap in your rc settings?
Anand Patil wrote: > Hi all, > > I've decided to hitch my wagon to the enthought distribution, which > comes with matplotlib 0.91.2. <http://0.91.2.>.. so when I try to use > basemap I get > > <type 'exceptions.ImportError'>: your matplotlib is too old - basemap > requires version 0.98 or > higher, you have version 0.91.2 > > I tried just installing matplotlib from svn, but it doesn't like the > version of numpy in ETS. What's the latest version of basemap I can > use with matplotlib 0.91.2? > > Thanks, > Anand Anand: I honestly don't know. I do know if you upgrade numpy to 1.1, you can upgrade matplotlib/basemap to the latest versions. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328
Hi all, I've decided to hitch my wagon to the enthought distribution, which comes with matplotlib 0.91.2... so when I try to use basemap I get <type 'exceptions.ImportError'>: your matplotlib is too old - basemap requires version 0.98 or higher, you have version 0.91.2 I tried just installing matplotlib from svn, but it doesn't like the version of numpy in ETS. What's the latest version of basemap I can use with matplotlib 0.91.2? Thanks, Anand
Hi, I am using matplotlib for all my figure needs in academic papers, but I would like to convert some of my figures (generally exported ni eps and pdf) in black and white. I tried using colormaps, but when using several axes, I can't convert them all in one shot. Is there any way to say (in say savefig) to use a given colormap (gray levels in my case) for the whole figure ? Or is colormap not the way to go ? thanks, David
No, unfortuantly matplotlib.axes dosen't have this attribute. sa6113 wrote: > > I am using matplotlib to draw and show my plot, now I want to know how may > I add manual axes scale to it. > I need to manually show the axes scale (from min to max value that I have) > the below is some part of my code. > . > . > . > from matplotlib.figure import Figure > > self.fig = Figure( figsize =5, 4 )) > yLine = self.ax.plot( xData, yData, 'ro-', linewidth = 2 ) > fitLine = self.ax.plot( xData, fitData,'bo-', linewidth = 1 ) > self.ax.set_xlabel('X') > self.ax.set_ylabel('Y ) > -- View this message in context: http://www.nabble.com/how-add-axes-scale-to-my-plot--tp18727840p18786828.html Sent from the matplotlib - users mailing list archive at Nabble.com.
Alan G Isaac wrote: > > I read Jonathan's point as being: there is no such > "linking" possibility with such demo scripts. > This indeed is why I questioned the relevance of > the LGPL for such things, earlier on, even though > the LGPL is in principle (and often in practice) > a much more user friendly license than the GPL. > I agree. So, I've modified the license of the demos to "public domain". Thanks for the interesting discussion Eli -- View this message in context: http://www.nabble.com/more-demos-of-mpl-with-wxPython-tp18770262p18786329.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Fri, 1 Aug 2008, eliben apparently wrote: > if you link my module into your code, you won't have to > release your code, I read Jonathan's point as being: there is no such "linking" possibility with such demo scripts. This indeed is why I questioned the relevance of the LGPL for such things, earlier on, even though the LGPL is in principle (and often in practice) a much more user friendly license than the GPL. Again, not all code needs the same license, and simple scripts seem (to me) to beg to be placed in the public domain. But of course the key rule is always: s/he who holds the copyright picks the license. Cheers, Alan Isaac
JonathansCorner.com wrote: > > I personally regard viral licenses with caution: that is, if the copyright > says, "Don't build on or extend this unless you want your work to be > covered > by my chosen license," I will be extremely cautious about building off of > them. Under the LGPV, if I incorporate one of your demos into my own 2000 > line program, your requirements of fairness require me to place my entire > 2000 line program under the terms of the license you chose. > > This is a significant deterrent to some programmers. > I think you're mixing up GPL and LGPL here. LGPL was born especially for the purpose of being copyleft but not viral. With LGPL, if you link my module into your code, you won't have to release your code, only my module's. With GPL, you'd have to open both. While http://www.scipy.org/License_Compatibility is convincing, it also speaks about GPL in this manner, giving LGPL only a short after-thought in the end. I will however consider lowering the license bar for my demo code, since it relies too much on BSD-licensed MPL stuff. Eli -- View this message in context: http://www.nabble.com/more-demos-of-mpl-with-wxPython-tp18770262p18786128.html Sent from the matplotlib - users mailing list archive at Nabble.com.
Ben Axelrod wrote: > > Before I go about creating this plot by hand, I would like to verify > that matplotlib does not already have this functionality. See > attached pic. > > > > Thanks, > > -Ben > Ben: No, it doesn't. -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
Zane Selvans wrote: > Hi all, > > Does anybody know how one gets a mpl_toolkits.basemap.Basemap map to > automatically recognize when a feature has run off the end of the > longitude range, and needs to wrap around and show up on the far side > of a map having global extent? I have a bunch of linear features I'm > trying to plot intelligently... and what happens now is, either the > feature runs off the edge, and disappears, or, if I change the > coordinates making up the object to all lie within the longitude range > that the map contains, then I end up with a line going all the way > across the map from one side to the other, connecting the two portions > of the feature. > Zane: This has come up several times before on the list, and unfortunately the answer is no - I don't know of any general way to do what you ask. Unless someone else has a solution, I think you'll have to manually split up your lines so they all fit in the map region. If all you lines are in one hemisphere, another potential solution is to use a polar stereographic map (projection = 'npstere' or 'spstere'). That way, you'll be looking down on the earth from above the pole, and the lines will all be within the map (never crossing an edge). > There's this function "addcyclic", but I don't think it does what I > want. Actually, I'm not exactly clear on what it does. > It adds an extra column of data that repeats the first longitude, so you don't get a gap on the plot when you plot a global dataset. -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
This is getting a bit outside of my knowledge area, but it does look like the environment variables are not being set up correctly when the Python process is run. This is probably a more general apache/mod_php sort of question, but it would be great to post the answer here so we can add a solution to the matplotlib FAQ. Cheers, Mike "Jonathan Hayward, http://JonathansCorner.com" wrote: > It looks like an apache that thinks it's root: > > os.system("whoami") > print "<br>" > print os.geteuid() > print "<br>" > print os.getuid() > print "<br>" > print os.path.expanduser("~") > print "<br>" > print os.getenv("HOME") > print "<br>" > print os.getenv("USERPROFILE") > print "<br>" > print os.getenv("USER") > print "<br>" > print os.getenv("TMP") > print "<br>" > > produces: > > apache > 81 > 81 > /root > /root > None > root > None > > So I should adjust the system so a confused apache-owned process that > thinks it's root will run? Or are there features to ask PHP to spawn > subprocesses that know who they're running as? (or is that something > beside the point of this list?) > > On Fri, Aug 1, 2008 at 1:09 PM, Michael Droettboom <md...@st... > <mailto:md...@st...>> wrote: > > Below is the code in mpl that actually does the lookup. To get to > the bottom of this, I would try to figure out in your Apache/PHP > environment what > > a) what os.path.expanduser("~") gives > > b) what the values of the environment variables "HOME", > "USERPROFILE", "USER", and "TMP" are. > > I suspect either matplotlib is not getting run under user 'apache' > as it should, or there is something fishy about the environment. > > Cheers, > Mike > > def _get_home(): > """Find user's home directory if possible. > Otherwise raise error. > > :see: > http://mail.python.org/pipermail/python-list/2005-February/263921.html > """ > path='' > try: > path=os.path.expanduser("~") > except: > pass > if not os.path.isdir(path): > for evar in ('HOME', 'USERPROFILE', 'TMP'): > try: > path = os.environ[evar] > if os.path.isdir(path): > break > except: pass > if path: > return path > else: > raise RuntimeError('please define environment variable $HOME') > > > > get_home = verbose.wrap('$HOME=%s', _get_home, always=False) > > def _get_configdir(): > """ > Return the string representing the configuration dir. > > default is HOME/.matplotlib. you can override this with the > MPLCONFIGDIR environment variable > """ > > configdir = os.environ.get('MPLCONFIGDIR') > if configdir is not None: > if not _is_writable_dir(configdir): > raise RuntimeError('Could not write to > MPLCONFIGDIR="%s"'%configdir) > return configdir > > h = get_home() > p = os.path.join(get_home(), '.matplotlib') > > if os.path.exists(p): > if not _is_writable_dir(p): > raise RuntimeError("'%s' is not a writable dir; you must > set %s/.matplotlib to be a writable dir. You can also set > environment variable MPLCONFIGDIR to any writable directory where > you want matplotlib data stored "% (h, h)) > else: > if not _is_writable_dir(h): > > raise RuntimeError("Failed to create %s/.matplotlib; > consider setting MPLCONFIGDIR to a writable directory for > matplotlib configuration data"%h) > > os.mkdir(p) > > > > "Jonathan Hayward, http://JonathansCorner.com" wrote: > > User apache exists with home directory /var/www, which exists. > > On Fri, Aug 1, 2008 at 11:59 AM, Michael Droettboom > <md...@st... <mailto:md...@st...> > <mailto:md...@st... <mailto:md...@st...>>> wrote: > > It's supposed to default to the current user's home directory. > Perhaps "apache" doesn't have a home directory? > > > Cheers, > Mike > > "Jonathan Hayward, http://JonathansCorner.com" wrote: > > I found a reason for the behavior: > > The script was running as user apache, but trying to open > /root/.matplotlib, and /root was mode 0700. It stopped > crashing on import after I made /root mode 0711. > > This is somewhat surprising behavior to me; shouldn't it be > defaulting to something besides expected access to ~root? > > On Fri, Aug 1, 2008 at 11:38 AM, Jonathan Hayward, > http://JonathansCorner.com <jon...@po... > <mailto:jon...@po...> > <mailto:jon...@po... > <mailto:jon...@po...>> > <mailto:jon...@po... > <mailto:jon...@po...> > <mailto:jon...@po... > <mailto:jon...@po...>>>> wrote: > > Tried that and reran it; I'm getting substantially > the same > stacktrace: > > > File "/home/jhayward/bintmp/test.py", line 5, in > <module> > import matplotlib; > File > > "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line > 639, in <module> > rcParams = rc_params() > File > > "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line > 562, in rc_params > fname = matplotlib_fname() > File > > "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line > 513, in matplotlib_fname > fname = os.path.join(get_configdir(), > 'matplotlibrc') > File > > "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line > 207, in wrapper > ret = func(*args, **kwargs) > File > > "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line > 403, in _get_configdir > raise RuntimeError("Failed to create %s/.matplotlib; > consider > setting MPLCONFIGDIR to a writable directory for > matplotlib > configuration data"%h) > RuntimeError: Failed to create /root/.matplotlib; > consider > setting > MPLCONFIGDIR to a writable directory for matplotlib > configuration data > > It's /path/matplotlibrc and not /path/.matplotlibrc > or anything > like that? > > > On Fri, Aug 1, 2008 at 10:51 AM, Michael Droettboom > <md...@st... <mailto:md...@st...> > <mailto:md...@st... <mailto:md...@st...>> > <mailto:md...@st... <mailto:md...@st...> > <mailto:md...@st... <mailto:md...@st...>>>> wrote: > > Just throwing out a suggestion here: You could try > putting a > matplotlibrc file in the same directory as your > Python > script > -- it will use that instead of the one in > ~/.matplotlib. > > Cheers, > Mike > > > "Jonathan Hayward, http://JonathansCorner.com" > wrote: > > I have a PHP script which authenticates a > user and I am > trying to get the PHP script to wrap a Python > script using > matplotlib. > > As it is, the script mostly works when > invoked from the > command line or as its own CGI script. When > I call > it from > a PHP script, it doesn't produce output, and > testing found > that when I call a Python script from a PHP > script, > output > works before but not after "import > matplotlib": if > the PHP > script calls a script of: > > #!/usr/bin/python > print "Before import matplotlib." > import matplotlib; > print "After import matplotlib." > > the first print statement succeeds but the > second one > fails; the server log shows a crash of: > > Before import matplotlib.Traceback (most recent > call last): > File "/home/jhayward/bintmp/test.py", line > 5, in > <module> > import matplotlib; > File > > "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", > line 639, in <module> > rcParams = rc_params() > File > > "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", > line 562, in rc_params > fname = matplotlib_fname() > File > > "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", > line 513, in matplotlib_fname > fname = os.path.join(get_configdir(), > 'matplotlibrc') > File > > "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", > line 207, in wrapper > ret = func(*args, **kwargs) > File > > "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", > line 403, in _get_configdir > raise RuntimeError("Failed to create > %s/.matplotlib; > consider setting MPLCONFIGDIR to a writable > directory for > matplotlib configuration data"%h) > RuntimeError: Failed to create > /root/.matplotlib; > consider > setting MPLCONFIGDIR to a writable directory for > matplotlib configuration data > > I think this error is somewhat misleading; > it persisted > after I ran a "chmod -R 1777 /root/.matplotlib". > > What is the proper way to adjust things so > matplotlib will > be happy with its .matplotlib directory? > > -- -- Jonathan Hayward, > chr...@gm... > <mailto:chr...@gm...> > <mailto:chr...@gm... > <mailto:chr...@gm...>> > <mailto:chr...@gm... > <mailto:chr...@gm...> > <mailto:chr...@gm... > <mailto:chr...@gm...>>> > <mailto:chr...@gm... > <mailto:chr...@gm...> > <mailto:chr...@gm... > <mailto:chr...@gm...>> > <mailto:chr...@gm... > <mailto:chr...@gm...> > <mailto:chr...@gm... > <mailto:chr...@gm...>>>> > > > ** To see an award-winning website with stories, > essays, > artwork, > ** games, and a four-dimensional maze, why > not visit my > home page? > ** All of this is waiting for you at > http://JonathansCorner.com > > ++ Would you like to curl up with one of my > hardcover books? > ++ You can now get my books from > http://CJSHayward.com > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------- > 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=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/> > > <http://moblin-contest.org/redirect.php?banner_id=100&url=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/>> > > <http://moblin-contest.org/redirect.php?banner_id=100&url=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/> > > <http://moblin-contest.org/redirect.php?banner_id=100&url=/ > <http://moblin-contest.org/redirect.php?banner_id=100&url=/>>> > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > <mailto:Mat...@li...> > <mailto:Mat...@li... > <mailto:Mat...@li...>> > > <mailto:Mat...@li... > <mailto:Mat...@li...> > <mailto:Mat...@li... > <mailto:Mat...@li...>>> > > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > > > > > -- -- Jonathan Hayward, > chr...@gm... > <mailto:chr...@gm...> > <mailto:chr...@gm... > <mailto:chr...@gm...>> > <mailto:chr...@gm... > <mailto:chr...@gm...> > <mailto:chr...@gm... > <mailto:chr...@gm...>>> > > ** To see an award-winning website with stories, essays, > artwork, > ** games, and a four-dimensional maze, why not visit my > home page? > ** All of this is waiting for you at > http://JonathansCorner.com > > ++ Would you like to curl up with one of my > hardcover books? > ++ You can now get my books from http://CJSHayward.com > > > > > -- -- Jonathan Hayward, > chr...@gm... > <mailto:chr...@gm...> > <mailto:chr...@gm... > <mailto:chr...@gm...>> > <mailto:chr...@gm... > <mailto:chr...@gm...> > <mailto:chr...@gm... > <mailto:chr...@gm...>>> > > ** To see an award-winning website with stories, > essays, artwork, > ** games, and a four-dimensional maze, why not visit my > home page? > ** All of this is waiting for you at > http://JonathansCorner.com > > ++ Would you like to curl up with one of my hardcover > books? > ++ You can now get my books from http://CJSHayward.com > > > -- Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > > > > > -- > -- Jonathan Hayward, chr...@gm... > <mailto:chr...@gm...> > <mailto:chr...@gm... > <mailto:chr...@gm...>> > > ** To see an award-winning website with stories, essays, artwork, > ** games, and a four-dimensional maze, why not visit my home page? > ** All of this is waiting for you at http://JonathansCorner.com > > ++ Would you like to curl up with one of my hardcover books? > ++ You can now get my books from http://CJSHayward.com > > > -- > Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > > > > > -- > -- Jonathan Hayward, chr...@gm... > <mailto:chr...@gm...> > > ** To see an award-winning website with stories, essays, artwork, > ** games, and a four-dimensional maze, why not visit my home page? > ** All of this is waiting for you at http://JonathansCorner.com > > ++ Would you like to curl up with one of my hardcover books? > ++ You can now get my books from http://CJSHayward.com -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
Hi all, Does anybody know how one gets a mpl_toolkits.basemap.Basemap map to automatically recognize when a feature has run off the end of the longitude range, and needs to wrap around and show up on the far side of a map having global extent? I have a bunch of linear features I'm trying to plot intelligently... and what happens now is, either the feature runs off the edge, and disappears, or, if I change the coordinates making up the object to all lie within the longitude range that the map contains, then I end up with a line going all the way across the map from one side to the other, connecting the two portions of the feature. There's this function "addcyclic", but I don't think it does what I want. Actually, I'm not exactly clear on what it does. Thanks for any insight you might have, Zane -- Zane Selvans Amateur Earthling http://zaneselvans.org za...@id... 303/815-6866 PGP Key: 55E0815F
It looks like an apache that thinks it's root: os.system("whoami") print "<br>" print os.geteuid() print "<br>" print os.getuid() print "<br>" print os.path.expanduser("~") print "<br>" print os.getenv("HOME") print "<br>" print os.getenv("USERPROFILE") print "<br>" print os.getenv("USER") print "<br>" print os.getenv("TMP") print "<br>" produces: apache 81 81 /root /root None root None So I should adjust the system so a confused apache-owned process that thinks it's root will run? Or are there features to ask PHP to spawn subprocesses that know who they're running as? (or is that something beside the point of this list?) On Fri, Aug 1, 2008 at 1:09 PM, Michael Droettboom <md...@st...> wrote: > Below is the code in mpl that actually does the lookup. To get to the > bottom of this, I would try to figure out in your Apache/PHP environment > what > > a) what os.path.expanduser("~") gives > > b) what the values of the environment variables "HOME", "USERPROFILE", > "USER", and "TMP" are. > > I suspect either matplotlib is not getting run under user 'apache' as it > should, or there is something fishy about the environment. > > Cheers, > Mike > > def _get_home(): > """Find user's home directory if possible. > Otherwise raise error. > > :see: > http://mail.python.org/pipermail/python-list/2005-February/263921.html > """ > path='' > try: > path=os.path.expanduser("~") > except: > pass > if not os.path.isdir(path): > for evar in ('HOME', 'USERPROFILE', 'TMP'): > try: > path = os.environ[evar] > if os.path.isdir(path): > break > except: pass > if path: > return path > else: > raise RuntimeError('please define environment variable $HOME') > > > > get_home = verbose.wrap('$HOME=%s', _get_home, always=False) > > def _get_configdir(): > """ > Return the string representing the configuration dir. > > default is HOME/.matplotlib. you can override this with the > MPLCONFIGDIR environment variable > """ > > configdir = os.environ.get('MPLCONFIGDIR') > if configdir is not None: > if not _is_writable_dir(configdir): > raise RuntimeError('Could not write to > MPLCONFIGDIR="%s"'%configdir) > return configdir > > h = get_home() > p = os.path.join(get_home(), '.matplotlib') > > if os.path.exists(p): > if not _is_writable_dir(p): > raise RuntimeError("'%s' is not a writable dir; you must set > %s/.matplotlib to be a writable dir. You can also set environment variable > MPLCONFIGDIR to any writable directory where you want matplotlib data stored > "% (h, h)) > else: > if not _is_writable_dir(h): > raise RuntimeError("Failed to create %s/.matplotlib; consider > setting MPLCONFIGDIR to a writable directory for matplotlib configuration > data"%h) > > os.mkdir(p) > > > "Jonathan Hayward, http://JonathansCorner.com" wrote: > >> User apache exists with home directory /var/www, which exists. >> >> On Fri, Aug 1, 2008 at 11:59 AM, Michael Droettboom <md...@st...<mailto: >> md...@st...>> wrote: >> >> It's supposed to default to the current user's home directory. >> Perhaps "apache" doesn't have a home directory? >> >> >> Cheers, >> Mike >> >> "Jonathan Hayward, http://JonathansCorner.com" wrote: >> >> I found a reason for the behavior: >> >> The script was running as user apache, but trying to open >> /root/.matplotlib, and /root was mode 0700. It stopped >> crashing on import after I made /root mode 0711. >> >> This is somewhat surprising behavior to me; shouldn't it be >> defaulting to something besides expected access to ~root? >> >> On Fri, Aug 1, 2008 at 11:38 AM, Jonathan Hayward, >> http://JonathansCorner.com <jon...@po... >> <mailto:jon...@po...> >> <mailto:jon...@po... >> <mailto:jon...@po...>>> wrote: >> >> Tried that and reran it; I'm getting substantially the same >> stacktrace: >> >> >> File "/home/jhayward/bintmp/test.py", line 5, in <module> >> import matplotlib; >> File >> >> "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line >> 639, in <module> >> rcParams = rc_params() >> File >> >> "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line >> 562, in rc_params >> fname = matplotlib_fname() >> File >> >> "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line >> 513, in matplotlib_fname >> fname = os.path.join(get_configdir(), 'matplotlibrc') >> File >> >> "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line >> 207, in wrapper >> ret = func(*args, **kwargs) >> File >> >> "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", line >> 403, in _get_configdir >> raise RuntimeError("Failed to create %s/.matplotlib; >> consider >> setting MPLCONFIGDIR to a writable directory for matplotlib >> configuration data"%h) >> RuntimeError: Failed to create /root/.matplotlib; consider >> setting >> MPLCONFIGDIR to a writable directory for matplotlib >> configuration data >> >> It's /path/matplotlibrc and not /path/.matplotlibrc or anything >> like that? >> >> >> On Fri, Aug 1, 2008 at 10:51 AM, Michael Droettboom >> <md...@st... <mailto:md...@st...> >> <mailto:md...@st... <mailto:md...@st...>>> wrote: >> >> Just throwing out a suggestion here: You could try >> putting a >> matplotlibrc file in the same directory as your Python >> script >> -- it will use that instead of the one in ~/.matplotlib. >> >> Cheers, >> Mike >> >> >> "Jonathan Hayward, http://JonathansCorner.com" wrote: >> >> I have a PHP script which authenticates a user and I am >> trying to get the PHP script to wrap a Python >> script using >> matplotlib. >> >> As it is, the script mostly works when invoked from the >> command line or as its own CGI script. When I call >> it from >> a PHP script, it doesn't produce output, and >> testing found >> that when I call a Python script from a PHP script, >> output >> works before but not after "import matplotlib": if >> the PHP >> script calls a script of: >> >> #!/usr/bin/python >> print "Before import matplotlib." >> import matplotlib; >> print "After import matplotlib." >> >> the first print statement succeeds but the second one >> fails; the server log shows a crash of: >> >> Before import matplotlib.Traceback (most recent >> call last): >> File "/home/jhayward/bintmp/test.py", line 5, in >> <module> >> import matplotlib; >> File >> >> "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", >> line 639, in <module> >> rcParams = rc_params() >> File >> >> "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", >> line 562, in rc_params >> fname = matplotlib_fname() >> File >> >> "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", >> line 513, in matplotlib_fname >> fname = os.path.join(get_configdir(), >> 'matplotlibrc') >> File >> >> "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", >> line 207, in wrapper >> ret = func(*args, **kwargs) >> File >> >> "/usr/lib64/python2.5/site-packages/matplotlib/__init__.py", >> line 403, in _get_configdir >> raise RuntimeError("Failed to create %s/.matplotlib; >> consider setting MPLCONFIGDIR to a writable >> directory for >> matplotlib configuration data"%h) >> RuntimeError: Failed to create /root/.matplotlib; >> consider >> setting MPLCONFIGDIR to a writable directory for >> matplotlib configuration data >> >> I think this error is somewhat misleading; it persisted >> after I ran a "chmod -R 1777 /root/.matplotlib". >> >> What is the proper way to adjust things so >> matplotlib will >> be happy with its .matplotlib directory? >> >> -- -- Jonathan Hayward, >> chr...@gm... >> <mailto:chr...@gm...> >> <mailto:chr...@gm... >> <mailto:chr...@gm...>> >> <mailto:chr...@gm... >> <mailto:chr...@gm...> >> <mailto:chr...@gm... >> <mailto:chr...@gm...>>> >> >> >> ** To see an award-winning website with stories, >> essays, >> artwork, >> ** games, and a four-dimensional maze, why not visit my >> home page? >> ** All of this is waiting for you at >> http://JonathansCorner.com >> >> ++ Would you like to curl up with one of my >> hardcover books? >> ++ You can now get my books from http://CJSHayward.com >> >> ------------------------------------------------------------------------ >> >> >> ------------------------------------------------------------------------- >> 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=/ >> <http://moblin-contest.org/redirect.php?banner_id=100&url=/> >> < >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> <mailto:Mat...@li...> >> <mailto:Mat...@li... >> <mailto:Mat...@li...>> >> >> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> -- Michael Droettboom >> Science Software Branch >> Operations and Engineering Division >> Space Telescope Science Institute >> Operated by AURA for NASA >> >> >> >> >> -- -- Jonathan Hayward, >> chr...@gm... >> <mailto:chr...@gm...> >> <mailto:chr...@gm... >> <mailto:chr...@gm...>> >> >> ** To see an award-winning website with stories, essays, >> artwork, >> ** games, and a four-dimensional maze, why not visit my >> home page? >> ** All of this is waiting for you at http://JonathansCorner.com >> >> ++ Would you like to curl up with one of my hardcover books? >> ++ You can now get my books from http://CJSHayward.com >> >> >> >> >> -- -- Jonathan Hayward, chr...@gm... >> <mailto:chr...@gm...> >> <mailto:chr...@gm... >> <mailto:chr...@gm...>> >> >> ** To see an award-winning website with stories, essays, artwork, >> ** games, and a four-dimensional maze, why not visit my home page? >> ** All of this is waiting for you at http://JonathansCorner.com >> >> ++ Would you like to curl up with one of my hardcover books? >> ++ You can now get my books from http://CJSHayward.com >> >> >> -- Michael Droettboom >> Science Software Branch >> Operations and Engineering Division >> Space Telescope Science Institute >> Operated by AURA for NASA >> >> >> >> >> -- >> -- Jonathan Hayward, chr...@gm... <mailto: >> chr...@gm...> >> >> ** To see an award-winning website with stories, essays, artwork, >> ** games, and a four-dimensional maze, why not visit my home page? >> ** All of this is waiting for you at http://JonathansCorner.com >> >> ++ Would you like to curl up with one of my hardcover books? >> ++ You can now get my books from http://CJSHayward.com >> > > -- > Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > > -- -- Jonathan Hayward, chr...@gm... ** To see an award-winning website with stories, essays, artwork, ** games, and a four-dimensional maze, why not visit my home page? ** All of this is waiting for you at http://JonathansCorner.com ++ Would you like to curl up with one of my hardcover books? ++ You can now get my books from http://CJSHayward.com