SF.net SVN: matplotlib: [4428] trunk/py4science/examples
Revision: 4428 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4428&view=rev Author: jswhit Date: 2007-11-23 09:54:40 -0800 (Fri, 23 Nov 2007) Log Message: --- update basemap example Modified Paths: -- trunk/py4science/examples/basemap5.py trunk/py4science/examples/skel/basemap5_skel.py Modified: trunk/py4science/examples/basemap5.py === --- trunk/py4science/examples/basemap5.py 2007-11-23 13:47:36 UTC (rev 4427) +++ trunk/py4science/examples/basemap5.py 2007-11-23 17:54:40 UTC (rev 4428) @@ -22,12 +22,9 @@ # create Basemap instance for mollweide projection. # coastlines not used, so resolution set to None to skip # continent processing (this speeds things up a bit) -m = Basemap(projection='moll',lon_0=lon_0,lat_0=lat_0,resolution='l') +m = Basemap(projection='moll',lon_0=lon_0,lat_0=lat_0,resolution=None) # compute map projection coordinates of grid. x, y = m(*numpy.meshgrid(lons, lats)) -# plot with contour -#CS = m.contour(x,y,sst,20,linewidths=0.5,colors='k') -#CS = m.contourf(x,y,sst,20,cmap=cmap) # plot with pcolor im = m.pcolormesh(x,y,sst,shading='flat',cmap=cmap) # draw parallels and meridians, but don't bother labelling them. Modified: trunk/py4science/examples/skel/basemap5_skel.py === --- trunk/py4science/examples/skel/basemap5_skel.py 2007-11-23 13:47:36 UTC (rev 4427) +++ trunk/py4science/examples/skel/basemap5_skel.py 2007-11-23 17:54:40 UTC (rev 4428) @@ -30,9 +30,6 @@ m = Basemap(projection=projection,lon_0=lon_0,lat_0=lat_0,resolution=None) # compute map projection coordinates of grid. x, y = m(*numpy.meshgrid(lons, lats)) -# plot with contour -#CS = m.contour(x,y,sst,20,linewidths=0.5,colors='k') -#CS = m.contourf(x,y,sst,20,cmap=cmap) # plot with pcolor im = m.pcolormesh(x,y,sst,shading='flat',cmap=cmap) # draw parallels and meridians, but don't bother labelling them. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4427] trunk/py4science/workbook/fig
Revision: 4427 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4427&view=rev Author: jswhit Date: 2007-11-23 05:47:36 -0800 (Fri, 23 Nov 2007) Log Message: --- update basemap example Modified Paths: -- trunk/py4science/workbook/fig/basemap5.pdf trunk/py4science/workbook/fig/basemap5.png Modified: trunk/py4science/workbook/fig/basemap5.pdf === (Binary files differ) Modified: trunk/py4science/workbook/fig/basemap5.png === (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4426] trunk/py4science/workbook/basemap.tex
Revision: 4426
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4426&view=rev
Author: jswhit
Date: 2007-11-23 05:45:55 -0800 (Fri, 23 Nov 2007)
Log Message:
---
remove spurious pagebreak
Modified Paths:
--
trunk/py4science/workbook/basemap.tex
Modified: trunk/py4science/workbook/basemap.tex
===
--- trunk/py4science/workbook/basemap.tex 2007-11-23 13:38:46 UTC (rev
4425)
+++ trunk/py4science/workbook/basemap.tex 2007-11-23 13:45:55 UTC (rev
4426)
@@ -107,8 +107,6 @@
The resulting plot should look like Figure 4.
-\pagebreak
-
\begin{figure}[h]
\includegraphics[scale=0.75]{fig/basemap5}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4425] trunk/py4science/examples/basemap5.py
Revision: 4425
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4425&view=rev
Author: jswhit
Date: 2007-11-23 05:38:46 -0800 (Fri, 23 Nov 2007)
Log Message:
---
update example
Modified Paths:
--
trunk/py4science/examples/basemap5.py
Modified: trunk/py4science/examples/basemap5.py
===
--- trunk/py4science/examples/basemap5.py 2007-11-23 13:38:18 UTC (rev
4424)
+++ trunk/py4science/examples/basemap5.py 2007-11-23 13:38:46 UTC (rev
4425)
@@ -16,7 +16,12 @@
lat_0 = lats.mean()
# set colormap
cmap = pylab.cm.gist_ncar
+# set so masked values in an image will be black
+# (i.e. continents will be painted this color)
+cmap.set_bad('k')
# create Basemap instance for mollweide projection.
+# coastlines not used, so resolution set to None to skip
+# continent processing (this speeds things up a bit)
m = Basemap(projection='moll',lon_0=lon_0,lat_0=lat_0,resolution='l')
# compute map projection coordinates of grid.
x, y = m(*numpy.meshgrid(lons, lats))
@@ -25,9 +30,7 @@
#CS = m.contourf(x,y,sst,20,cmap=cmap)
# plot with pcolor
im = m.pcolormesh(x,y,sst,shading='flat',cmap=cmap)
-# fill the continents (data is not defined there).
-m.fillcontinents(color='k',lake_color='k')
-# draw parallels and meridians.
+# draw parallels and meridians, but don't bother labelling them.
m.drawparallels(numpy.arange(-90.,120.,30.))
m.drawmeridians(numpy.arange(0.,420.,60.))
# draw line around map projection limb.
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4429] trunk/toolkits/basemap
Revision: 4429
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4429&view=rev
Author: jswhit
Date: 2007-11-23 10:07:27 -0800 (Fri, 23 Nov 2007)
Log Message:
---
added 'sstanom' colormap.
Modified Paths:
--
trunk/toolkits/basemap/Changelog
trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/cm.py
Modified: trunk/toolkits/basemap/Changelog
===
--- trunk/toolkits/basemap/Changelog2007-11-23 17:54:40 UTC (rev 4428)
+++ trunk/toolkits/basemap/Changelog2007-11-23 18:07:27 UTC (rev 4429)
@@ -1,3 +1,5 @@
+ * added 'sstanom' colormap from
+ http://www.ghrsst-pp.org/GHRSST-PP-Data-Tools.html
version 0.9.7 (svn revision 4422)
* fixed bug in drawlsmask for 'moll','robin' and 'sinu'
projections.
Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/cm.py
===
--- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/cm.py
2007-11-23 17:54:40 UTC (rev 4428)
+++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/cm.py
2007-11-23 18:07:27 UTC (rev 4429)
@@ -45,6 +45,8 @@
s3pcpn = colors.LinearSegmentedColormap('s3pcpn', _s3pcpn_data, _LUTSIZE)
s3pcpn_l = colors.LinearSegmentedColormap('s3pcpn_l', _s3pcpn_l_data, _LUTSIZE)
StepSeq = colors.LinearSegmentedColormap('StepSeq', _StepSeq_data, _LUTSIZE)
+_sstanom_data = {'blue': [(0.0, 0.858823537827, 0.858823537827),
(0.0243902429938, 0.835294127464, 0.835294127464), (0.0487804859877,
0.815686285496, 0.815686285496), (0.0731707289815, 0.78823530674,
0.78823530674), (0.0975609719753, 0.819607853889, 0.819607853889),
(0.12195122242, 0.882352948189, 0.882352948189), (0.146341457963,
0.945098042488, 0.945098042488), (0.170731708407, 1.0, 1.0), (0.195121943951,
1.0, 1.0), (0.219512194395, 1.0, 1.0), (0.243902444839, 1.0, 1.0),
(0.268292695284, 0.886274516582, 0.886274516582), (0.292682915926,
0.745098054409, 0.745098054409), (0.31707316637, 0.603921592236,
0.603921592236), (0.341463416815, 0.51372551918, 0.51372551918),
(0.365853667259, 0.552941203117, 0.552941203117), (0.390243887901,
0.588235318661, 0.588235318661), (0.414634138346, 0.623529434204,
0.623529434204), (0.43902438879, 0.658823549747, 0.658823549747),
(0.463414639235, 0.694117665291, 0.694117665291), (0.487804889679,
0.729411780834, 0.729411780834), (0.51219511032
1, 0.717647075653, 0.717647075653), (0.536585390568, 0.658823549747,
0.658823549747), (0.56097561121, 0.603921592236, 0.603921592236),
(0.585365831852, 0.537254929543, 0.537254929543), (0.609756112099,
0.380392163992, 0.380392163992), (0.634146332741, 0.227450981736,
0.227450981736), (0.658536612988, 0.0431372560561, 0.0431372560561),
(0.68292683363, 0.0, 0.0), (0.707317054272, 0.0, 0.0), (0.731707334518, 0.0,
0.0), (0.756097555161, 0.0, 0.0), (0.780487775803, 0.0, 0.0), (0.804878056049,
0.0, 0.0), (0.829268276691, 0.0, 0.0), (0.853658556938, 0.145098045468,
0.145098045468), (0.87804877758, 0.309803932905, 0.309803932905),
(0.902438998222, 0.478431373835, 0.478431373835), (0.926829278469,
0.529411792755, 0.529411792755), (0.951219499111, 0.33343267,
0.33343267), (0.975609779358, 0.168627455831, 0.168627455831), (1.0, 0.0,
0.0)], 'green': [(0.0, 0.0, 0.0), (0.0243902429938, 0.0, 0.0),
(0.0487804859877, 0.0, 0.0), (0.0731707289815, 0.0, 0.0), (0.0975609719753,
0.094117
6488996, 0.0941176488996), (0.12195122242, 0.235294118524, 0.235294118524),
(0.146341457963, 0.380392163992, 0.380392163992), (0.170731708407,
0.521568655968, 0.521568655968), (0.195121943951, 0.662745118141,
0.662745118141), (0.219512194395, 0.827450990677, 0.827450990677),
(0.243902444839, 0.96862745285, 0.96862745285), (0.268292695284, 1.0, 1.0),
(0.292682915926, 1.0, 1.0), (0.31707316637, 1.0, 1.0), (0.341463416815, 1.0,
1.0), (0.365853667259, 1.0, 1.0), (0.390243887901, 1.0, 1.0), (0.414634138346,
1.0, 1.0), (0.43902438879, 0.93337307, 0.93337307), (0.463414639235,
0.86274510622, 0.86274510622), (0.487804889679, 0.792156875134,
0.792156875134), (0.512195110321, 0.792156875134, 0.792156875134),
(0.536585390568, 0.86274510622, 0.86274510622), (0.56097561121, 0.93337307,
0.93337307), (0.585365831852, 0.996078431606, 0.996078431606),
(0.609756112099, 0.92549020052, 0.92549020052), (0.634146332741,
0.854901969433, 0.854901969433), (0.658536612988, 0.772549033
165, 0.772549033165), (0.68292683363, 0.701960802078, 0.701960802078),
(0.707317054272, 0.631372570992, 0.631372570992), (0.731707334518,
0.556862771511, 0.556862771511), (0.756097555161, 0.470588237047,
0.470588237047), (0.780487775803, 0.329411774874, 0.329411774874),
(0.804878056049, 0.160784319043, 0.160784319043), (0.829268276691,
0.0196078438312, 0.0196078438312), (0.853658556938, 0.0, 0.0), (0.87804877758,
0.0, 0.0), (0.902438998222, 0.0, 0.0), (0.926829278469, 0.0, 0.0),
(0.951219499111,
SF.net SVN: matplotlib: [4424] trunk/py4science/examples/skel
Revision: 4424
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4424&view=rev
Author: jswhit
Date: 2007-11-23 05:38:18 -0800 (Fri, 23 Nov 2007)
Log Message:
---
add basemap skeletons
Modified Paths:
--
trunk/py4science/examples/skel/basemap2_skel.py
Added Paths:
---
trunk/py4science/examples/skel/basemap3_skel.py
trunk/py4science/examples/skel/basemap4_skel.py
trunk/py4science/examples/skel/basemap5_skel.py
Modified: trunk/py4science/examples/skel/basemap2_skel.py
===
--- trunk/py4science/examples/skel/basemap2_skel.py 2007-11-22 19:37:56 UTC
(rev 4423)
+++ trunk/py4science/examples/skel/basemap2_skel.py 2007-11-23 13:38:18 UTC
(rev 4424)
@@ -1,15 +1,16 @@
import pylab, numpy
-from matplotlib.toolkits.basemap import Basemap
+from matplotlib.toolkits.basemap import Basemap, supported_projections
# create figure.
# background color will be used for 'wet' areas.
fig = pylab.figure()
fig.add_axes([0.1,0.1,0.8,0.8],axisbg='aqua')
# create map by specifying width and height in km.
-projection = 'lcc' # map projection
+projection = XX # map projection ('lcc','stere','laea','aea' etc)
+# 'print supported_projections' gives a list
resolution = XX # resolution of boundaries ('c','l','i',or 'h')
-lon_0=XX # longitude of origin of map projection domain (degrees).
-lat_0=XX # standard parallel/latitude of origin of map projection domain.
+lon_0= XX # longitude of origin of map projection domain (degrees).
+lat_0= XX # standard parallel/latitude of origin of map projection domain.
width = XX # width of map projecton domain in km.
height = XX # height of map projection domain in km.
m = Basemap(lon_0=lon_0,lat_0=lat_0,\
Added: trunk/py4science/examples/skel/basemap3_skel.py
===
--- trunk/py4science/examples/skel/basemap3_skel.py
(rev 0)
+++ trunk/py4science/examples/skel/basemap3_skel.py 2007-11-23 13:38:18 UTC
(rev 4424)
@@ -0,0 +1,46 @@
+import pylab, numpy
+from matplotlib.toolkits.basemap import Basemap
+
+# create figure.
+# background color will be used for 'wet' areas.
+fig = pylab.figure()
+fig.add_axes([0.1,0.1,0.8,0.8],axisbg='aqua')
+# create map by specifying width and height in km.
+resolution = 'l'
+lon_0 = -50
+lat_0 = 60
+projection = 'lcc'
+width = 1200
+height = 0.75*width
+m = Basemap(lon_0=lon_0,lat_0=lat_0,\
+width=width,height=height,\
+resolution=resolution,projection=projection)
+# lat/lon and name of location 1.
+lat1 = XX
+lon1 = XX
+name1 = XX
+# ditto for location 2.
+lat2 = XX
+lon2 = XX
+name2 = XX
+# convert these points to map projection coordinates
+# (using __call__ method of Basemap instance)
+x1, y1 = m(lon1, lat1)
+x2, y2 = m(lon2, lat2)
+# plot black dots at the two points.
+# make sure dots are drawn on top of other plot elements (zorder=10)
+m.scatter([x1,x2],[y1,y2],25,color='k',marker='o',zorder=10)
+# connect the dots along a great circle.
+m.drawgreatcircle(lon1,lat1,lon2,lat2,linewidth=2,color='k')
+# put the names of the cities to the left of each dot, offset
+# by a little. Use a bold font.
+pylab.text(x1-10,y1+10,name1,fontsize=12,\
+ color='k',horizontalalignment='right',fontweight='bold')
+pylab.text(x2-10,y2+10,name2,fontsize=12,\
+ color='k',horizontalalignment='right',fontweight='bold')
+m.drawcoastlines(linewidth=0.5)
+m.fillcontinents(color='coral')
+m.drawcountries()
+m.drawstates()
+pylab.title(name1+' to '+name2+' Great Circle')
+pylab.show()
Added: trunk/py4science/examples/skel/basemap4_skel.py
===
--- trunk/py4science/examples/skel/basemap4_skel.py
(rev 0)
+++ trunk/py4science/examples/skel/basemap4_skel.py 2007-11-23 13:38:18 UTC
(rev 4424)
@@ -0,0 +1,35 @@
+import pylab, numpy
+from matplotlib.toolkits.basemap import Basemap
+# create figure.
+# background color will be used for 'wet' areas.
+fig = pylab.figure()
+fig.add_axes([0.1,0.1,0.8,0.8],axisbg='aqua')
+# create map by specifying width and height in km.
+resolution = 'l'
+lon_0 = -50
+lat_0 = 60
+projection = 'lcc'
+width = 1200
+height = 0.75*width
+m = Basemap(lon_0=lon_0,lat_0=lat_0,\
+width=width,height=height,\
+resolution=resolution,projection=projection)
+m.drawcoastlines(linewidth=0.5)
+m.fillcontinents(color='coral')
+m.drawcountries()
+m.drawstates()
+# draw and label parallels.
+# labels is list of 4 values (default [0,0,0,0]) that control whether
+# parallels are labelled where they intersect the left, right, top or
+# bottom of the plot. For example labels=[1,0,0,1] will cause parallels
+# to be labelled where they intersect the left and bottom of the plot,
+# but not the right and top.
+labels = XX
+parallels = XX # a sequence of lati
