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
(10) |
2
(10) |
3
(9) |
4
(3) |
|
5
(2) |
6
(6) |
7
(12) |
8
(21) |
9
(4) |
10
(19) |
11
(7) |
|
12
(2) |
13
(28) |
14
(13) |
15
(27) |
16
(17) |
17
(21) |
18
(22) |
|
19
(3) |
20
(25) |
21
(17) |
22
(16) |
23
(28) |
24
(19) |
25
(4) |
|
26
(4) |
27
(23) |
28
(13) |
29
(15) |
30
(19) |
|
|
|
From: Eric F. <ef...@ha...> - 2010-09-10 22:32:10
|
On 09/10/2010 10:54 AM, Brian Larsen wrote: > Hello all, > > I feel like this is possible but I am having trouble figuring it out. > > I want to put extra labels on the ticks on the xaxis like in the upper > panel of the figure > http://sprg.ssl.berkeley.edu/fast/graphics/socfig1.gif > > Following > http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html > doesn't seem to be the right thing. > > It seems that I can get the tick values from > ax= gca() > ax.get_xticks() > > and from here do the calculations on what the other labels should be > (interpolate the spacecraft position). > > but then how do a create another row of labels with the values that > compute? For some reason > ax.get_xmajorticklabels()[0].get_text() returns '' > > Thanks much, > > Brian Brian, Tick labels can have multiple lines, so you don't need extra axes. If you don't mind setting the tick locations yourself, then you can do this: plot([1,2,3]) ax = gca() ax.set_xticks([0,1,2]) ax.set_xticklabels(['abc\nABC', 'def\nDEF\n123', 'qrz']) draw() # or show() if you are not in interactive mode If you need to have the ticks auto-generated using a Locator, then you can write a custom Formatter that does the calculations and generates the multi-line labels. Eric |
|
From: Brian L. <bal...@la...> - 2010-09-10 20:54:24
|
Hello all, I feel like this is possible but I am having trouble figuring it out. I want to put extra labels on the ticks on the xaxis like in the upper panel of the figure http://sprg.ssl.berkeley.edu/fast/graphics/socfig1.gif Following http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html doesn't seem to be the right thing. It seems that I can get the tick values from ax= gca() ax.get_xticks() and from here do the calculations on what the other labels should be (interpolate the spacecraft position). but then how do a create another row of labels with the values that compute? For some reason ax.get_xmajorticklabels()[0].get_text() returns '' Thanks much, Brian -- Brian A. Larsen Space Science and Applications Group ISR-1 Los Alamos National Laboratory PO Box 1663, MS-D466 Los Alamos, NM 87545 USA (For overnight add: SM-30, Bikini Atoll Road) Phone: 505-665-7691 Fax: 505-665-7395 email: bal...@la... Correspondence / Technical data or Software Publicly Available |
|
From: Jeff W. <js...@fa...> - 2010-09-10 20:09:51
|
On 9/10/10 11:06 AM, izzybitsie wrote: > Hi, > I'm new to matplotlib and I'm looking for an easy way to plot geographical > data on a background map: bkgmap.png > http://old.nabble.com/file/p29679002/bkgmap.png > So far I only found out about warpimage() to do this but only part of > bkgmap.png comes up in the output image. I think this is because this image > has no pixels covering all the world. > http://old.nabble.com/file/p29679002/partialbkg_polygon.png > > Any idea on how to insert this image as background? > THANKS > > Code: the polygon displays in right position even though background doesn't > show OK (tested with map,lat/lon lines drawn too) > > import sys > import Image, ImageDraw # PIL > from matplotlib.patches import Polygon > from mpl_toolkits.basemap import Basemap > import matplotlib.image as mpimg > import matplotlib.pyplot as plt > import numpy as np > > lat0=48 > lon0=13 > lllon=-15 > lllat=20 > urlon=73 > urlat=57 > map = > Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, > resolution='c',area_thresh=1000.) > map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) > # points > lat = [50.,55.,45.,40.,50.] > lon = [-20.,-10.,10.,-10.,-20.] > x0,y0 = map(lon[0],lat[0]) > x1,y1 = map(lon[1],lat[1]) > x2,y2 = map(lon[2],lat[2]) > x3,y3 = map(lon[3],lat[3]) > x4,y4 = map(lon[4],lat[4]) > plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) > plt.show() Here is an example of how to make this work if the map projection on the image is exactly the same as the map projection in Basemap: import sys import Image, ImageDraw # PIL from matplotlib.patches import Polygon from mpl_toolkits.basemap import Basemap import matplotlib.image as mpimg import matplotlib.pyplot as plt import numpy as np from matplotlib.image import pil_to_array lat0=48 lon0=13 lllon=-15 lllat=20 urlon=73 urlat=57 map =\ Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, resolution='l') #map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) pilImage = Image.open('bkgmap.png') rgba = pil_to_array(pilImage) im = map.imshow(rgba) # points lat = [50.,55.,45.,40.,50.] lon = [-20.,-10.,10.,-10.,-20.] x0,y0 = map(lon[0],lat[0]) x1,y1 = map(lon[1],lat[1]) x2,y2 = map(lon[2],lat[2]) x3,y3 = map(lon[3],lat[3]) x4,y4 = map(lon[4],lat[4]) plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) map.drawmapboundary() map.drawcoastlines() plt.show() Note that the coastlines drawn by drawcoastlines don't match the coastlines in the image (attached png). This means the Basemap projection doesn't match the image projection. Unless you can make them match, you'll have to write your own transformations. Of course, you can't write your own transformation unless you know exactly what the map projection of the image is, so the simplest approach will be to make the Basemap projection match the image. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: Oz N. <na...@gm...> - 2010-09-10 19:55:51
|
Hi Everyone,
First I must cryout a little bit :-) Why colorbar is always so tricky ???
I'm trying to fine tune the colorbar of my contour plots.
I would like to do the following things:
1) remove the box around it
2) hide the xticks
3) make the lines with the indicating colors with custom widths
so far I succeeded only with task 2 !
here is what I did:
cs=axs[4].contour(x,y,phcr1t,linestyles='solid',cmap=cm.jet_r)
a=fig.colorbar(cs,ax=axs[4],orientation='horizontal')
ticks = a.ax.get_xticklines()
#print getp(a.ax)
for tick in ticks:
setp(tick,alpha=0)
Would be great if someone could tell me how to do the 2 other things ...
Many thanks
--
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen
---
Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
|
|
From: Jan S. <jan...@gm...> - 2010-09-10 19:19:35
|
On Fri, Sep 10, 2010 at 14:46, izzybitsie <is...@ju...> wrote: > I did not understand the need for me to write my own transformation > functions. I only used lat/lon->x/y for the points in the curve and the > polygon shows up OK. What should I write my own transformations for? Because matplotlib (and possibly any other tool out there) have absolutely no idea what transformation have you used to generate your background picture in the first place. If you want to match grid of coordinates of you picture with the grid of coordinates of what you are trying to plot on top of it, you have to input this information somehow. And one possible way of doing this is taking a transformation function which will be exactly the same as one used to generate your background. I do not think there is some other, magical way of doing this. This is not a matplotlib specific problem, it is a general problem. But maybe someone else will correct me if I am wrong. JS |
|
From: izzybitsie <is...@ju...> - 2010-09-10 18:47:04
|
I tested the same plot with a background image in Mercator with same results and I also tested with Mercator covering almost the entire world with the same results. Only a little portion of the background image shows as background although the polygon looks OK in all cases (with maps drawn and with either background image). Unfortunately, I must use the provided background images for my project. I may need to look for some other tool to accomplish drawing curves on a provided background image instead of relying on matplotlib. I did not understand the need for me to write my own transformation functions. I only used lat/lon->x/y for the points in the curve and the polygon shows up OK. What should I write my own transformations for? THANKS izzybitsie wrote: > > Thanks for your answer. I'm actually looking to plot filled curves whose > points are lat/lon points on top of a given background map. The problem > experienced is misrepresentation of background map when I insert it using > warpimage(), the only function to do this I found so far. > > > Aman Thakral wrote: >> >> If you're just looking for points, you can use ax.scatter(). It will >> plot >> the points. Also, make sure you set the zorder keyword argument in the >> scatter. >> >> Example: >> x=range(10) >> y=range(10) >> z=range(10,20) >> ax.scatter(x,y,c=z,zorder=10) >> >> Hope this helps, >> Aman >> >> On Fri, Sep 10, 2010 at 1:06 PM, izzybitsie <is...@ju...> wrote: >> >>> >>> Hi, >>> I'm new to matplotlib and I'm looking for an easy way to plot >>> geographical >>> data on a background map: bkgmap.png >>> http://old.nabble.com/file/p29679002/bkgmap.png >>> So far I only found out about warpimage() to do this but only part of >>> bkgmap.png comes up in the output image. I think this is because this >>> image >>> has no pixels covering all the world. >>> http://old.nabble.com/file/p29679002/partialbkg_polygon.png >>> >>> Any idea on how to insert this image as background? >>> THANKS >>> >>> Code: the polygon displays in right position even though background >>> doesn't >>> show OK (tested with map,lat/lon lines drawn too) >>> >>> import sys >>> import Image, ImageDraw # PIL >>> from matplotlib.patches import Polygon >>> from mpl_toolkits.basemap import Basemap >>> import matplotlib.image as mpimg >>> import matplotlib.pyplot as plt >>> import numpy as np >>> >>> lat0=48 >>> lon0=13 >>> lllon=-15 >>> lllat=20 >>> urlon=73 >>> urlat=57 >>> map = >>> >>> Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, >>> resolution='c',area_thresh=1000.) >>> map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) >>> # points >>> lat = [50.,55.,45.,40.,50.] >>> lon = [-20.,-10.,10.,-10.,-20.] >>> x0,y0 = map(lon[0],lat[0]) >>> x1,y1 = map(lon[1],lat[1]) >>> x2,y2 = map(lon[2],lat[2]) >>> x3,y3 = map(lon[3],lat[3]) >>> x4,y4 = map(lon[4],lat[4]) >>> >>> plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) >>> plt.show() >>> -- >>> View this message in context: >>> http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679002.html >>> Sent from the matplotlib - users mailing list archive at Nabble.com. >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Start uncovering the many advantages of virtual appliances >>> and start using them to simplify application deployment and >>> accelerate your shift to cloud computing >>> http://p.sf.net/sfu/novell-sfdev2dev >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >> >> >> -- >> Aman Thakral >> B.Eng & Biosci, M.Eng Design >> >> ------------------------------------------------------------------------------ >> Start uncovering the many advantages of virtual appliances >> and start using them to simplify application deployment and >> accelerate your shift to cloud computing >> http://p.sf.net/sfu/novell-sfdev2dev >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > -- View this message in context: http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679934.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Jan S. <jan...@gm...> - 2010-09-10 18:24:13
|
Hi, documentation of mpl_toolkits.basemap.warpimage (http://matplotlib.sourceforge.net/basemap/doc/html/api/basemap_api.html#mpl_toolkits.basemap.Basemap.warpimage) states that it could only be used with a very specific set of images: "Specified image must have pixels covering the whole globe in a regular lat/lon grid, starting and -180W and the South Pole.", so your image won't work - it is curved, there is no obvious (linear) transformation from (x,y) to (lat, long). Examples of good images are given here: http://earthobservatory.nasa.gov/Features/BlueMarble/BlueMarble_monthlies.php There are easy ways to mimic your picture with native Basemap tools, like in this examples: http://matplotlib.sourceforge.net/basemap/doc/html/users/geography.html But if you would specifically use your own image, the only way I see is to come up with a transformation function transforming lat and long coordinates to x,y coordinates of your specific picture. If you would write such a function yourself than you could easily use ax.plot, ax.scatter or any other plotting routine to place stuff in correct place in respect to your picture. Giving (lat, long) of stuff you would like to draw, than transforming to (x,y) with the function, and than using those with plotting routines at the same axis you have place your picture, with for example imshow routine with proper zorder. Hope this clears a problem a little bit, JS On Fri, Sep 10, 2010 at 13:06, izzybitsie <is...@ju...> wrote: > > Hi, > I'm new to matplotlib and I'm looking for an easy way to plot geographical > data on a background map: bkgmap.png > http://old.nabble.com/file/p29679002/bkgmap.png > So far I only found out about warpimage() to do this but only part of > bkgmap.png comes up in the output image. I think this is because this image > has no pixels covering all the world. > http://old.nabble.com/file/p29679002/partialbkg_polygon.png > > Any idea on how to insert this image as background? > THANKS > > Code: the polygon displays in right position even though background doesn't > show OK (tested with map,lat/lon lines drawn too) > > import sys > import Image, ImageDraw # PIL > from matplotlib.patches import Polygon > from mpl_toolkits.basemap import Basemap > import matplotlib.image as mpimg > import matplotlib.pyplot as plt > import numpy as np > > lat0=48 > lon0=13 > lllon=-15 > lllat=20 > urlon=73 > urlat=57 > map = > Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, > resolution='c',area_thresh=1000.) > map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) > # points > lat = [50.,55.,45.,40.,50.] > lon = [-20.,-10.,10.,-10.,-20.] > x0,y0 = map(lon[0],lat[0]) > x1,y1 = map(lon[1],lat[1]) > x2,y2 = map(lon[2],lat[2]) > x3,y3 = map(lon[3],lat[3]) > x4,y4 = map(lon[4],lat[4]) > plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) > plt.show() > -- > View this message in context: http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679002.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: izzybitsie <is...@ju...> - 2010-09-10 18:23:55
|
Thanks for your answer. I'm actually looking to plot filled curves whose points are lat/lon points on top of a given background map. The problem experienced is misrepresentation of background map when I insert it using warpimage(), the only function to do this I found so far. Aman Thakral wrote: > > If you're just looking for points, you can use ax.scatter(). It will plot > the points. Also, make sure you set the zorder keyword argument in the > scatter. > > Example: > x=range(10) > y=range(10) > z=range(10,20) > ax.scatter(x,y,c=z,zorder=10) > > Hope this helps, > Aman > > On Fri, Sep 10, 2010 at 1:06 PM, izzybitsie <is...@ju...> wrote: > >> >> Hi, >> I'm new to matplotlib and I'm looking for an easy way to plot >> geographical >> data on a background map: bkgmap.png >> http://old.nabble.com/file/p29679002/bkgmap.png >> So far I only found out about warpimage() to do this but only part of >> bkgmap.png comes up in the output image. I think this is because this >> image >> has no pixels covering all the world. >> http://old.nabble.com/file/p29679002/partialbkg_polygon.png >> >> Any idea on how to insert this image as background? >> THANKS >> >> Code: the polygon displays in right position even though background >> doesn't >> show OK (tested with map,lat/lon lines drawn too) >> >> import sys >> import Image, ImageDraw # PIL >> from matplotlib.patches import Polygon >> from mpl_toolkits.basemap import Basemap >> import matplotlib.image as mpimg >> import matplotlib.pyplot as plt >> import numpy as np >> >> lat0=48 >> lon0=13 >> lllon=-15 >> lllat=20 >> urlon=73 >> urlat=57 >> map = >> >> Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, >> resolution='c',area_thresh=1000.) >> map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) >> # points >> lat = [50.,55.,45.,40.,50.] >> lon = [-20.,-10.,10.,-10.,-20.] >> x0,y0 = map(lon[0],lat[0]) >> x1,y1 = map(lon[1],lat[1]) >> x2,y2 = map(lon[2],lat[2]) >> x3,y3 = map(lon[3],lat[3]) >> x4,y4 = map(lon[4],lat[4]) >> >> plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) >> plt.show() >> -- >> View this message in context: >> http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679002.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> >> ------------------------------------------------------------------------------ >> Start uncovering the many advantages of virtual appliances >> and start using them to simplify application deployment and >> accelerate your shift to cloud computing >> http://p.sf.net/sfu/novell-sfdev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > > > -- > Aman Thakral > B.Eng & Biosci, M.Eng Design > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing > http://p.sf.net/sfu/novell-sfdev2dev > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679748.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Aman T. <ama...@gm...> - 2010-09-10 17:46:28
|
If you're just looking for points, you can use ax.scatter(). It will plot the points. Also, make sure you set the zorder keyword argument in the scatter. Example: x=range(10) y=range(10) z=range(10,20) ax.scatter(x,y,c=z,zorder=10) Hope this helps, Aman On Fri, Sep 10, 2010 at 1:06 PM, izzybitsie <is...@ju...> wrote: > > Hi, > I'm new to matplotlib and I'm looking for an easy way to plot geographical > data on a background map: bkgmap.png > http://old.nabble.com/file/p29679002/bkgmap.png > So far I only found out about warpimage() to do this but only part of > bkgmap.png comes up in the output image. I think this is because this > image > has no pixels covering all the world. > http://old.nabble.com/file/p29679002/partialbkg_polygon.png > > Any idea on how to insert this image as background? > THANKS > > Code: the polygon displays in right position even though background doesn't > show OK (tested with map,lat/lon lines drawn too) > > import sys > import Image, ImageDraw # PIL > from matplotlib.patches import Polygon > from mpl_toolkits.basemap import Basemap > import matplotlib.image as mpimg > import matplotlib.pyplot as plt > import numpy as np > > lat0=48 > lon0=13 > lllon=-15 > lllat=20 > urlon=73 > urlat=57 > map = > > Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, > resolution='c',area_thresh=1000.) > map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) > # points > lat = [50.,55.,45.,40.,50.] > lon = [-20.,-10.,10.,-10.,-20.] > x0,y0 = map(lon[0],lat[0]) > x1,y1 = map(lon[1],lat[1]) > x2,y2 = map(lon[2],lat[2]) > x3,y3 = map(lon[3],lat[3]) > x4,y4 = map(lon[4],lat[4]) > > plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) > plt.show() > -- > View this message in context: > http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679002.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Aman Thakral B.Eng & Biosci, M.Eng Design |
|
From: izzybitsie <is...@ju...> - 2010-09-10 17:06:50
|
Hi, I'm new to matplotlib and I'm looking for an easy way to plot geographical data on a background map: bkgmap.png http://old.nabble.com/file/p29679002/bkgmap.png So far I only found out about warpimage() to do this but only part of bkgmap.png comes up in the output image. I think this is because this image has no pixels covering all the world. http://old.nabble.com/file/p29679002/partialbkg_polygon.png Any idea on how to insert this image as background? THANKS Code: the polygon displays in right position even though background doesn't show OK (tested with map,lat/lon lines drawn too) import sys import Image, ImageDraw # PIL from matplotlib.patches import Polygon from mpl_toolkits.basemap import Basemap import matplotlib.image as mpimg import matplotlib.pyplot as plt import numpy as np lat0=48 lon0=13 lllon=-15 lllat=20 urlon=73 urlat=57 map = Basemap(projection='stere',lat_0=lat0,lon_0=lon0,llcrnrlon=lllon,llcrnrlat=lllat,urcrnrlon=urlon,urcrnrlat=urlat, resolution='c',area_thresh=1000.) map.warpimage(image='bkgmap.png',scale=None,ax=plt.gca()) # points lat = [50.,55.,45.,40.,50.] lon = [-20.,-10.,10.,-10.,-20.] x0,y0 = map(lon[0],lat[0]) x1,y1 = map(lon[1],lat[1]) x2,y2 = map(lon[2],lat[2]) x3,y3 = map(lon[3],lat[3]) x4,y4 = map(lon[4],lat[4]) plt.gca().add_patch(Polygon([(x0,y0),(x1,y1),(x2,y2),(x3,y3),(x4,y4)],fill=1,facecolor='red',edgecolor='black')) plt.show() -- View this message in context: http://old.nabble.com/matplotlib-basemap-plot-geo-data-on-background-map-tp29679002p29679002.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Ted K. <ted...@gm...> - 2010-09-10 16:33:02
|
Hi Tony
Thanks. Works perfectly!
Ted
On 10 September 2010 15:54, Tony S Yu <ts...@gm...> wrote:
>
> On Sep 10, 2010, at 10:42 AM, Ted Kord wrote:
>
> > Hi
> >
> > How can I:
> >
> > 1. make the frame of the plot thicker and
> > 2. remove the top and right of the frame.
> >
> > Thanks
> >
> > Ted
>
> There are probably a number of ways to do this (partly because spines are
> relatively new). Here's one possibility:
>
> import matplotlib.pyplot as plt
>
> f, ax = plt.subplots()
> ax.plot([0, 1])
> ax.spines['right'].set_visible(False)
> ax.spines['top'].set_visible(False)
> ax.xaxis.set_ticks_position('bottom')
> ax.yaxis.set_ticks_position('left')
> ax.spines['bottom'].set_linewidth(3)
> ax.spines['left'].set_linewidth(3)
> plt.show()
>
> Best,
> -Tony
>
>
|
|
From: Tony S Yu <ts...@gm...> - 2010-09-10 14:55:07
|
On Sep 10, 2010, at 10:42 AM, Ted Kord wrote:
> Hi
>
> How can I:
>
> 1. make the frame of the plot thicker and
> 2. remove the top and right of the frame.
>
> Thanks
>
> Ted
There are probably a number of ways to do this (partly because spines are relatively new). Here's one possibility:
import matplotlib.pyplot as plt
f, ax = plt.subplots()
ax.plot([0, 1])
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
ax.spines['bottom'].set_linewidth(3)
ax.spines['left'].set_linewidth(3)
plt.show()
Best,
-Tony
|
|
From: Ted K. <ted...@gm...> - 2010-09-10 14:42:44
|
Hi How can I: 1. make the frame of the plot thicker and 2. remove the top and right of the frame. Thanks Ted |
|
From: Yannis H. <yan...@te...> - 2010-09-10 14:36:25
|
dear Matplotlib users, I can't manage to install matplotlib correctly on MacOS X 10.6.4. when I launch the DMG installer matplotlib-1.0.0-python.org-py2.6-macosx10.4.mpkg I get an error message, that my volume does not contain "System Python 2.6". I'm running a standard MacOS X 10.6.4 with python 2.6.1 running from /usr/bin And I do have Python 2.6 installed in /System/Library/Frameworks/Python.framework/Versions/2.6 Why does the installer doesn't sees it? The reason I wanted to install matplotlib directly from DMG is that when I built it from source and then tried to use it, I got the error: Traceback (most recent call last): File "./herbscmd.py", line 163, in <module> sys.exit(main(sys.argv)) File "./herbscmd.py", line 156, in main from matplotlib.pylab import show,draw File "/Library/Python/2.6/site-packages/matplotlib/pylab.py", line 216, in <module> from matplotlib import mpl # pulls in most modules File "/Library/Python/2.6/site-packages/matplotlib/mpl.py", line 2, in <module> from matplotlib import axis File "/Library/Python/2.6/site-packages/matplotlib/axis.py", line 10, in <module> import matplotlib.font_manager as font_manager File "/Library/Python/2.6/site-packages/matplotlib/font_manager.py", line 52, in <module> from matplotlib import ft2font ImportError: dlopen(/Library/Python/2.6/site-packages/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File Referenced from: /Library/Python/2.6/site-packages/matplotlib/ft2font.so Expected in: flat namespace in /Library/Python/2.6/site-packages/matplotlib/ft2font.so I noticed that many people had that same error (just google on _FT_Attach_File, you will see) but I couldn't find a solution anywhere. This is why I turned to DMG installation, but it doesn't seem to work either. Could anyone help? Thanks in advance! -- ------------------------------------------------------- Yannis Haralambous Directeur d'études Institut Télécom, Télécom Bretagne Département Informatique UMR CNRS 3192 Lab-STICC Technopôle Brest Iroise CS 83818, 29238 Brest Cedex 3, France Tel: +33 2 29 00 14 27 Fax: +33 2 29 00 12 82 Email: yan...@te... Internet: http://omega.enstb.org/yannis ICBM address: 48°21'31.57"N 4°34'16.76"W ------------------------------------------------------- ...pour distinguer l'extérieur d'un aquarium, mieux vaut n'être pas poisson ...the ball I threw while playing in the park has not yet reached the ground Es gab eine Zeit, wo ich nur ungern über Schubert sprechen, nur Nächtens den Bäumen und Sternen von ihm vorerzählen mögen. |
|
From: Benjamin R. <ben...@ou...> - 2010-09-10 13:44:08
|
On Fri, Sep 10, 2010 at 4:27 AM, Nils Wagner
<nw...@ia...>wrote:
> Hi all,
>
> what is needed to save a figure when the size is given in
> pixels, i.e. 1024x772 ?
> The default is 800x600 pixels.
>
> from pylab import plot, savefig
> from numpy import sin,linspace,pi
> x = linspace(0,2*pi,200)
> plot(x,sin(x))
> savefig('test')
>
> Nils
>
>
Nils,
In matplotlib, you can specify a figure size in inches like so:
import matplotlib.pyplot as plt
from numpy import sin,linspace,pi
width_in = 10.0
width_px = 1024
height_px = 772
aspect = width_px / float(height_px)
height_in = width_in / aspect
dpi = width_px / width_in
x = linspace(0, 2*pi, 200)
fig = plt.figure(figsize=(width_in, height_in))
ax = fig.gca()
ax.plot(x, sin(x))
Then, when you save your figure, you can specify the "dots per inch" (dpi):
fig.savefig('test.png', dpi=dpi)
I hope this helps!
Ben Root
|
|
From: Tony S Yu <ts...@gm...> - 2010-09-10 13:39:45
|
On Sep 10, 2010, at 5:27 AM, Nils Wagner wrote:
> Hi all,
>
> what is needed to save a figure when the size is given in
> pixels, i.e. 1024x772 ?
> The default is 800x600 pixels.
>
> from pylab import plot, savefig
> from numpy import sin,linspace,pi
> x = linspace(0,2*pi,200)
> plot(x,sin(x))
> savefig('test')
>
> Nils
You can try creating a figure with the correct aspect ratio and then setting a corresponding dpi when you save:
#---
import matplotlib.pyplot as plt
import numpy as np
plt.figure(figsize=(10.24, 7.72))
x = np.linspace(0,2*np.pi,200)
plt.plot(x, np.sin(x))
plt.savefig('test', dpi=100)
#---
I had mixed results with this: I would occasionally get figures that were one pixel smaller than desired.
Best,
-Tony
|
|
From: Benjamin R. <ben...@ou...> - 2010-09-10 13:31:17
|
On Fri, Sep 10, 2010 at 4:44 AM, sa6113 <s.p...@gm...> wrote:
>
> when I want to show the plot canvas, it doesn't stay at all, note that I
> need
> to use "backendQtagg", I mean when I use "pylab" there is no problem in
> showing the plot canvas, what is the problem? please help me.
> I use this simple code:
> "
> from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as
> FigureCanvas
> from matplotlib.figure import Figure
>
> x = numarray.arange(10)
> y = numarray.arange(10)
> fig = Figure(figsize=(5, 5))
>
> axes = fig.add_subplot(111)
> axes.plot(x,y)
> canvas = FigureCanvas( fig)
> xlabel('sahar')
> canvas.show()
> "
> The plot just winks.
>
This is just a complete guess, but I wonder if you might be having
conflicting backends. Try adding this to the beginning of your code.
import matplotlib
matplotlib.use('QtAgg')
Also, I wonder if you should be using Qt4Agg?
Ben Root
|
|
From: sa6113 <s.p...@gm...> - 2010-09-10 09:44:44
|
when I want to show the plot canvas, it doesn't stay at all, note that I need
to use "backendQtagg", I mean when I use "pylab" there is no problem in
showing the plot canvas, what is the problem? please help me.
I use this simple code:
"
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as
FigureCanvas
from matplotlib.figure import Figure
x = numarray.arange(10)
y = numarray.arange(10)
fig = Figure(figsize=(5, 5))
axes = fig.add_subplot(111)
axes.plot(x,y)
canvas = FigureCanvas( fig)
xlabel('sahar')
canvas.show()
"
The plot just winks.
--
View this message in context: http://old.nabble.com/problem-in-showing-the-plot%21%21%21-tp29675128p29675128.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: Nils W. <nw...@ia...> - 2010-09-10 09:27:48
|
Hi all,
what is needed to save a figure when the size is given in
pixels, i.e. 1024x772 ?
The default is 800x600 pixels.
from pylab import plot, savefig
from numpy import sin,linspace,pi
x = linspace(0,2*pi,200)
plot(x,sin(x))
savefig('test')
Nils
|