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
|
2
(13) |
3
(5) |
4
(5) |
5
(21) |
6
(10) |
7
(9) |
8
(4) |
9
(11) |
10
(9) |
11
(11) |
12
(25) |
13
(5) |
14
(2) |
15
(5) |
16
(8) |
17
(16) |
18
(11) |
19
(15) |
20
(5) |
21
(8) |
22
(4) |
23
(24) |
24
(9) |
25
(14) |
26
(5) |
27
(28) |
28
(2) |
29
(13) |
30
(14) |
31
(11) |
|
|
|
|
From: Benjamin R. <ben...@ou...> - 2012-01-12 22:41:33
|
On Thu, Jan 12, 2012 at 4:32 PM, Michael Rawlins <raw...@ya...>wrote: > On 01/12/12 Ben Root wrote: > > On Thu, Jan 12, 2012 at 4:00 PM, Michael Rawlins <raw...@ya...>wrote: > > > On 01/12/12 Ben Root wrote: > > On Thu, Jan 12, 2012 at 2:20 PM, Michael Rawlins <raw...@ya...>wrote: > > > On 01/12/12 Ben Root wrote: > > Just a quick suggestion for cleaning up your code, please look into the > argparse module to make command-line parsing so much easier to use. > <http://docs.python.org/dev/library/argparse.html> > http://docs.python.org/dev/library/argparse.html > > Ben Root > > > > Command line parsing? I'm new to python and matplotlib and was given this > code by a colleague. I've managed to make simple modifications. Don't know > enough yet to use the examples in the link you provide. > > I've simplified my code as much as possible. The first 50 lines make a > map. The code below that makes a 4 panel graphic. Seems that plt.figure > invokes a new plot window. But plt.semilogy, plt.loglog, and plt.hist do > not, keeping the panels in a single window. This is what I need. Trying now > to figure out how to transfer the fig=plt.figure line into the subplot > section, without popping up a new window. > > Mike > > > > Ok, a quick crash course: > > A "figure" can hold one or more "axes" (or subplots). When using "plt", > you can choose to make figures explicitly with the "fig = plt.figure()" > command or not. The same is true for axes objects. If you call a command > that needs a figure and/or an axes object to have been made and they don't > exist, then they are made for you automatically. Otherwise, the most > recently accessed figure/axes are assumed. This is why plt.hist(), > plt.semilog() and others are not creating a new figure window if one > already existed. > > Anyway, for your code, you do not want to bring in the plt.figure() call > into the subploting section. The example you were given takes advantage of > pyplot's implicit syntax (where it is implicitly assumed which axes/figure > object you are using). However, I personally do not like that approach, and > instead decided to show you an explicit style. I created a foobar() > function that takes a blank figure object and other parameters, creates the > four subplot axes and performs drawing on each of them. Note that the > title is for the subplot, not for the figure. If you want a title for the > figure above all the other subplots, use "fig.suptitle()". I then have a > loop where a figure is created each time, the foobar() function acts on > that figure, saved and then cleared before the next iteration. > > Note, I noticed you had "plt.show()" commented out before the call to > "plt.savefig()". Usually, you will want savefig() to come *before* show() > because closing the figure window will destroy the figure object, resulting > in a blank figure to save if done afterwards. > > I hope this is helpful! > Ben Root > > > > > OK starting to make sense. Yes very helpful. I think what's you've set up > might work, provided I can pass a filename for data into the function. > > At the moment I'm getting an error: > > NameError: name 'foobar' is not defined > > for the line with: foobar(fig, m, title) > > Mike > > > My bad... I put the declaration of the foobar() function after it is > called in the script. This isn't an issue if they are in separate scopes, > but because "def foobar" is in the same scope as the call to it, it must > have already been declared before it gets called. Just move that function > to the area after all the imports. > > Ben Root > > > Thanks for the help. Code throwing another error: > > Traceback (most recent call last): > File "panels_testingNEW4.py", line 69, in <module> > foobar(fig, m, title) > File "panels_testingNEW4.py", line 23, in foobar > title(title) > TypeError: 'str' object is not callable > > Oh, right, the creation of the "title" variable got rid of the existing function. Just do "ax.set_title(title)" instead. Ben Root |
From: Michael R. <raw...@ya...> - 2012-01-12 22:32:26
|
On 01/12/12 Ben Root wrote: On Thu, Jan 12, 2012 at 4:00 PM, Michael Rawlins <raw...@ya...> wrote: > >On 01/12/12 Ben Root wrote: > >On Thu, Jan 12, 2012 at 2:20 PM, Michael Rawlins <raw...@ya...> wrote: > > >>On 01/12/12 Ben Root wrote: >> >>Just a quick suggestion for cleaning up your code, please look into the argparse module to make command-line parsing so much easier to use. >> >>http://docs.python.org/dev/library/argparse.html >> >> >>Ben Root >> >> >> >>Command line parsing? I'm new to python and matplotlib and was given this code by a colleague. I've managed to make simple modifications. Don't know enough yet to use the examples in the link you provide. >> >>I've simplified my code as much as possible. The first 50 lines make a map. The code below that makes a 4 panel graphic. Seems that plt.figure invokes a new plot window. But plt.semilogy, plt.loglog, and plt.hist do not, keeping the panels in a single window. This is what I need. Trying now to figure out how to transfer the fig=plt.figure line into the subplot section, without popping up a new window. >> >>Mike >> >> >> > >Ok, a quick crash course: > >A "figure" can hold one or more "axes" (or subplots). When using "plt", you can choose to make figures explicitly with the "fig = plt.figure()" command or not. The same is true for axes objects. If you call a command that needs a figure and/or an axes object to have been made and they don't exist, then they are made for you automatically. Otherwise, the most recently accessed figure/axes are assumed. This is why plt.hist(), plt.semilog() and others are not creating a new figure window if one already existed. > >Anyway, for your code, you do not want to bring in the plt.figure() call into the subploting section. The example you were given takes advantage of pyplot's implicit syntax (where it is implicitly assumed which axes/figure object you are using). However, I personally do not like that approach, and instead decided to show you an explicit style. I created a foobar() function that takes a blank figure object and other parameters, creates the four subplot axes and performs drawing on each of them. Note that the title is for the subplot, not for the figure. If you want a title for the figure above all the other subplots, use "fig.suptitle()". I then have a loop where a figure is created each time, the foobar() function acts on that figure, saved and then cleared before the next iteration. > >Note, I noticed you had "plt.show()" commented out before the call to "plt.savefig()". Usually, you will want savefig() to come *before* show() because closing the figure window will destroy the figure object, resulting in a blank figure to save if done afterwards. > >I hope this is helpful! >Ben Root > > > > >OK starting to make sense. Yes very helpful. I think what's you've set up might work, provided I can pass a filename for data into the function. > >At the moment I'm getting an error: > >NameError: name 'foobar' is not defined > >for the line with: foobar(fig, m, title) > >Mike > > My bad... I put the declaration of the foobar() function after it is called in the script. This isn't an issue if they are in separate scopes, but because "def foobar" is in the same scope as the call to it, it must have already been declared before it gets called. Just move that function to the area after all the imports. Ben Root Thanks for the help. Code throwing another error: Traceback (most recent call last): File "panels_testingNEW4.py", line 69, in <module> foobar(fig, m, title) File "panels_testingNEW4.py", line 23, in foobar title(title) TypeError: 'str' object is not callable |
From: Benjamin R. <ben...@ou...> - 2012-01-12 22:07:27
|
On Thu, Jan 12, 2012 at 4:00 PM, Michael Rawlins <raw...@ya...>wrote: > > On 01/12/12 Ben Root wrote: > > On Thu, Jan 12, 2012 at 2:20 PM, Michael Rawlins <raw...@ya...>wrote: > > > On 01/12/12 Ben Root wrote: > > Just a quick suggestion for cleaning up your code, please look into the > argparse module to make command-line parsing so much easier to use. > <http://docs.python.org/dev/library/argparse.html> > http://docs.python.org/dev/library/argparse.html > > Ben Root > > > > Command line parsing? I'm new to python and matplotlib and was given this > code by a colleague. I've managed to make simple modifications. Don't know > enough yet to use the examples in the link you provide. > > I've simplified my code as much as possible. The first 50 lines make a > map. The code below that makes a 4 panel graphic. Seems that plt.figure > invokes a new plot window. But plt.semilogy, plt.loglog, and plt.hist do > not, keeping the panels in a single window. This is what I need. Trying now > to figure out how to transfer the fig=plt.figure line into the subplot > section, without popping up a new window. > > Mike > > > > Ok, a quick crash course: > > A "figure" can hold one or more "axes" (or subplots). When using "plt", > you can choose to make figures explicitly with the "fig = plt.figure()" > command or not. The same is true for axes objects. If you call a command > that needs a figure and/or an axes object to have been made and they don't > exist, then they are made for you automatically. Otherwise, the most > recently accessed figure/axes are assumed. This is why plt.hist(), > plt.semilog() and others are not creating a new figure window if one > already existed. > > Anyway, for your code, you do not want to bring in the plt.figure() call > into the subploting section. The example you were given takes advantage of > pyplot's implicit syntax (where it is implicitly assumed which axes/figure > object you are using). However, I personally do not like that approach, and > instead decided to show you an explicit style. I created a foobar() > function that takes a blank figure object and other parameters, creates the > four subplot axes and performs drawing on each of them. Note that the > title is for the subplot, not for the figure. If you want a title for the > figure above all the other subplots, use "fig.suptitle()". I then have a > loop where a figure is created each time, the foobar() function acts on > that figure, saved and then cleared before the next iteration. > > Note, I noticed you had "plt.show()" commented out before the call to > "plt.savefig()". Usually, you will want savefig() to come *before* show() > because closing the figure window will destroy the figure object, resulting > in a blank figure to save if done afterwards. > > I hope this is helpful! > Ben Root > > > > > OK starting to make sense. Yes very helpful. I think what's you've set up > might work, provided I can pass a filename for data into the function. > > At the moment I'm getting an error: > > NameError: name 'foobar' is not defined > > for the line with: foobar(fig, m, title) > > Mike > > My bad... I put the declaration of the foobar() function after it is called in the script. This isn't an issue if they are in separate scopes, but because "def foobar" is in the same scope as the call to it, it must have already been declared before it gets called. Just move that function to the area after all the imports. Ben Root |
From: Michael R. <raw...@ya...> - 2012-01-12 22:00:59
|
On 01/12/12 Ben Root wrote: On Thu, Jan 12, 2012 at 2:20 PM, Michael Rawlins <raw...@ya...> wrote: >On 01/12/12 Ben Root wrote: > >Just a quick suggestion for cleaning up your code, please look into the argparse module to make command-line parsing so much easier to use. > >http://docs.python.org/dev/library/argparse.html > > >Ben Root > > > >Command line parsing? I'm new to python and matplotlib and was given this code by a colleague. I've managed to make simple modifications. Don't know enough yet to use the examples in the link you provide. > >I've simplified my code as much as possible. The first 50 lines make a map. The code below that makes a 4 panel graphic. Seems that plt.figure invokes a new plot window. But plt.semilogy, plt.loglog, and plt.hist do not, keeping the panels in a single window. This is what I need. Trying now to figure out how to transfer the fig=plt.figure line into the subplot section, without popping up a new window. > >Mike > > > Ok, a quick crash course: A "figure" can hold one or more "axes" (or subplots). When using "plt", you can choose to make figures explicitly with the "fig = plt.figure()" command or not. The same is true for axes objects. If you call a command that needs a figure and/or an axes object to have been made and they don't exist, then they are made for you automatically. Otherwise, the most recently accessed figure/axes are assumed. This is why plt.hist(), plt.semilog() and others are not creating a new figure window if one already existed. Anyway, for your code, you do not want to bring in the plt.figure() call into the subploting section. The example you were given takes advantage of pyplot's implicit syntax (where it is implicitly assumed which axes/figure object you are using). However, I personally do not like that approach, and instead decided to show you an explicit style. I created a foobar() function that takes a blank figure object and other parameters, creates the four subplot axes and performs drawing on each of them. Note that the title is for the subplot, not for the figure. If you want a title for the figure above all the other subplots, use "fig.suptitle()". I then have a loop where a figure is created each time, the foobar() function acts on that figure, saved and then cleared before the next iteration. Note, I noticed you had "plt.show()" commented out before the call to "plt.savefig()". Usually, you will want savefig() to come *before* show() because closing the figure window will destroy the figure object, resulting in a blank figure to save if done afterwards. I hope this is helpful! Ben Root OK starting to make sense. Yes very helpful. I think what's you've set up might work, provided I can pass a filename for data into the function. At the moment I'm getting an error: NameError: name 'foobar' is not defined for the line with: foobar(fig, m, title) Mike |
From: Benjamin R. <ben...@ou...> - 2012-01-12 21:00:29
|
On Thu, Jan 12, 2012 at 2:20 PM, Michael Rawlins <raw...@ya...>wrote: > > On 01/12/12 Ben Root wrote: > > Just a quick suggestion for cleaning up your code, please look into the > argparse module to make command-line parsing so much easier to use. > <http://docs.python.org/dev/library/argparse.html> > http://docs.python.org/dev/library/argparse.html > > Ben Root > > > > Command line parsing? I'm new to python and matplotlib and was given this > code by a colleague. I've managed to make simple modifications. Don't know > enough yet to use the examples in the link you provide. > > I've simplified my code as much as possible. The first 50 lines make a > map. The code below that makes a 4 panel graphic. Seems that plt.figure > invokes a new plot window. But plt.semilogy, plt.loglog, and plt.hist do > not, keeping the panels in a single window. This is what I need. Trying now > to figure out how to transfer the fig=plt.figure line into the subplot > section, without popping up a new window. > > Mike > > > Ok, a quick crash course: A "figure" can hold one or more "axes" (or subplots). When using "plt", you can choose to make figures explicitly with the "fig = plt.figure()" command or not. The same is true for axes objects. If you call a command that needs a figure and/or an axes object to have been made and they don't exist, then they are made for you automatically. Otherwise, the most recently accessed figure/axes are assumed. This is why plt.hist(), plt.semilog() and others are not creating a new figure window if one already existed. Anyway, for your code, you do not want to bring in the plt.figure() call into the subploting section. The example you were given takes advantage of pyplot's implicit syntax (where it is implicitly assumed which axes/figure object you are using). However, I personally do not like that approach, and instead decided to show you an explicit style. I created a foobar() function that takes a blank figure object and other parameters, creates the four subplot axes and performs drawing on each of them. Note that the title is for the subplot, not for the figure. If you want a title for the figure above all the other subplots, use "fig.suptitle()". I then have a loop where a figure is created each time, the foobar() function acts on that figure, saved and then cleared before the next iteration. Note, I noticed you had "plt.show()" commented out before the call to "plt.savefig()". Usually, you will want savefig() to come *before* show() because closing the figure window will destroy the figure object, resulting in a blank figure to save if done afterwards. I hope this is helpful! Ben Root verbose=0 #verbose=2 says a bit more import sys,getopt from mpl_toolkits.basemap import Basemap, shiftgrid, cm #from netCDF3 import Dataset as NetCDFFile from mpl_toolkits.basemap import NetCDFFile from pylab import * import matplotlib.pyplot as plt # Here set map title and the file containing gridded data to plot thetitle='Map #1' ncfile = NetCDFFile('simple_xy.nc', 'r') # Here's filename startlon=-180 #default assumption for starting longitude m = Basemap(llcrnrlon=-80.6,llcrnrlat=38.4,urcrnrlon=-66.0,urcrnrlat=47.7,\ resolution='l',area_thresh=1000.,projection='lcc',\ lat_1=65.,lon_0=-73.3) xtxt=200000. #offset for text ytxt=200000. parallels = arange(38.,48.,2.) meridians = arange(-80.,-64.,2.) if verbose>1: print m.__doc__ xsize = rcParams['figure.figsize'][0] for fig_index in range(140) : fig=plt.figure(figsize=(xsize,m.aspect*xsize)) fig.subplots_adjust(hspace=0.4, wspace=0.4) if not thetitle : title = thevar + extratext else : title = thetitle foobar(fig, m, title) fig.savefig("map_%d.eps" % fig_index) plt.clf() # Clears the figure object def foobar(fig, m, title) : fig.subplots_adjust(hspace=0.4,wspace=0.4) ax = fig.add_subplot(2,2,1) # draw coastlines and political boundaries. m.drawcoastlines(ax=ax) m.drawcountries(ax=ax) m.drawstates(ax=ax) title(title) x = linspace(0,10,101) y = exp(x) l1 = ax.semilogy(x,y,color='m',linewidth=2) ax = fig.add_subplot(2,2,2) y = x**-1.67 l1 = ax.loglog(x,y) ax = fig.add_subplot(2,2,3) x = arange(1001) y = mod(x,2.87) l1 = ax.hist(y,color='r',rwidth = 0.8) ax = fig.add_subplot(2,2,4) l1 = plt.hist(y,bins=25,normed=True,cumulative=True,orientation='horizontal') |
From: Michael R. <raw...@ya...> - 2012-01-12 20:21:55
|
On 01/12/12 Ben Root wrote: Just a quick suggestion for cleaning up your code, please look into the argparse module to make command-line parsing so much easier to use. http://docs.python.org/dev/library/argparse.html Ben Root Command line parsing? I'm new to python and matplotlib and was given this code by a colleague. I've managed to make simple modifications. Don't know enough yet to use the examples in the link you provide. I've simplified my code as much as possible. The first 50 lines make a map. The code below that makes a 4 panel graphic. Seems that plt.figure invokes a new plot window. But plt.semilogy, plt.loglog, and plt.hist do not, keeping the panels in a single window. This is what I need. Trying now to figure out how to transfer the fig=plt.figure line into the subplot section, without popping up a new window. Mike verbose=0 #verbose=2 says a bit more import sys,getopt from mpl_toolkits.basemap import Basemap, shiftgrid, cm #from netCDF3 import Dataset as NetCDFFile from mpl_toolkits.basemap import NetCDFFile from pylab import * import matplotlib.pyplot as plt #fg = plt.figure(figsize=(10,8)) #adj = plt.subplots_adjust(hspace=0.4,wspace=0.4) #sp = plt.subplot(2,2,1) # Here set map title and the file containing gridded data to plot thetitle='Map #1' ncfile = NetCDFFile('simple_xy.nc', 'r') # Here's filename startlon=-180 #default assumption for starting longitude m = Basemap(llcrnrlon=-80.6,llcrnrlat=38.4,urcrnrlon=-66.0,urcrnrlat=47.7,\ resolution='l',area_thresh=1000.,projection='lcc',\ lat_1=65.,lon_0=-73.3) xtxt=200000. #offset for text ytxt=200000. parallels = arange(38.,48.,2.) meridians = arange(-80.,-64.,2.) if verbose>1: print m.__doc__ xsize = rcParams['figure.figsize'][0] fig=plt.figure(figsize=(xsize,m.aspect*xsize)) ax = fig.add_axes([0.07,0.00,0.86,1.0],axisbg='white') axes(ax) # make the original axes current again # draw coastlines and political boundaries. m.drawcoastlines() m.drawcountries() m.drawstates() if not thetitle: title(thevar+extratext) else: title(thetitle) #plt.show() ########################################################################## # Example: http://physics.nmt.edu/~raymond/software/python_notes/paper004.html sp = plt.subplot(2,2,1) x = linspace(0,10,101) y = exp(x) l1 = plt.semilogy(x,y,color='m',linewidth=2) sp = plt.subplot(2,2,2) y = x**-1.67 l1 = plt.loglog(x,y) sp = plt.subplot(2,2,3) x = arange(1001) y = mod(x,2.87) l1 = plt.hist(y,color='r',rwidth = 0.8) sp = plt.subplot(2,2,4) l1 = plt.hist(y,bins=25,normed=True,cumulative=True,orientation='horizontal') plt.show() #plt.savefig('map.eps') Just a quick suggestion for cleaning up your code, please look into the argparse module to make command-line parsing so much easier to use. |
From: Christophe P. <xo...@th...> - 2012-01-12 18:47:36
|
On Jan 12, 2012, at 10:18 AM, Benjamin Root wrote: > fig.savefig('foobar.png", bbox_inches='tight', pad_inches=0.25, bbox_extra_artists=[leg]) [...] > In mpl v1.1.0, we introduced a function called "tight_layout" which should help with such things. Admittedly, it would be nice if tight_layout did something similar to bbox_inches='tight' and accept a list of additional artist objects to consider, but it does not do that right now. Both of those worked wonderfully... thanks very much! -- -- Christophe Pettus xo...@th... |
From: Benjamin R. <ben...@ou...> - 2012-01-12 18:18:59
|
On Thu, Jan 12, 2012 at 12:09 PM, Christophe Pettus <xo...@th...>wrote: > My apologies for two totally noob questions, but I can't quite seem to > find these in the docs; a pointer would be great... > > No problem. That is what we are here for. > 1. I would like to position a legend outside of the main plot area. The > positioning part works great, but the legend is clipped to the pre-existing > figure dimensions; how can I expand the figure size horizontally to allow > for the legend? (And is there any way of auto-sizing the figure to > include all of the stuff within it?) > > This is actually something I deal with regularly. I haven't found a good solution for the interactive viewing, but when saving a figure to an image file, you can do something like this (assume that the legend object is stored in a variable named "leg"): fig.savefig('foobar.png", bbox_inches='tight', pad_inches=0.25, bbox_extra_artists=[leg]) > 2. In the horizontal bar chart I previously mentioned, the labels on the > ticks on the Y-axis are clipped on the left side, as they are too long to > fit into the pre-existing space. What's the best way of allowing more > space for the tick labels, either by contracting the chart itself or > expanding the figure? > > In mpl v1.1.0, we introduced a function called "tight_layout" which should help with such things. Admittedly, it would be nice if tight_layout did something similar to bbox_inches='tight' and accept a list of additional artist objects to consider, but it does not do that right now. Cheers! Ben Root |
From: Christophe P. <xo...@th...> - 2012-01-12 18:09:27
|
My apologies for two totally noob questions, but I can't quite seem to find these in the docs; a pointer would be great... 1. I would like to position a legend outside of the main plot area. The positioning part works great, but the legend is clipped to the pre-existing figure dimensions; how can I expand the figure size horizontally to allow for the legend? (And is there any way of auto-sizing the figure to include all of the stuff within it?) 2. In the horizontal bar chart I previously mentioned, the labels on the ticks on the Y-axis are clipped on the left side, as they are too long to fit into the pre-existing space. What's the best way of allowing more space for the tick labels, either by contracting the chart itself or expanding the figure? Thanks in advance, -- -- Christophe Pettus xo...@th... |
From: Benjamin R. <ben...@ou...> - 2012-01-12 18:00:54
|
Just a quick suggestion for cleaning up your code, please look into the argparse module to make command-line parsing so much easier to use. http://docs.python.org/dev/library/argparse.html Ben Root |
From: Christophe P. <xo...@th...> - 2012-01-12 17:55:18
|
On Jan 12, 2012, at 9:31 AM, Benjamin Root wrote: > D'oh! Of course, I missed that tiny little detail. Hmm, so the auto-detection would have been useless in this case because the scale of the axes was set after the fact. > > Maybe the "log" kwarg should be in a more prominent location in the docstring? Moving the call to set_xscale('log') to before the calls to barh fixes the problem nicely... thank you! -- -- Christophe Pettus xo...@th... |
From: Michael R. <raw...@ya...> - 2012-01-12 17:54:39
|
I have about 140 lines of code that makes a map. I'd like to turn it into a program which makes a multiple panel (map) figure. I understand that subplot will help to do this. Ideally I would like the 140 lines to be like a subroutine called in a loop. In the current code there are two variable which would be passed to the subroutine, thetitle and ncfile. These are only two things different for each panel. So something like: do irow = 1, 3 do icolumn = 1, 3 call mapping code (thetitle,ncfile) enddo enddo Here is the code. If the above method is not possible, I assume I'll need to repeat the 140 lines N times, where N is the number of panels. TIA Mike ############################################################################ verbose=0 #verbose=2 says a bit more import sys,getopt from mpl_toolkits.basemap import Basemap, shiftgrid, cm #from netCDF3 import Dataset as NetCDFFile from mpl_toolkits.basemap import NetCDFFile from pylab import * #from matplotlib.mlab import csv2rec alloptions, otherargs= getopt.getopt(sys.argv[1:],'ro:p:X:Y:v:t:l:u:n:') # note the : after o and p proj='lam' #plotfile=None #plotfile='testmap2.png' usejetrev=False colorbounds=[None,None] extratext="" xvar=None yvar=None thevar=None # Here set map title and the file containing gridded data to plot thetitle='Map Title' ncfile = NetCDFFile('simple_xy.nc', 'r') # Here's filename therec=None thelev=None cbot=None ctop=None startlon=-180 #default assumption for starting longitude for theopt,thearg in alloptions: print theopt,thearg if theopt=='-o': # -o needs filename after it, which is now thearg plotfile=thearg elif theopt=='-p': proj=thearg elif theopt=='-X': xvar=thearg elif theopt=='-Y': yvar=thearg elif theopt=='-v': thevar=thearg elif theopt=='-t': thetitle=thearg elif theopt=='-l': cbot=thearg elif theopt=='-u': ctop=thearg elif theopt=='-n': therec=thearg elif theopt=='-m': thelev=thearg elif theopt=='-r': usejetrev=True else: #something went wrong print "hmm, what are these??? ", theopt, thearg sys.exit() print "\nPlotting, please wait...maybe more than 10 seconds" if proj=='lam': #Lambert Conformal m = Basemap(llcrnrlon=-80.6,llcrnrlat=38.4,urcrnrlon=-66.0,urcrnrlat=47.7,\ resolution='l',area_thresh=1000.,projection='lcc',\ lat_1=65.,lon_0=-73.3) xtxt=200000. #offset for text ytxt=200000. parallels = arange(38.,48.,2.) meridians = arange(-80.,-64.,2.) else: #cylindrical is default # m = Basemap(llcrnrlon=-180.,llcrnrlat=-90,urcrnrlon=180.,urcrnrlat=90.,\ # resolution='c',area_thresh=10000.,projection='cyl') m = Basemap(llcrnrlon=startlon,llcrnrlat=-90,urcrnrlon=startlon+360.,urcrnrlat=90.,\ resolution='c',area_thresh=10000.,projection='cyl') xtxt=1. ytxt=0. parallels = arange(-90.,90.,30.) if startlon==-180: meridians = arange(-180.,180.,60.) else: meridians = arange(0.,360.,60.) if verbose>1: print m.__doc__ xsize = rcParams['figure.figsize'][0] fig=figure(figsize=(xsize,m.aspect*xsize)) #ax = fig.add_axes([0.08,0.1,0.7,0.7],axisbg='white') ax = fig.add_axes([0.07,0.00,0.86,1.0],axisbg='white') # make a pcolor plot. #x, y = m(lons, lats) #p = m.pcolor(x,y,maskdat,shading='flat',cmap=cmap) #clim(*colorbounds) # axes units units are left, bottom, width, height #cax = axes([0.85, 0.1, 0.05, 0.7]) # colorbar axes for map w/ no graticule #cax = axes([0.88, 0.1, 0.06, 0.81]) # colorbar axes for map w/ graticule axes(ax) # make the original axes current again ######### Plot symbol at station locations ################# # draw coastlines and political boundaries. m.drawcoastlines() m.drawcountries() m.drawstates() # draw parallels and meridians. # label on left, right and bottom of map. #m.drawparallels(parallels,labels=[1,0,0,0]) #m.drawmeridians(meridians,labels=[1,1,0,1]) if not thetitle: title(thevar+extratext) else: title(thetitle) #data = csv2rec('latlon_GHCN.txt',delimiter=' ',names=['lat','lon']) #for i in range(len(data)): # x,y=m(data['lon'][i],data['lat'][i]) # Translate to basemap (Lambert) coordinate space ## ax.text(x,y,'.') # plot(x,y,color='black',marker='.',markersize=6.0) xpt,ypt = m(-75.0,43.0) ax.text(xpt,ypt,'*') #if plotfile: # savefig(plotfile, dpi=72, facecolor='w', bbox_inches='tight', edgecolor='w', orientation='portrait') #else: # show() #plt.savefig('map.png') plt.savefig('map.eps') show() # comment show to mass produce |
From: Fabien L. <laf...@gm...> - 2012-01-12 17:42:53
|
I'm recording live data and I want to record at the same moment the time (to plot MyData Vs Time). Do you know the bast way to do it because it exists a lot of different classes for that? Fabien |
From: Benjamin R. <ben...@ou...> - 2012-01-12 17:31:36
|
On Thu, Jan 12, 2012 at 11:20 AM, Tony Yu <ts...@gm...> wrote: > > > On Thu, Jan 12, 2012 at 12:14 PM, Benjamin Root <ben...@ou...> wrote: > >> >> >> On Thu, Jan 12, 2012 at 11:04 AM, Tony Yu <ts...@gm...> wrote: >> >>> >>> >>> On Thu, Jan 12, 2012 at 11:39 AM, Christophe Pettus <xo...@th...>wrote: >>> >>>> >>>> On Jan 12, 2012, at 7:38 AM, Benjamin Root wrote: >>>> > Does everything work correctly if it is vertical? In other words, >>>> use bar() and set the y-axis to log scale? An example script would be >>>> useful. >>>> >>>> No, it doesn't appear to work as a vertical bar chart, either. >>>> >>>> I've attached a test case below. The results I get running it with the >>>> X-axis as log are: >>>> >>>> http://thebuild.com/matlabtest/matlabtest-log.pdf >>>> >>>> Commenting out the call to ax.set_xscale('log') gives me: >>>> >>>> http://thebuild.com/matlabtest/matlabtest.pdf >>>> >>>> Thanks! >>>> >>>> -- >>>> >>>> import numpy as np >>>> import matplotlib >>>> from matplotlib.font_manager import FontProperties >>>> >>>> import random >>>> >>>> matplotlib.use('PDF') >>>> >>>> import matplotlib.pyplot as plot >>>> >>>> small_font = FontProperties() >>>> small_font.set_size('xx-small') >>>> >>>> ind = np.arange(20) >>>> >>>> label = [ str(r) for r in ind ] >>>> data1 = [ float(random.random()*100000000) for r in ind ] >>>> data2 = [ float(random.random()*100000000) for r in ind ] >>>> >>>> width = 0.25 >>>> >>>> fig = plot.figure() >>>> ax = fig.add_subplot(111) >>>> >>>> ax.set_title('Table Title') >>>> ax.set_xlabel('X Label') >>>> >>>> ax.barh(ind, data1, width, linewidth=0, color='blue') >>>> ax.barh(ind, data2, width, left=data1, linewidth=0, color='yellow') >>>> ax.set_yticks(ind + width/2) >>>> ax.set_yticklabels(label, fontproperties=small_font) >>>> ax.set_xscale('log') >>>> >>>> plot.savefig('matlabtest-log.pdf') >>>> >>>> -- >>>> -- Christophe Pettus >>>> >>> >>> Isn't this just because zero isn't defined in log scale? The second set >>> of data plots fine because it doesn't start at zero, but it isn't obvious >>> what to do with the first set of data. If you just want to make this work, >>> you can set the left parameter of the first `barh` call to some constant; >>> for example: >>> >>> >>> origin = 10**np.floor(np.log10(np.min(data1))) >>> >>> ax.barh(ind, data1, width, left=origin, linewidth=0, color='blue') >>> >>> -Tony >>> >> >> Right, but I could have sworn that we got this fixed at some point. >> There is logic in the bar() function to detect logscale and handle it >> appropriately. But I don't know what is not working here. >> >> Ben Root >> >> > Ahh, I didn't know this. It looks like setting `log=True` in `barh` works. > > -Tony > > D'oh! Of course, I missed that tiny little detail. Hmm, so the auto-detection would have been useless in this case because the scale of the axes was set after the fact. Maybe the "log" kwarg should be in a more prominent location in the docstring? Ben Root |
From: G J. <gle...@gm...> - 2012-01-12 17:25:29
|
I think this is because the bar is going from zero to your value, so the left edge of the rectangle becomes log(0). I see this when using the 'k' and 'l' keys to interactively put a histogram on a log scale. Passing in log=True for hist fixes this. I'm sure there's something similar that can be done for bar/barh. G On Thu, Jan 12, 2012 at 7:03 AM, Christophe Pettus <xo...@th...> wrote: > I'm running into something odd in Matplotlib 1.1. In drawing a horizontal > bar chart (barh), if the x-axis scale is set to log, the rectangles are not > drawn and filled; I just get small ticks at the right-hand position where > the rectangle should end. Interestingly, if I add a second, stacked barh > to the same axes, that second set of rectangles draws fine, even though the > first does not. > > If I simply comment out the call setting the x axis to log, it works > properly. > > Any thoughts? > -- > -- Christophe Pettus > xo...@th... > > > > ------------------------------------------------------------------------------ > RSA(R) Conference 2012 > Mar 27 - Feb 2 > Save $400 by Jan. 27 > Register now! > http://p.sf.net/sfu/rsa-sfdev2dev2 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Tony Yu <ts...@gm...> - 2012-01-12 17:20:33
|
On Thu, Jan 12, 2012 at 12:14 PM, Benjamin Root <ben...@ou...> wrote: > > > On Thu, Jan 12, 2012 at 11:04 AM, Tony Yu <ts...@gm...> wrote: > >> >> >> On Thu, Jan 12, 2012 at 11:39 AM, Christophe Pettus <xo...@th...>wrote: >> >>> >>> On Jan 12, 2012, at 7:38 AM, Benjamin Root wrote: >>> > Does everything work correctly if it is vertical? In other words, use >>> bar() and set the y-axis to log scale? An example script would be useful. >>> >>> No, it doesn't appear to work as a vertical bar chart, either. >>> >>> I've attached a test case below. The results I get running it with the >>> X-axis as log are: >>> >>> http://thebuild.com/matlabtest/matlabtest-log.pdf >>> >>> Commenting out the call to ax.set_xscale('log') gives me: >>> >>> http://thebuild.com/matlabtest/matlabtest.pdf >>> >>> Thanks! >>> >>> -- >>> >>> import numpy as np >>> import matplotlib >>> from matplotlib.font_manager import FontProperties >>> >>> import random >>> >>> matplotlib.use('PDF') >>> >>> import matplotlib.pyplot as plot >>> >>> small_font = FontProperties() >>> small_font.set_size('xx-small') >>> >>> ind = np.arange(20) >>> >>> label = [ str(r) for r in ind ] >>> data1 = [ float(random.random()*100000000) for r in ind ] >>> data2 = [ float(random.random()*100000000) for r in ind ] >>> >>> width = 0.25 >>> >>> fig = plot.figure() >>> ax = fig.add_subplot(111) >>> >>> ax.set_title('Table Title') >>> ax.set_xlabel('X Label') >>> >>> ax.barh(ind, data1, width, linewidth=0, color='blue') >>> ax.barh(ind, data2, width, left=data1, linewidth=0, color='yellow') >>> ax.set_yticks(ind + width/2) >>> ax.set_yticklabels(label, fontproperties=small_font) >>> ax.set_xscale('log') >>> >>> plot.savefig('matlabtest-log.pdf') >>> >>> -- >>> -- Christophe Pettus >>> >> >> Isn't this just because zero isn't defined in log scale? The second set >> of data plots fine because it doesn't start at zero, but it isn't obvious >> what to do with the first set of data. If you just want to make this work, >> you can set the left parameter of the first `barh` call to some constant; >> for example: >> >> >>> origin = 10**np.floor(np.log10(np.min(data1))) >> >>> ax.barh(ind, data1, width, left=origin, linewidth=0, color='blue') >> >> -Tony >> > > Right, but I could have sworn that we got this fixed at some point. There > is logic in the bar() function to detect logscale and handle it > appropriately. But I don't know what is not working here. > > Ben Root > > Ahh, I didn't know this. It looks like setting `log=True` in `barh` works. -Tony |
From: Benjamin R. <ben...@ou...> - 2012-01-12 17:14:34
|
On Thu, Jan 12, 2012 at 11:04 AM, Tony Yu <ts...@gm...> wrote: > > > On Thu, Jan 12, 2012 at 11:39 AM, Christophe Pettus <xo...@th...>wrote: > >> >> On Jan 12, 2012, at 7:38 AM, Benjamin Root wrote: >> > Does everything work correctly if it is vertical? In other words, use >> bar() and set the y-axis to log scale? An example script would be useful. >> >> No, it doesn't appear to work as a vertical bar chart, either. >> >> I've attached a test case below. The results I get running it with the >> X-axis as log are: >> >> http://thebuild.com/matlabtest/matlabtest-log.pdf >> >> Commenting out the call to ax.set_xscale('log') gives me: >> >> http://thebuild.com/matlabtest/matlabtest.pdf >> >> Thanks! >> >> -- >> >> import numpy as np >> import matplotlib >> from matplotlib.font_manager import FontProperties >> >> import random >> >> matplotlib.use('PDF') >> >> import matplotlib.pyplot as plot >> >> small_font = FontProperties() >> small_font.set_size('xx-small') >> >> ind = np.arange(20) >> >> label = [ str(r) for r in ind ] >> data1 = [ float(random.random()*100000000) for r in ind ] >> data2 = [ float(random.random()*100000000) for r in ind ] >> >> width = 0.25 >> >> fig = plot.figure() >> ax = fig.add_subplot(111) >> >> ax.set_title('Table Title') >> ax.set_xlabel('X Label') >> >> ax.barh(ind, data1, width, linewidth=0, color='blue') >> ax.barh(ind, data2, width, left=data1, linewidth=0, color='yellow') >> ax.set_yticks(ind + width/2) >> ax.set_yticklabels(label, fontproperties=small_font) >> ax.set_xscale('log') >> >> plot.savefig('matlabtest-log.pdf') >> >> -- >> -- Christophe Pettus >> > > Isn't this just because zero isn't defined in log scale? The second set of > data plots fine because it doesn't start at zero, but it isn't obvious what > to do with the first set of data. If you just want to make this work, you > can set the left parameter of the first `barh` call to some constant; for > example: > > >>> origin = 10**np.floor(np.log10(np.min(data1))) > >>> ax.barh(ind, data1, width, left=origin, linewidth=0, color='blue') > > -Tony > Right, but I could have sworn that we got this fixed at some point. There is logic in the bar() function to detect logscale and handle it appropriately. But I don't know what is not working here. Ben Root |
From: Yoshiki V. B. <yos...@gm...> - 2012-01-12 17:07:37
|
Hello Matplotlib group, I'm currently working with Matplotlib and with python 2.7.1 (from python.org) and I realized that the version of matplotlib that I downloaded has no x86 architecture support. This is what the installation looks like: bash-3.2$ otool -L /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/ft2font.so /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/ft2font.so (architecture ppc): /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.3) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version 47.1.0) /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/ft2font.so (architecture i386): /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.3) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) The error I'm getting is the following: File "/Users/yoshikivazquezbaeza1/svn_sw/qiime/scripts//plot_taxa_summary.py", line 19, in <module> from qiime.plot_taxa_summary import make_all_charts File "/Users/yoshikivazquezbaeza1/svn_sw/qiime/qiime/plot_taxa_summary.py", line 23, in <module> from matplotlib.font_manager import FontProperties File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/font_manager.py", line 52, in <module> from matplotlib import ft2font ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/ft2font.so, 2): no suitable image found. Did find: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/ft2font.so: no matching architecture in universal wrapper I wanted to know if there will be a future release of the mpkg to install matplotlib on the mac. Any help will be greatly appreciated. Yoshiki. |
From: Tony Yu <ts...@gm...> - 2012-01-12 17:04:21
|
On Thu, Jan 12, 2012 at 11:39 AM, Christophe Pettus <xo...@th...>wrote: > > On Jan 12, 2012, at 7:38 AM, Benjamin Root wrote: > > Does everything work correctly if it is vertical? In other words, use > bar() and set the y-axis to log scale? An example script would be useful. > > No, it doesn't appear to work as a vertical bar chart, either. > > I've attached a test case below. The results I get running it with the > X-axis as log are: > > http://thebuild.com/matlabtest/matlabtest-log.pdf > > Commenting out the call to ax.set_xscale('log') gives me: > > http://thebuild.com/matlabtest/matlabtest.pdf > > Thanks! > > -- > > import numpy as np > import matplotlib > from matplotlib.font_manager import FontProperties > > import random > > matplotlib.use('PDF') > > import matplotlib.pyplot as plot > > small_font = FontProperties() > small_font.set_size('xx-small') > > ind = np.arange(20) > > label = [ str(r) for r in ind ] > data1 = [ float(random.random()*100000000) for r in ind ] > data2 = [ float(random.random()*100000000) for r in ind ] > > width = 0.25 > > fig = plot.figure() > ax = fig.add_subplot(111) > > ax.set_title('Table Title') > ax.set_xlabel('X Label') > > ax.barh(ind, data1, width, linewidth=0, color='blue') > ax.barh(ind, data2, width, left=data1, linewidth=0, color='yellow') > ax.set_yticks(ind + width/2) > ax.set_yticklabels(label, fontproperties=small_font) > ax.set_xscale('log') > > plot.savefig('matlabtest-log.pdf') > > -- > -- Christophe Pettus > Isn't this just because zero isn't defined in log scale? The second set of data plots fine because it doesn't start at zero, but it isn't obvious what to do with the first set of data. If you just want to make this work, you can set the left parameter of the first `barh` call to some constant; for example: >>> origin = 10**np.floor(np.log10(np.min(data1))) >>> ax.barh(ind, data1, width, left=origin, linewidth=0, color='blue') -Tony |
From: Christophe P. <xo...@th...> - 2012-01-12 16:40:01
|
On Jan 12, 2012, at 7:38 AM, Benjamin Root wrote: > Does everything work correctly if it is vertical? In other words, use bar() and set the y-axis to log scale? An example script would be useful. No, it doesn't appear to work as a vertical bar chart, either. I've attached a test case below. The results I get running it with the X-axis as log are: http://thebuild.com/matlabtest/matlabtest-log.pdf Commenting out the call to ax.set_xscale('log') gives me: http://thebuild.com/matlabtest/matlabtest.pdf Thanks! -- import numpy as np import matplotlib from matplotlib.font_manager import FontProperties import random matplotlib.use('PDF') import matplotlib.pyplot as plot small_font = FontProperties() small_font.set_size('xx-small') ind = np.arange(20) label = [ str(r) for r in ind ] data1 = [ float(random.random()*100000000) for r in ind ] data2 = [ float(random.random()*100000000) for r in ind ] width = 0.25 fig = plot.figure() ax = fig.add_subplot(111) ax.set_title('Table Title') ax.set_xlabel('X Label') ax.barh(ind, data1, width, linewidth=0, color='blue') ax.barh(ind, data2, width, left=data1, linewidth=0, color='yellow') ax.set_yticks(ind + width/2) ax.set_yticklabels(label, fontproperties=small_font) ax.set_xscale('log') plot.savefig('matlabtest-log.pdf') -- -- Christophe Pettus xo...@th... |
From: Benjamin R. <ben...@ou...> - 2012-01-12 15:39:27
|
On Thu, Jan 12, 2012 at 9:03 AM, Christophe Pettus <xo...@th...> wrote: > I'm running into something odd in Matplotlib 1.1. In drawing a horizontal > bar chart (barh), if the x-axis scale is set to log, the rectangles are not > drawn and filled; I just get small ticks at the right-hand position where > the rectangle should end. Interestingly, if I add a second, stacked barh > to the same axes, that second set of rectangles draws fine, even though the > first does not. > > If I simply comment out the call setting the x axis to log, it works > properly. > > Any thoughts? > Does everything work correctly if it is vertical? In other words, use bar() and set the y-axis to log scale? An example script would be useful. Ben Root |
From: Christophe P. <xo...@th...> - 2012-01-12 15:33:00
|
I'm running into something odd in Matplotlib 1.1. In drawing a horizontal bar chart (barh), if the x-axis scale is set to log, the rectangles are not drawn and filled; I just get small ticks at the right-hand position where the rectangle should end. Interestingly, if I add a second, stacked barh to the same axes, that second set of rectangles draws fine, even though the first does not. If I simply comment out the call setting the x axis to log, it works properly. Any thoughts? -- -- Christophe Pettus xo...@th... |
From: Petro <x....@gm...> - 2012-01-12 11:07:26
|
Paul Ivanov <piv...@gm...> writes: Thanks. The tiling manager was the guilty one (I use AWESOME). The set_size command did not work: Traceback (most recent call last): File "/tmp/py2262sxl", line 45, in <module> fig.set_size_inches(pylab.rcParams['figure.figsize'], forward='True') File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 447, in set_size_inches manager.resize(int(canvasw), int(canvash)) TypeError: resize() takes exactly 2 arguments (3 given) But once I mage have made the figure foating, it took the correct size. Best Petro > Hi Petro, > > Petro, on 2012-01-11 15:39, wrote: >> Can I set a figure to appear on my screen in the same way as it is saved >> in png file? > > You sure can. A likely reason these two don't appear the > same is that your 'figure.dpi' rcParam is not the same as the > 'savefig.dpi' parameter. The same may apply to 'figure.facecolor' > and 'figure.edgecolor' and their savefig counterparts. > > Another reason might be that you're using a tiling window > manager. I use xmonad, and it will resize figures so that they > all fit on the screen without overlap, and since I put the call > to plt.show() *after* savefig, the figures get saved as whatever > size they were originally created as, but then show up as > whatever space they can fit into given that my window manager > resized them. You can resize them back, assuming that 'f' is the > Figure instance, using something like: > > f.set_size_inches(plt.rcParams['figure.figsize'], forward=True) > > best, -- Petro Khoroshyy |
From: Jae-Joon L. <lee...@gm...> - 2012-01-12 08:17:57
|
I know this is an old post, but just in case. For arrowstyle="<->", they are just lines (well, not exactly as a matter of fact). So, what you need is to change their linewidths. You may do arrow1=pylab.annotate("", xytext=(0.1,0.1), xy=(0.9,0.9),fontsize=8, arrowprops=dict(arrowstyle="<->,head_length=1,head_width=0.8", # I'm changing the head_length and head_width to make the arrow more visible. linewidth=3)) On the other hand, the underlying artist associated with the arrow can be accessed by *arrow1.arrow_patch*. Note that it is actually an instance of Patch. Regards, -JJ On Fri, Dec 16, 2011 at 8:32 PM, Petro <x....@gm...> wrote: > How can I change linewidth of this arrow? > arrow1=pylab.annotate("", xytext=(-3500,-1e8), > xy=(-3500,8e8),fontsize=8,arrowprops=dict(arrowstyle="<->")) > Thank you in advance. > Petro > > > > ------------------------------------------------------------------------------ > Learn Windows Azure Live! Tuesday, Dec 13, 2011 > Microsoft is holding a special Learn Windows Azure training event for > developers. It will provide a great way to learn Windows Azure and what it > provides. You can attend the event by watching it streamed LIVE online. > Learn more at http://p.sf.net/sfu/ms-windowsazure > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Paul I. <piv...@gm...> - 2012-01-12 01:51:15
|
Hi Petro, Petro, on 2012-01-11 15:39, wrote: > Can I set a figure to appear on my screen in the same way as it is saved > in png file? You sure can. A likely reason these two don't appear the same is that your 'figure.dpi' rcParam is not the same as the 'savefig.dpi' parameter. The same may apply to 'figure.facecolor' and 'figure.edgecolor' and their savefig counterparts. Another reason might be that you're using a tiling window manager. I use xmonad, and it will resize figures so that they all fit on the screen without overlap, and since I put the call to plt.show() *after* savefig, the figures get saved as whatever size they were originally created as, but then show up as whatever space they can fit into given that my window manager resized them. You can resize them back, assuming that 'f' is the Figure instance, using something like: f.set_size_inches(plt.rcParams['figure.figsize'], forward=True) best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |