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
(12) |
2
(13) |
3
(14) |
4
(9) |
|
5
(9) |
6
(22) |
7
(17) |
8
(16) |
9
(19) |
10
(17) |
11
(6) |
|
12
|
13
(20) |
14
(21) |
15
(20) |
16
(10) |
17
(14) |
18
(3) |
|
19
(3) |
20
(12) |
21
(22) |
22
(26) |
23
(31) |
24
(26) |
25
(9) |
|
26
(4) |
27
(33) |
28
(15) |
29
(37) |
30
(26) |
|
|
|
From: John H. <jd...@gm...> - 2009-04-13 16:38:32
|
On Mon, Apr 13, 2009 at 11:20 AM, rmber <rya...@gm...> 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 |
|
From: Jae-Joon L. <lee...@gm...> - 2009-04-13 16:35:39
|
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 <rya...@gm...> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: rmber <rya...@gm...> - 2009-04-13 16:20:09
|
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. |
|
From: Jeff W. <js...@fa...> - 2009-04-13 14:46:21
|
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/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: Michael D. <md...@st...> - 2009-04-13 13:40:14
|
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 |
|
From: Jouni K. S. <jk...@ik...> - 2009-04-13 10:41:47
|
siz siz <cut...@gm...> 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 |
|
From: Douglas M. <du...@ar...> - 2009-04-13 09:58:45
|
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 <ef...@ha...>: > John Hunter wrote: >> >> On Thu, Apr 9, 2009 at 4:02 PM, mm2ps <du...@ar...> >> 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]: [<matplotlib.lines.Line2D object at 0x46bfd70>] >> >> 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 >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: antonv <vas...@ya...> - 2009-04-13 04:41:50
|
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 -- View this message in context: http://www.nabble.com/basemap-error-or-user-error--tp23017806p23017806.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: antonv <vas...@ya...> - 2009-04-13 04:24:07
|
-- View this message in context: http://www.nabble.com/basemap-error-or-user-error--tp23017751p23017751.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Jae-Joon L. <lee...@gm...> - 2009-04-13 04:08:43
|
The recent version of the mpl now supports multi-column legend. http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo3.html Thus, it would be great if you to try the new version, and if your problem is still not solved, please report it again. Regards, -JJ On Sun, Apr 12, 2009 at 11:12 PM, Vasileios Kontorinis <bko...@gm...> wrote: > Jae-Joon hi, > > I am a newbie with matplolib. I need a horizontal legend because my > figures are pretty wide and I need to automate the process of generating it. > > Since matplotlib does not support horizontal legends I am hacking around it. > > I modified your example below. So the following works: > > from matplotlib.pylab import * > from matplotlib.legend import Legend > from matplotlib.patches import Rectangle > > #fig = figure() > ax = gca() > pl_list = [] > for i in range(10): > pl, = ax.plot(random(10)) > pl_list.append(pl) > > xleg,yleg= 0.5,0.5 > > l1 = Legend(ax, pl_list[0:1], "0", loc=1) > hg1, wd1 = l1.get_frame().get_height(), l1.get_frame().get_width() > l2 = Legend(ax, pl_list[1:2], "1", loc=1) > hg2, wd2 = l2.get_frame().get_height(), l2.get_frame().get_width() > l3 = Legend(ax, pl_list[2:3], "2", loc=1) > hg3, wd3 = l3.get_frame().get_height(), l3.get_frame().get_width() > l4 = Legend(ax, pl_list[3:4], "3", loc=1) > hg4, wd4 = l4.get_frame().get_height(), l4.get_frame().get_width() > > total_height = hg1 > total_width = wd1+wd2+wd3+wd4 > > print total_height, total_width > > l1 = Legend(ax, pl_list[0:1], "0", loc=(xleg, yleg)) > l2 = Legend(ax, pl_list[1:2], "1", loc=(xleg+wd1/5, yleg)) > l3 = Legend(ax, pl_list[2:3], "2", loc=(xleg+(wd1+wd2)/5, yleg)) > l4 = Legend(ax, pl_list[3:4], "3", loc=(xleg+(wd1+wd2+wd3)/5, yleg)) > l1.get_frame().set_visible(False) # make background frame of legends > invisible > l2.get_frame().set_visible(False) > l3.get_frame().set_visible(False) > l4.get_frame().set_visible(False) > > # make a large background frame > rect = Rectangle((xleg, yleg), 0.45, 0.05, # adjust these values (in > normalized axes coordinate) > fc="w", ec="k", > transform=ax.transAxes, zorder=4) > ax.add_artist(rect) > ax.add_artist(l1) > ax.add_artist(l2) > ax.add_artist(l3) > ax.add_artist(l4) > > > The basic idea is to create a legend with the line and label I need and then > use its dimensions to create the background frame. > > The problem is that the height and width I get are in different units that > the normalized axes coordinates and I do not know how > > to properly transfrom them which leads to the hacky /5 , otherwise the > legends are off the figure. > > Any suggestions on how I can automate this part? > > Thanks in advance. > > > Jae-Joon Lee > Thu, 09 Oct 2008 12:21:56 -0700 > > Although I think it is possible to calculate the bounding box of the > all legends automatically, > Here is a manual way. > > > from matplotlib.patches import Rectangle > > l1.get_frame().set_visible(False) # make background frame of legends > invisible > > l2.get_frame().set_visible(False) > > # make a large background frame > rect = Rectangle((0.05, 0.75), 0.3, 0.2, # adjust these values (in > normalized axes coordinate) > fc="w", ec="k", > > transform=ax.transAxes, zorder=4) > ax.add_artist(rect) > > I hope this help, > > -JJ > > > > > On Thu, Oct 9, 2008 at 2:43 PM, José Alexandre Nalon <[EMAIL PROTECTED]> > wrote: >> Hello, > >> >> Em Thursday 09 October 2008 13:46:52 Jae-Joon Lee escreveu: >>> Meanwhile, you may try to make multiple legends as a posible workarounds. >> >> Thanks for your answer. That did the trick, and the figure > >> looks more or less as I wanted. It would look exactly as I >> wanted if I could remove the border from the legends and >> draw a box around the legends. How could I do that? >> >> (I apologize if this seems trivial. I use matplotlib a lot, > >> but standard functions always seem to do what I need, so I >> don't go deep in its behaviour). >> >> -- >> José Alexandre Nalon >> [EMAIL PROTECTED] >> >> ------------------------------------------------------------------------- > >> 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 > >> > ------------------------------------------------------------------------- > 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 > > > ------------------------------------------------------------------------------ > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Eric F. <ef...@ha...> - 2009-04-13 03:57:40
|
John Hunter wrote: > On Thu, Apr 9, 2009 at 4:02 PM, mm2ps <du...@ar...> 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]: [<matplotlib.lines.Line2D object at 0x46bfd70>] > > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Vasileios K. <bko...@gm...> - 2009-04-13 03:12:53
|
Jae-Joon hi,
I am a newbie with matplolib. I need a horizontal legend because my
figures are pretty wide and I need to automate the process of generating it.
Since matplotlib does not support horizontal legends I am hacking around it.
I modified your example below. So the following works:
from matplotlib.pylab import *
from matplotlib.legend import Legend
from matplotlib.patches import Rectangle
#fig = figure()
ax = gca()
pl_list = []
for i in range(10):
pl, = ax.plot(random(10))
pl_list.append(pl)
xleg,yleg= 0.5,0.5
l1 = Legend(ax, pl_list[0:1], "0", loc=1)
hg1, wd1 = l1.get_frame().get_height(), l1.get_frame().get_width()
l2 = Legend(ax, pl_list[1:2], "1", loc=1)
hg2, wd2 = l2.get_frame().get_height(), l2.get_frame().get_width()
l3 = Legend(ax, pl_list[2:3], "2", loc=1)
hg3, wd3 = l3.get_frame().get_height(), l3.get_frame().get_width()
l4 = Legend(ax, pl_list[3:4], "3", loc=1)
hg4, wd4 = l4.get_frame().get_height(), l4.get_frame().get_width()
total_height = hg1
total_width = wd1+wd2+wd3+wd4
print total_height, total_width
l1 = Legend(ax, pl_list[0:1], "0", loc=(xleg, yleg))
l2 = Legend(ax, pl_list[1:2], "1", loc=(xleg+wd1/5, yleg))
l3 = Legend(ax, pl_list[2:3], "2", loc=(xleg+(wd1+wd2)/5, yleg))
l4 = Legend(ax, pl_list[3:4], "3", loc=(xleg+(wd1+wd2+wd3)/5, yleg))
l1.get_frame().set_visible(False) # make background frame of legends
invisible
l2.get_frame().set_visible(False)
l3.get_frame().set_visible(False)
l4.get_frame().set_visible(False)
# make a large background frame
rect = Rectangle((xleg, yleg), 0.45, 0.05, # adjust these values (in
normalized axes coordinate)
fc="w", ec="k",
transform=ax.transAxes, zorder=4)
ax.add_artist(rect)
ax.add_artist(l1)
ax.add_artist(l2)
ax.add_artist(l3)
ax.add_artist(l4)
The basic idea is to create a legend with the line and label I need and then
use its dimensions to create the background frame.
The problem is that the height and width I get are in different units that
the normalized axes coordinates and I do not know how
to properly transfrom them which leads to the hacky /5 , otherwise the
legends are off the figure.
Any suggestions on how I can automate this part?
Thanks in advance.
Jae-Joon Lee
Thu, 09 Oct 2008 12:21:56 -0700
Although I think it is possible to calculate the bounding box of the
all legends automatically,
Here is a manual way.
from matplotlib.patches import Rectangle
l1.get_frame().set_visible(False) # make background frame of legends invisible
l2.get_frame().set_visible(False)
# make a large background frame
rect = Rectangle((0.05, 0.75), 0.3, 0.2, # adjust these values (in
normalized axes coordinate)
fc="w", ec="k",
transform=ax.transAxes, zorder=4)
ax.add_artist(rect)
I hope this help,
-JJ
On Thu, Oct 9, 2008 at 2:43 PM, José Alexandre Nalon <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Em Thursday 09 October 2008 13:46:52 Jae-Joon Lee escreveu:
>> Meanwhile, you may try to make multiple legends as a posible workarounds.
>
> Thanks for your answer. That did the trick, and the figure
> looks more or less as I wanted. It would look exactly as I
> wanted if I could remove the border from the legends and
> draw a box around the legends. How could I do that?
>
> (I apologize if this seems trivial. I use matplotlib a lot,
> but standard functions always seem to do what I need, so I
> don't go deep in its behaviour).
>
> --
> José Alexandre Nalon
> [EMAIL PROTECTED]
>
> -------------------------------------------------------------------------
> 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
>
-------------------------------------------------------------------------
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
|
|
From: John H. <jd...@gm...> - 2009-04-13 03:07:06
|
On Thu, Apr 9, 2009 at 4:02 PM, mm2ps <du...@ar...> 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 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]: [<matplotlib.lines.Line2D object at 0x46bfd70>] In [2]: import matplotlib._pylab_helpers as _pylab_helpers In [3]: print _pylab_helpers.Gcf.get_num_fig_managers() 1 JDH |
|
From: antonv <vas...@ya...> - 2009-04-13 02:51:20
|
Thanks, that's exactly what i was looking for! Anton Jae-Joon Lee wrote: > > I guess you want this. > > http://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.filled.html#numpy.ma.filled > > -JJ > > > On Sat, Apr 11, 2009 at 3:36 PM, antonv <vas...@ya...> wrote: >> >> Hi all, >> >> Another noob question here. I have a large masked array that I am >> plotting >> with "contourf" and because of the masked array i am getting jagged >> edges. >> If i could replace the masked data with a value that I supply then it >> will >> interpolate and give me the nice feathered edges that I need. >> >> Now my question is, what is the fastest way to add the supplied data to >> the >> masked areas? The only way I can think is to just iterate through the >> whole >> array and set the value of the masked areas to the value I want but I >> guess >> there should be other faster ways to do that. >> >> Any help is greatly appreciated! >> >> Thanks, >> Anton >> -- >> View this message in context: >> http://www.nabble.com/convert-a-masked-array-to-a-non-masked-one--tp23004653p23004653.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 >> Mat...@li... >> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://www.nabble.com/convert-a-masked-array-to-a-non-masked-one--tp23004653p23017179.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Jae-Joon L. <lee...@gm...> - 2009-04-11 23:20:58
|
I guess you want this. http://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.filled.html#numpy.ma.filled -JJ On Sat, Apr 11, 2009 at 3:36 PM, antonv <vas...@ya...> wrote: > > Hi all, > > Another noob question here. I have a large masked array that I am plotting > with "contourf" and because of the masked array i am getting jagged edges. > If i could replace the masked data with a value that I supply then it will > interpolate and give me the nice feathered edges that I need. > > Now my question is, what is the fastest way to add the supplied data to the > masked areas? The only way I can think is to just iterate through the whole > array and set the value of the masked areas to the value I want but I guess > there should be other faster ways to do that. > > Any help is greatly appreciated! > > Thanks, > Anton > -- > View this message in context: http://www.nabble.com/convert-a-masked-array-to-a-non-masked-one--tp23004653p23004653.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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Jae-Joon L. <lee...@gm...> - 2009-04-11 23:17:18
|
You can change the position of the subplot using "change_geometry" method, although it does not accept a sting argument. s1.change_geometry(2,1,1) # instead of "211" -JJ On Sat, Apr 11, 2009 at 4:59 PM, TP <par...@fr...> wrote: > Hi everybody, > > I would like to update a subplot position automatically. Try this example: > > ################## > from pylab import * > f = figure() > s1 = f.add_subplot( '111' ) > s1.plot( [5,7], [6,9], 'r' ) > s2 = f.add_subplot( '212' ) > s2.plot( [5,7], [4,9], 'b' ) > show() > ################## > > The problem is that the first subplot does not update its position when > I add a second subplot with "position string" '212'. I would like the > first subplot to take the position corresponding to a "position string" > '211'. > > I have not found any means to do this. The figure has some methods > "subplots_adjust" and "subplotpars", but it seems that I am compelled to > set the precise coordinates of the subplots, and so cannot do the > positioning automatically with a "position string". Am I right? What is > the best way to deal with this kind of problem? > > Thanks a lot > > Julien > > > ------------------------------------------------------------------------------ > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: TP <par...@fr...> - 2009-04-11 21:03:12
|
Hi everybody, I would like to update a subplot position automatically. Try this example: ################## from pylab import * f = figure() s1 = f.add_subplot( '111' ) s1.plot( [5,7], [6,9], 'r' ) s2 = f.add_subplot( '212' ) s2.plot( [5,7], [4,9], 'b' ) show() ################## The problem is that the first subplot does not update its position when I add a second subplot with "position string" '212'. I would like the first subplot to take the position corresponding to a "position string" '211'. I have not found any means to do this. The figure has some methods "subplots_adjust" and "subplotpars", but it seems that I am compelled to set the precise coordinates of the subplots, and so cannot do the positioning automatically with a "position string". Am I right? What is the best way to deal with this kind of problem? Thanks a lot Julien |
|
From: antonv <vas...@ya...> - 2009-04-11 19:36:14
|
Hi all, Another noob question here. I have a large masked array that I am plotting with "contourf" and because of the masked array i am getting jagged edges. If i could replace the masked data with a value that I supply then it will interpolate and give me the nice feathered edges that I need. Now my question is, what is the fastest way to add the supplied data to the masked areas? The only way I can think is to just iterate through the whole array and set the value of the masked areas to the value I want but I guess there should be other faster ways to do that. Any help is greatly appreciated! Thanks, Anton -- View this message in context: http://www.nabble.com/convert-a-masked-array-to-a-non-masked-one--tp23004653p23004653.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: siz s. <cut...@gm...> - 2009-04-11 17:37:32
|
Hi all,I want to use contourf function in matplotlib to plot 2D free energy histogram for my research. I have 2 plots and want them have the same colorbar scale so that I could compare the minima or maxima. I've been looking at colorbar doc but i can not find a solution. I always gets 2 different colorbar scale. Thanks for your reply and have a good day. Regards HNN |
|
From: Eric F. <ef...@ha...> - 2009-04-11 03:04:23
|
Ciarán Mooney wrote:
> Hi,
>
> I have an ASCII data set, which includes null data points. eg
>
> 1 x1 y1 z1
> 2 x2 y2 z2
> 3 x3 y3 z3
> 4 y3 z3
> 5 y4 z4
> 6 y5
>
> I am using ipython with pylab enabled, and the load("/xxx/xxx")
> function. However it chokes on the blank, "null", values. How can I
> get this data set into matplotlib?
I assume the file is using fixed-length fields. I don't know of any
ready-made tool for reading files with non-delimited fields, with or
without gaps, so you probably have to write your own to fit your
particular file. The general approach would be to read a line in as a
character string, use slices to isolate the fields, try to convert each
to a number, and if it fails put in a flag value. These numbers can go
in a list, and as you go through the lines you accumulate the lists in a
list. Then you can use numpy.ma.masked_equal(your_list_of_lists,
your_flag_value) to create a 2-D masked array suitable for use by mpl.
Eric
>
> Regards,
>
> Ciarán
>
> ------------------------------------------------------------------------------
> 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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: bollweevil <ly...@ro...> - 2009-04-10 23:06:59
|
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. -- View this message in context: http://www.nabble.com/How-do-I-install-Matplotlib-0.98-on-Ubuntu-8.04-Hardy-Heron--tp22996008p22996008.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Andrew S. <str...@as...> - 2009-04-10 21:49:01
|
jtamir wrote: > > Andrew Straw wrote: >> Does that file .h exist at that location? >> > Yes, __multiarray_api.h is in > ~/lib/python2.5/site-packages/numpy/core/include/numpy/ > I am installing with prefix set to home directory. > > > > Andrew Straw wrote: >> can you re-send the >> output including the first error? >> > The full output is quite long - 1650 lines (attached) > > >> $ python setup.py install --prefix=/home/jtamir > log >> error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 >> -Wall -Wstrict-prototypes -fPIC -Isrc >> -I/home/jtamir/lib/python2.5/site-packages/numpy/core/include >> -I/home/jtamir/include/python2.5 -c src/_proj.c -o >> build/temp.linux-i686-2.5/src/_proj.o" failed with exit status 1 >> http://www.nabble.com/file/p22992540/log log > compile options: '-Isrc -I/home/jtamir/lib/python2.5/site-packages/numpy/core/include -I/home/jtamir/include/python2.5 -c' > gcc: src/_proj.c > src/_proj.c:4:20: error: Python.h: No such file or directory That's the first error -- and it's quite diagnostic. gcc can't find Python.h. I see you are doing some slightly non-standard stuff with paths. From your paths, it appears you have Python installed in /home/jtamir/bin/python. If this is the case, you should try "/home/jtamir/bin/python setup.py install" (without the --prefix=/home/jtamir). That will let distutils attempt to do everything normally. Otherwise, you'll have to figure out what Python.h isn't in /home/jtamir/include/python2.5 if you want the above to work. -- Andrew D. Straw, Ph.D. California Institute of Technology http://www.its.caltech.edu/~astraw/ |
|
From: Michael M. F. <mf...@ph...> - 2009-04-10 19:03:16
|
On 8 Apr 2009, at 12:29 PM, Gideon Simpson wrote: > Is there a way to save a figured at a specified size? > -gideon I have always specified the figure size first in the figure command: fig_width = 5 # Default unit is inches fig_height = 3 plt.figure(figsize=(fig_width, fig_height)) plt.plot(...) plt.savefig(...) As long as you don't resize the figure, this will save the figure in the specified size. I don't know if there is a good way to force the size after the fact, but things don't always scale nicely so I find it best to work with the desired size figure from the start. Michael. |
|
From: jtamir <jt...@ar...> - 2009-04-10 18:23:37
|
Andrew Straw wrote: > > Does that file .h exist at that location? > Yes, __multiarray_api.h is in ~/lib/python2.5/site-packages/numpy/core/include/numpy/ I am installing with prefix set to home directory. Andrew Straw wrote: > > can you re-send the > output including the first error? > The full output is quite long - 1650 lines (attached) > $ python setup.py install --prefix=/home/jtamir > log > error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 > -Wall -Wstrict-prototypes -fPIC -Isrc > -I/home/jtamir/lib/python2.5/site-packages/numpy/core/include > -I/home/jtamir/include/python2.5 -c src/_proj.c -o > build/temp.linux-i686-2.5/src/_proj.o" failed with exit status 1 > http://www.nabble.com/file/p22992540/log log Jon -- View this message in context: http://www.nabble.com/Basemap-Installation-Errors-tp22915617p22992540.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Lorenzo Di G. <lor...@gm...> - 2009-04-10 16:40:56
|
Ouch, it looks like MinGW and Python do not fit 100% to each other. Please check out this bug report: http://bugs.python.org/issue3308 "Basically MinGW erroneously ships a .lib saying localtime is in MSVCR90.DLL when it isn't. That means there is no link failure but the *pyd* will fail to load without information as to why. Fixing the .lib means that localtime is picked up from MSVCRT.DLL (ie no version in name) and everything appears to work well." On 4/10/09, Lorenzo Di Gregorio <lor...@gm...> wrote: > > On 4/10/09, Michael Droettboom <md...@st...> wrote: >> >> Lorenzo Di Gregorio wrote: >> >>> Well, that's exactly the problem: I just can't load some DLLs! >>> >>> import matplotlib._path >>> >>> Traceback (most recent call last): >>> File "<pyshell#0>", line 1, in <module> >>> import matplotlib._path >>> ImportError: DLL load failed: Die angegebene Prozedur wurde nicht >>> gefunden. >>> >>> import matplotlib._delaunay >>> >>> import matplotlib._image >>> >>> Traceback (most recent call last): >>> File "<pyshell#2>", line 1, in <module> >>> import matplotlib._image >>> ImportError: DLL load failed: Die angegebene Prozedur wurde nicht >>> gefunden. >>> >>> I have run python -vv, it tries also ..._path but does not load it, so I >>> think it might be a linking problem. >>> I've noticed that _delaunay.cpp has a "PyMODINIT_FUNC >>> init_delaunay(void)" while _path.cpp has just a "void init_path(void)". >>> >> If you make that change, does it work? > > > No, I tried. > > I have also tried to start python -vv. > For _delaunay I get a correct import. > > # trying C:\Python26\lib\site-packages\matplotlib\_delaunay.pyd > import matplotlib._delaunay # dynamically loaded from > C:\Python26\lib\site-packages\matplotlib\_delaunay.pyd > > For _path and _image I get > > >>> import matplotlib._path > # trying C:\Python26\lib\site-packages\matplotlib\_path.pyd > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden. > >>> import matplotlib._image > # trying C:\Python26\lib\site-packages\matplotlib\_image.pyd > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: DLL load failed: Die angegebene Prozedur wurde nicht gefunden. > > So Python checks the right place but then concludes that the DLL is not > there. I guess something goes wrong with the linking, but in fact I do not > know how to write a DLL for Python and I'm stuck now. > I have checked that the compilation was ok and the rest of the installation > (GTK+ etc) is ok. I can import matplotlib itself. In the packages I had > only one package to patch: I think "gpobjects" had a reference to "@FFI_LIB@". > This was getting through pkg-config and stopping the compilation, so I have > removed it. > > ... HELP! ;-) > > Regards, > Lorenzo > |