Re: [Matplotlib-users] test before show
Dear Eric and John, Thank both for your help. John, I'll use your solution for now. Eric, when it comes through my repository, I'll try your solution. Again thanks. Best, Douglas 2009/4/13 Eric Firing : > John Hunter wrote: >> >> On Thu, Apr 9, 2009 at 4:02 PM, mm2ps >> wrote: >>> >>> Hi, >>> >>> How would you check that there is something to show() before you show()? >> >> Although it is a bit inelegant, you could use the _pylab_helpers >> module to see how many figure managers are active > > In svn trunk this is exposed in pyplot.py: > > len(pyplot.get_fignums()) > > should do it. > > Eric > >> >> >> home:~> ipython -pylab >> Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) >> Type "copyright", "credits" or "license" for more information. >> >> IPython 0.9.1 -- An enhanced Interactive Python. >> ? -> Introduction and overview of IPython's features. >> %quickref -> Quick reference. >> help -> Python's own help system. >> object? -> Details about 'object'. ?object also works, ?? prints more. >> >> Welcome to pylab, a matplotlib-based Python environment. >> For more information, type 'help(pylab)'. >> >> In [1]: plot([1,2,3]) >> Out[1]: [] >> >> In [2]: import matplotlib._pylab_helpers as _pylab_helpers >> >> In [3]: print _pylab_helpers.Gcf.get_num_fig_managers() >> 1 >> >> JDH >> >> >> -- >> This SF.net email is sponsored by: >> High Quality Requirements in a Collaborative Environment. >> Download a free trial of Rational Requirements Composer Now! >> http://p.sf.net/sfu/www-ibm-com >> ___ >> Matplotlib-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to plot 2d histogram with the same scale!!
siz siz writes: > I have 2 plots and want them have the same colorbar scale so that I > could compare the minima or maxima. You can do it like this: mn = min(data1.min(), data2.min()) mx = max(data1.max(), data2.max()) norm = matplotlib.colors.Normalize(mn, mx) figure(); contourf(data1, norm=norm); colorbar() figure(); contourf(data2, norm=norm); colorbar() -- Jouni K. Seppänen http://www.iki.fi/jks -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How do I install Matplotlib 0.98 on Ubuntu 8.04 Hardy Heron?
One of the cool things about Debian-esque distros is you can say: apt-get build-dep python-matplotlib which will install all of the build dependencies for matplotlib. It will download a lot, but if bandwidth/disk space is not an issue, it's nicely automated. That's one of the first things I do on any new Ubuntu or Debian install -- and then I check out matplotlib from source or SVN and build with no problems. Cheers, Mike bollweevil wrote: > sudo apt-get install python-matplotlib > #This only gets matplotlib-0.91 > > I have tried downloading the matplotlib-0.98.5.2.tar.gz, but it requires an > incredibly large number of prerequisites, and each of the prerequisites > requires prerequisites, and I have now wasted hours on this. > > Please help me install matplotlib-0.98 on Ubuntu 8.04 Hardy Heron. I know > that there is an apt-get package to install matplotlib-0.98 on Ubuntu > Jaunty, but I don't know how to use it on Hardy. > > Thanks. > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap error or user error?
antonv wrote:
> Hi all,
>
> I have a weird thing happening with basemap and I am not sure if it's
> basemap or me, but more than likely it's me :(
>
> Here is the grib file that I am using:
> http://downloads.75ive.com/multi_1.20090321.t18z_multi_1.wc_10m.all.grb2
> http://downloads.75ive.com/multi_1.20090321.t18z_multi_1.wc_10m.all.grb2
>
> And here is my code:
> #
> import matplotlib
> import matplotlib.mpl as mpl
> import matplotlib.pyplot as plt
> import matplotlib.mlab as mlab
> import numpy as np
> import matplotlib.pylab as pylab
> from mpl_toolkits.basemap import Basemap
> from grib2 import Grib2Decode
>
> grbs = Grib2Decode('multi_1.20090321.t18z_multi_1.wc_10m.all.grb2')
>
> lats, lons = grbs[0].grid()
> mapCoords = [32.35,-121.0,34.75,-116.75]
> #mapCoords = [lats.min(),lons.min(),lats.max(),lons.max()]
>
> colorList =
> [[0.,0.,205./255.],[0,102./255.,255./255.],[0,183./255.,255./255.],[0,224./255.,255./255.],
>
> [0,255./255.,255./255.],[0,255./255.,204./255.],[0,255./255.,153./255.],[0,255./255.,0],
>
> [153./255.,255./255.,0],[204./255.,255./255.,0],[255./255.,255./255.,0],[255./255.,204./255.,0],
>
> [255./255.,153./255.,0],[255./255.,102./255.,0],[255./255.,0,0],[176./255.,48./255.,96./255.],
> [208./255.,32./255.,144./255.],[255./255.,0,255./255.]]
> cmap = matplotlib.colors.ListedColormap(colorList, name = 'theColorMap', N =
> len(colorList))
>
> m = Basemap(projection='merc',lat_ts = 30,\
>
> llcrnrlat=mapCoords[0],llcrnrlon=mapCoords[1],urcrnrlat=mapCoords[2],urcrnrlon=mapCoords[3],\
> resolution='h',area_thresh=0.5, suppress_ticks = True)
>
> fig = plt.figure(figsize=(14.58,10.58))
> fig.set_dpi(100)
>
> nlats, nlons = grbs[0].data().shape
>
> x = np.linspace(lons.min(),lons.max(),nlons)
> y = np.linspace(lats.min(),lats.max(),nlats)
>
> X, Y = m(*np.meshgrid(x, y))
>
> z = grbs[0].data().filled(1)
>
> m.contourf(X,Y,z,cmap=cmap,levels=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],extend='both')
>
> m.fillcontinents(color='green',lake_color='b')
> m.drawcoastlines(color='k', linewidth=0.75)
> m.drawcountries(color='k', linewidth=0.25)
> m.drawstates(color='k', linewidth=0.25)
> m.drawmapboundary(linewidth=1.0, color='k')
>
> plt.show()
> #
>
> If you look at lines 14 and 15 you can see that i have a variable called
> mapCoords that feeds the lat/lon coordinates to the basemap object. If i set
> them up using the commented line (line 15) it will plot the map for all the
> data in the file and it will display it correctly. If i use line 14 which is
> the zoomed area that i am interested in it will display the basemap map
> correctly zoomed in but it will not show the plotted data. Any ideas on what
> is happening here?
>
> Also, if you have any comments on optimizing the code I would really
> appreciate it!
>
> Thanks,
> Anton
>
>
Anton: Probably your data doesn't cover the zoomed region, but without
actually having your data I can't be sure.
One question: why are you rebuilding the lons and lats from scratch
when you already have them? It seems like you can get rid of
nlats, nlons = grbs[0].data().shape
x = np.linspace(lons.min(),lons.max(),nlons)
y = np.linspace(lats.min(),lats.max(),nlats)
X, Y = m(*np.meshgrid(x, y))
and replace it with
X,Y = m(lons, lats)
-Jeff
--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX: (303)497-6449
NOAA/OAR/PSD R/PSD1Email : [email protected]
325 BroadwayOffice : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg
--
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib.pyplot.pcolor and matplotlib.pyplot.savefig unexpectedly slow
Hello all, I am a matplotlib novice so I expect I am doing something inappropriate. From the attached script (matplotlib-slow.py), it will be seen that I am creating a 512x512 (numpy) array and using matplotlib to plot it. Below is the script output on my Microsoft Windows XP (service pack 3) box: >matplotlib-slow.py [2009-04-13 08:40:34] [DEBUG ] [line # 23] Python version: 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] [2009-04-13 08:40:34] [DEBUG ] [line # 24] numpy version: 1.2.1 [2009-04-13 08:40:34] [DEBUG ] [line # 25] matplotlib version: 0.98.5.2 [2009-04-13 08:40:34] [DEBUG ] [line # 37] executing matplotlib.pyplot.subplot() *[2009-04-13 08:40:34] [DEBUG ] [line # 39] executing matplotlib.pyplot.pcolor()* [2009-04-13 08:41:12] [DEBUG ] [line # 41] executing matplotlib.pyplot.colorbar() *[2009-04-13 08:41:12] [DEBUG ] [line # 45] executing matplotlib.pyplot.savefig()* [2009-04-13 08:41:35] [DEBUG ] [line # 47] executing matplotlib.pyplot.close() Note, the call to pcolor() and savefig() consume 38 and 13 seconds respectively. My goal is to dramatically reduce these times (1 second or less). I would appreciate your suggestions. Thanks, -- jv matplotlib-slow.py Description: application/python -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] imshow scaling
Is there a way to make imshow scale images to dimensions other than that of the arrya passed to it? I'm trying to plot a long matrix (like 23x5000) and imshow doesn't work very well since it makes a very vertically thin plot and its hard to see anything. I would like the image to dynamically scale with windows size like if you plotted something with specgram() or plot(). Thanks, Ryan -- View this message in context: http://www.nabble.com/imshow-scaling-tp23024632p23024632.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] imshow scaling
Explicitly set the aspect to "auto". imshow(image, aspect="auto") http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.imshow -JJ On Mon, Apr 13, 2009 at 12:20 PM, rmber wrote: > > Is there a way to make imshow scale images to dimensions other than that of > the arrya passed to it? I'm trying to plot a long matrix (like 23x5000) and > imshow doesn't work very well since it makes a very vertically thin plot and > its hard to see anything. I would like the image to dynamically scale with > windows size like if you plotted something with specgram() or plot(). > > Thanks, > > Ryan > -- > View this message in context: > http://www.nabble.com/imshow-scaling-tp23024632p23024632.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > -- > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] imshow scaling
On Mon, Apr 13, 2009 at 11:20 AM, rmber wrote: > > Is there a way to make imshow scale images to dimensions other than that of > the arrya passed to it? I'm trying to plot a long matrix (like 23x5000) and > imshow doesn't work very well since it makes a very vertically thin plot and > its hard to see anything. I would like the image to dynamically scale with > windows size like if you plotted something with specgram() or plot(). > Just pass in aspect='auto' as a keyword argument to imshow. JDH -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib.pyplot.pcolor and matplotlib.pyplot.savefig unexpectedly slow
Is there any particular reason that you have to use pcolor? My understanding is that the imshow is the fastest. Also, pcolormesh is much faster than pcolor if you use agg backend. Your script runs in a second on my linux box if I replace pcolor with pcolormesh. -JJ On Mon, Apr 13, 2009 at 10:54 AM, Jim Vickroy wrote: > Hello all, > > I am a matplotlib novice so I expect I am doing something inappropriate. > > >From the attached script (matplotlib-slow.py), it will be seen that I am > creating a 512x512 (numpy) array and using matplotlib to plot it. > > Below is the script output on my Microsoft Windows XP (service pack 3) box: > > >>matplotlib-slow.py > [2009-04-13 08:40:34] [DEBUG ] [line # 23] Python version: 2.5.4 > (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] > [2009-04-13 08:40:34] [DEBUG ] [line # 24] numpy version: 1.2.1 > [2009-04-13 08:40:34] [DEBUG ] [line # 25] matplotlib version: 0.98.5.2 > [2009-04-13 08:40:34] [DEBUG ] [line # 37] executing > matplotlib.pyplot.subplot() > [2009-04-13 08:40:34] [DEBUG ] [line # 39] executing > matplotlib.pyplot.pcolor() > [2009-04-13 08:41:12] [DEBUG ] [line # 41] executing > matplotlib.pyplot.colorbar() > [2009-04-13 08:41:12] [DEBUG ] [line # 45] executing > matplotlib.pyplot.savefig() > [2009-04-13 08:41:35] [DEBUG ] [line # 47] executing > matplotlib.pyplot.close() > > > Note, the call to pcolor() and savefig() consume 38 and 13 seconds > respectively. My goal is to dramatically reduce these times (1 second or > less). > > I would appreciate your suggestions. > > Thanks, > -- jv > > -- > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib.pyplot.pcolor and matplotlib.pyplot.savefig unexpectedly slow
Jae-Joon Lee wrote: > Is there any particular reason that you have to use pcolor? > None whatsoever; it is simply what I first encountered in an example. > My understanding is that the imshow is the fastest. > Also, pcolormesh is much faster than pcolor if you use agg backend. > Your script runs in a second on my linux box if I replace pcolor with > pcolormesh. > I saw pcolormesh() documented but did not understand its significance. I struggle to understand all of the matplotlib variants. Substituting pcolormesh() for pcolor(), my script now also runs in under a second on my Microsoft box -- an amazing difference! Thanks very much for your quick response! -- jv > -JJ > > > On Mon, Apr 13, 2009 at 10:54 AM, Jim Vickroy wrote: > >> Hello all, >> >> I am a matplotlib novice so I expect I am doing something inappropriate. >> >> >From the attached script (matplotlib-slow.py), it will be seen that I am >> creating a 512x512 (numpy) array and using matplotlib to plot it. >> >> Below is the script output on my Microsoft Windows XP (service pack 3) box: >> >> >> >>> matplotlib-slow.py >>> >> [2009-04-13 08:40:34] [DEBUG ] [line # 23] Python version: 2.5.4 >> (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] >> [2009-04-13 08:40:34] [DEBUG ] [line # 24] numpy version: 1.2.1 >> [2009-04-13 08:40:34] [DEBUG ] [line # 25] matplotlib version: 0.98.5.2 >> [2009-04-13 08:40:34] [DEBUG ] [line # 37] executing >> matplotlib.pyplot.subplot() >> [2009-04-13 08:40:34] [DEBUG ] [line # 39] executing >> matplotlib.pyplot.pcolor() >> [2009-04-13 08:41:12] [DEBUG ] [line # 41] executing >> matplotlib.pyplot.colorbar() >> [2009-04-13 08:41:12] [DEBUG ] [line # 45] executing >> matplotlib.pyplot.savefig() >> [2009-04-13 08:41:35] [DEBUG ] [line # 47] executing >> matplotlib.pyplot.close() >> >> >> Note, the call to pcolor() and savefig() consume 38 and 13 seconds >> respectively. My goal is to dramatically reduce these times (1 second or >> less). >> >> I would appreciate your suggestions. >> >> Thanks, >> -- jv >> >> -- >> This SF.net email is sponsored by: >> High Quality Requirements in a Collaborative Environment. >> Download a free trial of Rational Requirements Composer Now! >> http://p.sf.net/sfu/www-ibm-com >> ___ >> Matplotlib-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] installing matplotlib
When installing matplotlib-0.98.5.2.win32-py2.5.exe on Windows Vista I got the messages 'Could not create key matplotlib-py2.5' and 'Could not set key value Python 2.5 matplotlib-0,98.5.2'. Any idea what is wrong? -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] tweaking automatic date formatting?
Hi, I've asked this before but still am stuck. I want to use mpl's automatic tick locating and date formatting for a zoomable date plot, OTHER THAN the hour formatting. The default hour formatting (when zoomed in on 1 day) is like "05:00:00 UTC", but I'd like to be of the form something more readable for users, like: "5:00pm 12/03". If I just use my own custom date formatter, then ALL the zoom levels will have this format, but I'd only like it for when the plot is zoomed down to the level of one day. (So it is a rule of "if zoomed to one day, use my custom dateformatter, otherwise, use the automatic one"). Why I'd like this: for looking across weeks or months worth of data, hours are irrelevant, but for looking at days, hours are relevant, but users will not think in terms of UTC and they will want to see on the x axis which day they are looking at. Does anyone know how this can be done in mpl? Thank you, Che -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap Installation Errors
Andrew Straw wrote: > > That's the first error -- and it's quite diagnostic. gcc can't find > Python.h. > Looks like I didn't have the python-dev package installed - I wasn't aware it was necessary (still relatively new to these things!). Basemap is now working correctly. Thanks for the help, Jon -- View this message in context: http://www.nabble.com/Basemap-Installation-Errors-tp22915617p23030458.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap error or user error?
Jeff, thanks for the comment on rebuilding the lons and lats!
I have attached 2 images, one that is from the whole data in the file and
the other the zoomed version.
http://www.nabble.com/file/p23031035/basemap_all.png basemap_all.png
http://www.nabble.com/file/p23031035/basemap_zoom.png basemap_zoom.png
What seems to be happening is that the coordinates seem to be in different
projections as the values of lats.min(),lons.min(),lats.max(),lons.max() are
25.0,210.0,50.0,250.0 while the list I'm providing is
32.35,-121.0,34.75,-116.75. Any ideas on why basemap seems to be reading
both coordinate lists and provides the proper land contours while contourf
seems to be off?
Thanks,
Anton
Jeff Whitaker wrote:
>
> antonv wrote:
>> Hi all,
>>
>> I have a weird thing happening with basemap and I am not sure if it's
>> basemap or me, but more than likely it's me :(
>>
>> Here is the grib file that I am using:
>> http://downloads.75ive.com/multi_1.20090321.t18z_multi_1.wc_10m.all.grb2
>> http://downloads.75ive.com/multi_1.20090321.t18z_multi_1.wc_10m.all.grb2
>>
>> And here is my code:
>> #
>> import matplotlib
>> import matplotlib.mpl as mpl
>> import matplotlib.pyplot as plt
>> import matplotlib.mlab as mlab
>> import numpy as np
>> import matplotlib.pylab as pylab
>> from mpl_toolkits.basemap import Basemap
>> from grib2 import Grib2Decode
>>
>> grbs = Grib2Decode('multi_1.20090321.t18z_multi_1.wc_10m.all.grb2')
>>
>> lats, lons = grbs[0].grid()
>> mapCoords = [32.35,-121.0,34.75,-116.75]
>> #mapCoords = [lats.min(),lons.min(),lats.max(),lons.max()]
>>
>> colorList =
>> [[0.,0.,205./255.],[0,102./255.,255./255.],[0,183./255.,255./255.],[0,224./255.,255./255.],
>>
>> [0,255./255.,255./255.],[0,255./255.,204./255.],[0,255./255.,153./255.],[0,255./255.,0],
>>
>> [153./255.,255./255.,0],[204./255.,255./255.,0],[255./255.,255./255.,0],[255./255.,204./255.,0],
>>
>> [255./255.,153./255.,0],[255./255.,102./255.,0],[255./255.,0,0],[176./255.,48./255.,96./255.],
>> [208./255.,32./255.,144./255.],[255./255.,0,255./255.]]
>> cmap = matplotlib.colors.ListedColormap(colorList, name = 'theColorMap',
>> N =
>> len(colorList))
>>
>> m = Basemap(projection='merc',lat_ts = 30,\
>>
>> llcrnrlat=mapCoords[0],llcrnrlon=mapCoords[1],urcrnrlat=mapCoords[2],urcrnrlon=mapCoords[3],\
>> resolution='h',area_thresh=0.5, suppress_ticks = True)
>>
>> fig = plt.figure(figsize=(14.58,10.58))
>> fig.set_dpi(100)
>>
>> nlats, nlons = grbs[0].data().shape
>>
>> x = np.linspace(lons.min(),lons.max(),nlons)
>> y = np.linspace(lats.min(),lats.max(),nlats)
>>
>> X, Y = m(*np.meshgrid(x, y))
>>
>> z = grbs[0].data().filled(1)
>>
>> m.contourf(X,Y,z,cmap=cmap,levels=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],extend='both')
>>
>> m.fillcontinents(color='green',lake_color='b')
>> m.drawcoastlines(color='k', linewidth=0.75)
>> m.drawcountries(color='k', linewidth=0.25)
>> m.drawstates(color='k', linewidth=0.25)
>> m.drawmapboundary(linewidth=1.0, color='k')
>>
>> plt.show()
>> #
>>
>> If you look at lines 14 and 15 you can see that i have a variable called
>> mapCoords that feeds the lat/lon coordinates to the basemap object. If i
>> set
>> them up using the commented line (line 15) it will plot the map for all
>> the
>> data in the file and it will display it correctly. If i use line 14 which
>> is
>> the zoomed area that i am interested in it will display the basemap map
>> correctly zoomed in but it will not show the plotted data. Any ideas on
>> what
>> is happening here?
>>
>> Also, if you have any comments on optimizing the code I would really
>> appreciate it!
>>
>> Thanks,
>> Anton
>>
>>
> Anton: Probably your data doesn't cover the zoomed region, but without
> actually having your data I can't be sure.
>
> One question: why are you rebuilding the lons and lats from scratch
> when you already have them? It seems like you can get rid of
>
> nlats, nlons = grbs[0].data().shape
> x = np.linspace(lons.min(),lons.max(),nlons)
> y = np.linspace(lats.min(),lats.max(),nlats)
> X, Y = m(*np.meshgrid(x, y))
>
> and replace it with
>
> X,Y = m(lons, lats)
>
>
> -Jeff
>
> --
> Jeffrey S. Whitaker Phone : (303)497-6313
> Meteorologist FAX: (303)497-6449
> NOAA/OAR/PSD R/PSD1Email : [email protected]
> 325 BroadwayOffice : Skaggs Research Cntr 1D-113
> Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg
>
>
> --
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> ___
> Matplotlib-users mailing list
> [email protected]
