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
|
3
(6) |
4
(2) |
5
(7) |
6
(9) |
7
(8) |
8
(1) |
9
(1) |
10
(1) |
11
(11) |
12
(1) |
13
(11) |
14
(7) |
15
(1) |
16
|
17
|
18
(1) |
19
|
20
(1) |
21
(2) |
22
(1) |
23
(1) |
24
(2) |
25
(3) |
26
(2) |
27
(2) |
28
(2) |
29
(5) |
30
(1) |
|
|
|
|
|
|
From: Daniel M. <dan...@go...> - 2013-06-14 17:56:34
|
ah, should have been: ax1.grid() ax2.grid() ax1.yaxis.grid(False) |
From: Daniel M. <dan...@go...> - 2013-06-14 17:51:29
|
Hi Paul, thanks for your efforts, I've figured it out by myself by now, with you pieces of code: ax1.grid() ax2.grid() ax1.xaxis.grid(False) does the trick :) |
From: Paul H. <pmh...@gm...> - 2013-06-14 15:56:01
|
On Thu, Jun 13, 2013 at 1:33 PM, Daniel Mader < dan...@go...> wrote: > Hi Paul, > > I've modified your suggestion a little, since I don't want a grid for the > primary axis at all -- unfortunately to no avail, i.e. no grid line at all: > > import numpy > > import matplotlib > > matplotlib.use('agg') > > import matplotlib.pyplot as plt > > > datax = numpy.arange(50) > > data1 = numpy.sin(datax)*1.5 > > data2 = datax**2 > > > plt.close('all') > > > fig = plt.figure() > > ax1 = fig.add_subplot(111) > > ax2 = ax1.twinx() > > > ax1.plot(datax, data1, 'x') > > ax2.plot(datax, data2, '--') > > > #for ax in [ax1, ax2]: > > # ax.xaxis.grid(True, which='both') # `which` can be 'minor', 'major', or > 'both' > > # ax.yaxis.grid(True, which='both') > > > ax2.xaxis.grid(True, which='both') > > ax2.yaxis.grid(True, which='both') > > > fig.savefig('twinxgrid.png') > > #fig.show() > > > Try throwing this in there: ax1.xaxis.grid(False, which='both') ax1.yaxis.grid(False, which='both') |
From: Paul H. <pmh...@gm...> - 2013-06-14 15:35:59
|
On Thu, Jun 13, 2013 at 11:40 PM, Sudheer Joseph <sud...@ya...>wrote: > Thank you, > I don't see a way other than starting in normal mode as the moment I type > plot command it get displayed and I don't need to do a show command. > In the qtconsole, you can enter multi-line mode with crtl+enter. |
From: Sudheer J. <sud...@ya...> - 2013-06-14 06:40:54
|
Thank you, I don't see a way other than starting in normal mode as the moment I type plot command it get displayed and I don't need to do a show command. With best regards sudheer |
From: Sudheer J. <sud...@ya...> - 2013-06-14 01:33:39
|
Thank you Roban, Your that trick worked, if I keep ts.plot(), savefig('ts.pdf') both on same line it works! with best regards Sudheer *************************************************************** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:sjo...@gm...;sud...@ya... Web- http://oppamthadathil.tripod.com *************************************************************** >________________________________ > From: Roban Kramer <ro...@gm...> >To: sud...@ya... >Cc: Paul Hobson <pmh...@gm...>; "mat...@li..." <mat...@li...> >Sent: Thursday, 13 June 2013 8:12 PM >Subject: Re: [Matplotlib-users] savefig > > > >savefig works for me when I put both the plotting commands and the savefig call in the *same* code cell. > > > >On Thu, Jun 13, 2013 at 10:31 AM, Sudheer Joseph <sud...@ya...> wrote: > >Thank you, >>I don't see a way other than starting in normal mode as the moment I type plot command it get displayed and I don't need to do a show command. >>With best regards sudheer >> >> >> >>________________________________ >> From: Paul Hobson <pmh...@gm...>; >>To: Sudheer Joseph <sud...@ya...>; >>Cc: mat...@li... <mat...@li...>; >>Subject: Re: [Matplotlib-users] savefig >>Sent: Thu, Jun 13, 2013 2:23:05 PM >> >> >> >> >> >>On Wed, Jun 12, 2013 at 10:28 PM, Sudheer Joseph <sud...@ya...> wrote: >> >>Dear experts, >>>I start ipython in ipython qtconsole --pylab=inline mode and make a plot. But if I use savefig('fig.png') the figure do not get saved instead I get a blank page. >>> >>> I also tried img.save('fig.png',png) but no use. Is there a way out or I need to do this after quitting and restarting in normal mode each time I want to save? >>> >>>ipython qtconsole --pylab=inline >>> >>> >>>In [93]: ts.plot() >>>Out[93]: <matplotlib.axes.AxesSubplot at 0x9135490> >>> >> >> >>The fig is destroyed after it has been displayed by the console. Try saving it before it gets shown. >>-p >>------------------------------------------------------------------------------ >>This SF.net email is sponsored by Windows: >> >>Build for Windows Store. >> >>http://p.sf.net/sfu/windows-dev2dev >>_______________________________________________ >>Matplotlib-users mailing list >>Mat...@li... >>https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > > |
From: zetah <ot...@hu...> - 2013-06-13 21:09:17
|
Hi, in this example: ======================================== import numpy as np import matplotlib.pyplot as plt arr = np.random.random((10, 10)) plt.contourf(arr, 10) plt.contourf(arr, 10, cmap='coolwarm', levels=np.arange(0, 1, .2), alpha=.5) plt.colorbar() plt.show() ======================================== colorbar is representing last contour. I want to make colorbar that will match actual plot, which is combination of two contours obviously. I tried also something like: ======================================== import numpy as np import matplotlib.pyplot as plt arr = np.random.random((10, 10)) fig = plt.figure() ax = fig.add_subplot(111) cax = ax.contourf(arr, 10) cb = fig.colorbar(cax) cax = ax.contourf(arr, 10, cmap='coolwarm', levels=np.arange(0, 1, .2), alpha=.5) cb.update_bruteforce(cax) # tried also: cb.update_normal(cax) plt.show() ======================================== but it didn't get me there. Is there some easy way to do this? Thanks |
From: Daniel M. <dan...@go...> - 2013-06-13 20:34:26
|
Hi Paul, I've modified your suggestion a little, since I don't want a grid for the primary axis at all -- unfortunately to no avail, i.e. no grid line at all: import numpy import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt datax = numpy.arange(50) data1 = numpy.sin(datax)*1.5 data2 = datax**2 plt.close('all') fig = plt.figure() ax1 = fig.add_subplot(111) ax2 = ax1.twinx() ax1.plot(datax, data1, 'x') ax2.plot(datax, data2, '--') #for ax in [ax1, ax2]: # ax.xaxis.grid(True, which='both') # `which` can be 'minor', 'major', or 'both' # ax.yaxis.grid(True, which='both') ax2.xaxis.grid(True, which='both') ax2.yaxis.grid(True, which='both') fig.savefig('twinxgrid.png') #fig.show() |
From: Paul H. <pmh...@gm...> - 2013-06-13 19:42:40
|
On Thu, Jun 13, 2013 at 4:47 AM, Daniel Mader < dan...@go...> wrote: > Hi, > > I need a twinx() plot with horizontal and vertical grid lines for the > second axis, just like the usual grid for the first axis. I don't need or > want to specify the ticks manually, though! > > My example code just produces horizontal lines: > > import pylab > > > datax = pylab.arange(50) > > data1 = pylab.sin(datax)*1.5 > > data2 = datax**2 > > > pylab.close('all') > > > fig = pylab.figure() > > ax1 = fig.add_subplot(111) > > ax2 = ax1.twinx() > > > ax1.plot(datax, data1, 'x') > > ax2.plot(datax, data2, '--') > > > #ax1.grid() > > ax2.grid() > > > fig.show() > > > Thanks in advance! > Does this get you where you want to be? import pylab datax = pylab.arange(50) data1 = pylab.sin(datax)*1.5 data2 = datax**2 pylab.close('all') fig = pylab.figure() ax1 = fig.add_subplot(111) ax2 = ax1.twinx() ax1.plot(datax, data1, 'x') ax2.plot(datax, data2, '--') for ax in [ax1, ax2]: ax.xaxis.grid(True, which='both') # `which` can be 'minor', 'major', or 'both' ax.yaxis.grid(True, which='both') fig.show() |
From: Matthias B. <bus...@gm...> - 2013-06-13 15:29:45
|
close_figures, not close_all Haven't tried to switch it at run time using %config magic though. $ ipython [qtconsole|notebook|whatever] --help-all to get all option as examples in config files are **not** updated with IPython. InlineBackend options --------------------- --InlineBackend.close_figures=<CBool> Default: True Close all figures at the end of each cell. When True, ensures that each cell starts with no active figures, but it also means that one must keep track of references in order to edit or redraw figures in subsequent cells. This mode is ideal for the notebook, where residual plots from other cells might be surprising. When False, one must call figure() to create new figures. This means that gcf() and getfigs() can reference figures created in other cells, and the active figure can continue to be edited with pylab/pyplot methods that reference the current active figure. This mode facilitates iterative editing of figures, and behaves most consistently with other matplotlib backends, but figure barriers between cells must be explicit. |
From: Roban K. <ro...@gm...> - 2013-06-13 14:42:48
|
savefig works for me when I put both the plotting commands and the savefig call in the *same* code cell. On Thu, Jun 13, 2013 at 10:31 AM, Sudheer Joseph <sud...@ya...>wrote: > Thank you, > I don't see a way other than starting in normal mode as the moment I type > plot command it get displayed and I don't need to do a show command. > With best regards sudheer > > ------------------------------ > * From: * Paul Hobson <pmh...@gm...>; > * To: * Sudheer Joseph <sud...@ya...>; > * Cc: * mat...@li... < > mat...@li...>; > * Subject: * Re: [Matplotlib-users] savefig > * Sent: * Thu, Jun 13, 2013 2:23:05 PM > > > On Wed, Jun 12, 2013 at 10:28 PM, Sudheer Joseph <sud...@ya... > > wrote: > >> Dear experts, >> I start ipython in ipython qtconsole --pylab=inline mode and make a plot. >> But if I use savefig('fig.png') the figure do not get saved instead I get a >> blank page. >> >> I also tried img.save('fig.png',png) but no use. Is there a way out or I >> need to do this after quitting and restarting in normal mode each time I >> want to save? >> >> ipython qtconsole --pylab=inline >> >> >> In [93]: ts.plot() >> Out[93]: <matplotlib.axes.AxesSubplot at 0x9135490> >> > > The fig is destroyed after it has been displayed by the console. Try > saving it before it gets shown. > -p > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Francesco M. <fra...@gm...> - 2013-06-13 14:39:05
|
Dear Lado, You should be able to do it simply by calling countourf multiple times changing the alpha value (or setting it to something like 0.5) plt.contourf(..., alpha=0.8, ...) plt.contourf(..., alpha=0.6, ...) plt.contourf(..., alpha=0.4, ...) The problem comes when you want to save the figure as eps: it does not support transparency, so the alpha level is ignored and all colors are solid. Cheers, Francesco 2013/6/13 Lado Samushia <co...@gm...> > How can I plot multiple overlaid transparent contour plots in matplotlib? > The link below has a plot that shows I am trying to achieve. > > https://docs.google.com/file/d/0B4HYv5Dbtu1Zb1VtOG9PTkJCeVU/edit?usp=sharing > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Sudheer J. <sud...@ya...> - 2013-06-13 14:31:26
|
Thank you, I don't see a way other than starting in normal mode as the moment I type plot command it get displayed and I don't need to do a show command. With best regards sudheer |
From: Lado S. <co...@gm...> - 2013-06-13 14:30:35
|
How can I plot multiple overlaid transparent contour plots in matplotlib? The link below has a plot that shows I am trying to achieve. https://docs.google.com/file/d/0B4HYv5Dbtu1Zb1VtOG9PTkJCeVU/edit?usp=sharing |
From: Paul H. <pmh...@gm...> - 2013-06-13 14:23:12
|
On Wed, Jun 12, 2013 at 10:28 PM, Sudheer Joseph <sud...@ya...>wrote: > Dear experts, > I start ipython in ipython qtconsole --pylab=inline mode and make a plot. > But if I use savefig('fig.png') the figure do not get saved instead I get a > blank page. > > I also tried img.save('fig.png',png) but no use. Is there a way out or I > need to do this after quitting and restarting in normal mode each time I > want to save? > > ipython qtconsole --pylab=inline > > > In [93]: ts.plot() > Out[93]: <matplotlib.axes.AxesSubplot at 0x9135490> > The fig is destroyed after it has been displayed by the console. Try saving it before it gets shown. -p |
From: Daniel M. <dan...@go...> - 2013-06-13 11:48:23
|
Hi, I need a twinx() plot with horizontal and vertical grid lines for the second axis, just like the usual grid for the first axis. I don't need or want to specify the ticks manually, though! My example code just produces horizontal lines: import pylab datax = pylab.arange(50) data1 = pylab.sin(datax)*1.5 data2 = datax**2 pylab.close('all') fig = pylab.figure() ax1 = fig.add_subplot(111) ax2 = ax1.twinx() ax1.plot(datax, data1, 'x') ax2.plot(datax, data2, '--') #ax1.grid() ax2.grid() fig.show() Thanks in advance! |
From: Sudheer J. <sud...@ya...> - 2013-06-13 05:28:09
|
Dear experts, I start ipython in ipython qtconsole --pylab=inline mode and make a plot. But if I use savefig('fig.png') the figure do not get saved instead I get a blank page. I also tried img.save('fig.png',png) but no use. Is there a way out or I need to do this after quitting and restarting in normal mode each time I want to save? ipython qtconsole --pylab=inline In [93]: ts.plot() Out[93]: <matplotlib.axes.AxesSubplot at 0x9135490> *************************************************************** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of India POST BOX NO: 21, IDA Jeedeemetla P.O. Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) E-mail:sjo...@gm...;sud...@ya... Web- http://oppamthadathil.tripod.com *************************************************************** |
From: Michael C. <mic...@gm...> - 2013-06-12 13:21:49
|
A typical plot for me includes some simple line curves and a legend attempting to describe what apparatus that curve belongs to. Often the labels I give seem clear to me at the time, but even returning a month later to the plot, I'll be as lost as the next guy. A few of my colleagues have been plotting curves, and then including a picture or diagram in place of a typical legend label. The picture or diagram is bordered by the color of the trace on the plot. I am fairly certain the plots are done in Matlab. The diagrams are simply dropped into a powerpoint deck and given a border that is matched as close as possible to the trace. I did some things like that back in graduate school. Seems like it would be neat to have a way to do a legend in matplotlib that does something like this. I'm envisioning a regular axes with lines, scatter plots, etc. to the left and a column of graphics to the right. I would think this would be fairly doable using GridSpec or some of the similar layout. The place I could see getting hung up would be adding a color border to a picture that matches the trace and also doing the scaling to make it work all dynamically for different numbers of traces. |
From: Yoshi R. <yo...@ro...> - 2013-06-11 16:43:54
|
Am Fri, 7 Jun 2013 22:15:31 +0200 schrieb Yoshi Rokuko <yo...@ro...>: > Fr, 7 Jun 2013 10:13:26 -0400 Michael Droettboom <md...@st...>: > > > Have you tried setting ps.usedistiller to False, or xpdf? There > > have been problems using Ghostscript as a distiller with recent > > versions of Ghostscript. > > No, I didn't try. Thanks for the hint, I will test that. > > > We'll need a minimal example, or at least a copy of the PS file to > > investigate this further, however. Also, what platform, version of > > matplotlib and Python are you using? > > If I keep everything on my system linux with python 2.7.5 and > matplotlib 1.2.1 it works fine. Problems arise if I move the EPS to > an older system or the printing. I will have access to these > machines on Tue. I will try to create a minimal example then. OK, I created a more simple example that fails. It is attached as draw.py and the output produced by the printer is attached as a scan. Using ps.distiller == False doesn't change the output but setting it to 'xpdf' does. The latter is also printable. Everything including the EPS outputs is compressed in [1]. This archive includes also a file test-opt.eps that was generated with eps2eps from the original EPS without any ps.usedistiller options. This optimized EPS by eps2eps can be printed too. Although sometimes bboxes get destroyed by this. Do you need further information in order to investigate this issue? Thank you and best regards, Yoshi Rokuko [1] http://rokuko.net/matplotlib-eps.tar.bz2 (23M) |
From: Sudheer J. <sud...@ya...> - 2013-06-11 08:30:22
|
Thank you very much Eric for your valuable suggestions and explanations, now I could follow what exactly was wrong with my way of doing it, I got the result correctly. thanks a lot with best regards, Sudheer ----- Original Message ----- > From: Eric Firing <ef...@ha...> > To: Sudheer Joseph <sud...@ya...> > Cc: "mat...@li..." <mat...@li...> > Sent: Tuesday, 11 June 2013 12:53 PM > Subject: Re: [Matplotlib-users] time axis format > > On 2013/06/10 6:16 PM, Sudheer Joseph wrote: >> >> >> Thank you Eric and CM, >> I have the below piece of code and added the new definition for minorLocs, > but gets the below error. I believe I did not fully understand the concept you > mentioned. >> > > Try it again, please, exactly as I wrote it. > >> minorLocs = mdates.MonthLocator(bymonth=[1,3,5,7,9,11],bymonthday=15) > > > Delete the following line: >> minorFmt = mdates.DateFormatter('%b') >> > > Restore the following to what I wrote; your change to the first line is > wrong. >> class MonthLetter(minorFmt): >> def __init__(self): >> DateFormatter.__init__(self, "%b") >> def __call__(*args): >> s = DateFormatter.__call__(*args) >> return s[:1] >> minorFmt = MonthLetter() >> >> >> >> >> 531 def viewlim_to_dt(self): >> --> 532 vmin, vmax = self.axis.get_view_interval() >> 533 return num2date(vmin, self.tz), num2date(vmax, self.tz) >> 534 >> >> AttributeError: 'NoneType' object has no attribute > 'get_view_interva >> >> >> >> From: Eric Firing <ef...@ha...> >> >> To: mat...@li... >>> Sent: Tuesday, 11 June 2013 6:11 AM >>> Subject: Re: [Matplotlib-users] time axis format >>> >>> >>> On 2013/06/10 2:08 PM, Sudheer Joseph wrote: >>>> >>>> Thank you, >>>> So there is no way to get J F M A etc with out reducing font size? > We >>>> often need to make presentation in front of senior people who > insist for >>>> bigger fonts. >>>> With best regards, >>>> Sudheer >>> >>> One way is to subclass DateFormatter, e.g., >>> >>> class MonthLetter(DateFormatter): >>> def __init__(self): >>> DateFormatter.__init__(self, "%b") >>> >>> def __call__(*args): >>> s = DateFormatter.__call__(*args) >>> return s[:1] >>> >>> class MonthLetterYear(DateFormatter): >>> def __init__(self): >>> DateFormatter.__init__(self, "%b\n%Y") >>> >>> def __call__(*args): >>> s = DateFormatter.__call__(*args) >>> return = s[:1] + s[3:] >>> >>> ... >>> >>> majorFmt = MonthLetterYear() >>> minorFmt = MonthLetter() >>> >>> >>> Not tested, but something like that should work. >>> >>> Eric >>> >>> >>>> >>>> >>>> > ------------------------------------------------------------------------ >>>> *From: * Paul Hobson <pmh...@gm...>; >>>> *To: * Sudheer Joseph <sud...@ya...>; >>>> *Cc: * mat...@li... >>>> <mat...@li...>; >>>> *Subject: * Re: [Matplotlib-users] time axis format >>>> *Sent: * Mon, Jun 10, 2013 8:08:18 PM >>>> >>>> In that case, I would use ax.tick_params(...) to make the font > smaller. >>>> >>>> >>>> On Sat, Jun 8, 2013 at 7:36 AM, Sudheer Joseph > <sud...@ya... >>>> <javascript:return>> wrote: >>>> >>>> Dear Paul, >>>> The issue I am facing is like in the attached > plot >>>> where the month naming get cluttered. >>>> with best regards, >>>> Sudheer >>>> > *************************************************************** >>>> Sudheer Joseph >>>> Indian National Centre for Ocean Information Services >>>> Ministry of Earth Sciences, Govt. of India >>>> POST BOX NO: 21, IDA Jeedeemetla P.O. >>>> Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 >>>> Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), >>>> Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) >>>> E-mail:sjo...@gm... >>>> <javascript:return>;sud...@ya... > <javascript:return> >>>> Web- http://oppamthadathil.tripod.com >>>> > *************************************************************** >>>> >>>> > ------------------------------------------------------------------------ >>>> *From:* Sudheer Joseph <sud...@ya... >>>> <javascript:return>> >>>> *To:* Paul Hobson <pmh...@gm... > <javascript:return>> >>>> *Cc:* "mat...@li... >>>> <javascript:return>" > <mat...@li... >>>> <javascript:return>> >>>> *Sent:* Saturday, 8 June 2013 7:46 PM >>>> >>>> *Subject:* Re: [Matplotlib-users] time axis format >>>> >>>> Thank you Paul for the helping hand, >>>> However I was looking > for >>>> slightly different solution like in the attached plots. I > used >>>> ferret to do this based on the length of the time axis it > chose >>>> the mode of labelling. for example in case of 2 year plot > it >>>> made month labeling as j f m etc and in case of 1 year as > there >>>> is enough space on x axis it made jan feb etc with single > label >>>> of year. >>>> >>>> In the attached python plot > (ATser_RAMA_HYCOM_U_8n90e.png) every >>>> tick point is lablled for year, which I wanted to avoid > and get >>>> plots similar to the first types thought it is not done >>>> automatically but at least manually. >>>> >>>> >>>> > *************************************************************** >>>> Sudheer Joseph >>>> Indian National Centre for Ocean Information Services >>>> Ministry of Earth Sciences, Govt. of India >>>> POST BOX NO: 21, IDA Jeedeemetla P.O. >>>> Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 >>>> Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), >>>> Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) >>>> E-mail:sjo...@gm... >>>> <javascript:return>;sud...@ya... > <javascript:return> >>>> Web- http://oppamthadathil.tripod.com >>>> > *************************************************************** >>>> >>>> > ------------------------------------------------------------------------ >>>> *From:* Paul Hobson <pmh...@gm... > <javascript:return>> >>>> *To:* Sudheer Joseph <sud...@ya... >>>> <javascript:return>> >>>> *Cc:* "mat...@li... >>>> <javascript:return>" > <mat...@li... >>>> <javascript:return>> >>>> *Sent:* Friday, 7 June 2013 8:50 PM >>>> *Subject:* Re: [Matplotlib-users] time axis format >>>> >>>> >>>> >>>> >>>> On Thu, Jun 6, 2013 at 11:39 PM, Sudheer Joseph >>>> <sud...@ya... > <javascript:return>> wrote: >>>> >>>> Dear Experts, >>>> I have been experimenting with the >>>> plot_dates option of matplotlib to plot time > series data >>>> and have below questions >>>> >>>> I have used >>>> loc = mdates.AutoDateLocator() >>>> ax.xaxis.set_major_locator(loc) >>>> > ax.xaxis.set_major_formatter(mpl.dates.DateFormatter('%b\n >>>> %Y')) >>>> >>>> >>>> and got the tick labels in attached plot >>>> >>>> However I feel the repeatd year labeling is not > needed >>>> here and it is required once in a year only , > Also if I >>>> need to plot long time seris insted of > "MAR" "APR" I >>>> wanted to get them reduced to "M" > "A" etc so that the >>>> lavel congestion can be avoided. >>>> >>>> >>>> I notice that below options are available, but > was >>>> wondering how commbinatins of these locateors are > used >>>> ie mark every month and every year once each. >>>> >>>> >>>> Is there a way to achive the above or does it > need >>>> further development? >>>> >>>> fmt = mdates.DateFormatter('%Y-%m-%d') >>>> loc = >>>> > mdates.WeekdayLocator(byweekday=mdates.MONDAY,interval=4) >>>> locator = mdates.YearLocator() >>>> >>>> >>>> If I were trying to do this, I'd cobble something > together >>>> using by the minor and major formatters. >>>> e.g.,... >>>> import matplotlib.dates as mdates >>>> import matplotlib.pyplot as plt >>>> >>>> fig, ax = plt.subplots() >>>> >>>> majorLocs = mdates.MonthLocator(bymonth[1,7]) >>>> majorFmt = mdates.DateFormatter('%b\n%Y') >>>> >>>> minorLocs = mdates.MonthLocator(bymonth[1,7]) >>>> minorFmt = mdates.DateFormatter('%b') >>>> >>>> ax.xaxis.set_major_locator(majorLocs) >>>> ax.xaxis.set_major_formatter(majorFmt) >>>> >>>> ax.xaxis.set_minor_locator(minorLocs) >>>> ax.xaxis.set_minor_formatter(minorFmt) >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> > ------------------------------------------------------------------------------ >>>> This SF.net email is sponsored by Windows: >>>> >>>> Build for Windows Store. >>>> >>>> http://p.sf.net/sfu/windows-dev2dev >>>> >>>> >>>> >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >>> >>> >>> > ------------------------------------------------------------------------------ >>> This SF.net email is sponsored by Windows: >>> >>> Build for Windows Store. >>> >>> http://p.sf.net/sfu/windows-dev2dev >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >>> > |
From: Eric F. <ef...@ha...> - 2013-06-11 07:53:48
|
On 2013/06/10 6:16 PM, Sudheer Joseph wrote: > > > Thank you Eric and CM, > I have the below piece of code and added the new definition for minorLocs, but gets the below error. I believe I did not fully understand the concept you mentioned. > Try it again, please, exactly as I wrote it. > minorLocs = mdates.MonthLocator(bymonth=[1,3,5,7,9,11],bymonthday=15) Delete the following line: > minorFmt = mdates.DateFormatter('%b') > Restore the following to what I wrote; your change to the first line is wrong. > class MonthLetter(minorFmt): > def __init__(self): > DateFormatter.__init__(self, "%b") > def __call__(*args): > s = DateFormatter.__call__(*args) > return s[:1] > minorFmt = MonthLetter() > > > > > 531 def viewlim_to_dt(self): > --> 532 vmin, vmax = self.axis.get_view_interval() > 533 return num2date(vmin, self.tz), num2date(vmax, self.tz) > 534 > > AttributeError: 'NoneType' object has no attribute 'get_view_interva > > > > From: Eric Firing <ef...@ha...> > > To: mat...@li... >> Sent: Tuesday, 11 June 2013 6:11 AM >> Subject: Re: [Matplotlib-users] time axis format >> >> >> On 2013/06/10 2:08 PM, Sudheer Joseph wrote: >>> >>> Thank you, >>> So there is no way to get J F M A etc with out reducing font size? We >>> often need to make presentation in front of senior people who insist for >>> bigger fonts. >>> With best regards, >>> Sudheer >> >> One way is to subclass DateFormatter, e.g., >> >> class MonthLetter(DateFormatter): >> def __init__(self): >> DateFormatter.__init__(self, "%b") >> >> def __call__(*args): >> s = DateFormatter.__call__(*args) >> return s[:1] >> >> class MonthLetterYear(DateFormatter): >> def __init__(self): >> DateFormatter.__init__(self, "%b\n%Y") >> >> def __call__(*args): >> s = DateFormatter.__call__(*args) >> return = s[:1] + s[3:] >> >> ... >> >> majorFmt = MonthLetterYear() >> minorFmt = MonthLetter() >> >> >> Not tested, but something like that should work. >> >> Eric >> >> >>> >>> >>> ------------------------------------------------------------------------ >>> *From: * Paul Hobson <pmh...@gm...>; >>> *To: * Sudheer Joseph <sud...@ya...>; >>> *Cc: * mat...@li... >>> <mat...@li...>; >>> *Subject: * Re: [Matplotlib-users] time axis format >>> *Sent: * Mon, Jun 10, 2013 8:08:18 PM >>> >>> In that case, I would use ax.tick_params(...) to make the font smaller. >>> >>> >>> On Sat, Jun 8, 2013 at 7:36 AM, Sudheer Joseph <sud...@ya... >>> <javascript:return>> wrote: >>> >>> Dear Paul, >>> The issue I am facing is like in the attached plot >>> where the month naming get cluttered. >>> with best regards, >>> Sudheer >>> *************************************************************** >>> Sudheer Joseph >>> Indian National Centre for Ocean Information Services >>> Ministry of Earth Sciences, Govt. of India >>> POST BOX NO: 21, IDA Jeedeemetla P.O. >>> Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 >>> Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), >>> Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) >>> E-mail:sjo...@gm... >>> <javascript:return>;sud...@ya... <javascript:return> >>> Web- http://oppamthadathil.tripod.com >>> *************************************************************** >>> >>> ------------------------------------------------------------------------ >>> *From:* Sudheer Joseph <sud...@ya... >>> <javascript:return>> >>> *To:* Paul Hobson <pmh...@gm... <javascript:return>> >>> *Cc:* "mat...@li... >>> <javascript:return>" <mat...@li... >>> <javascript:return>> >>> *Sent:* Saturday, 8 June 2013 7:46 PM >>> >>> *Subject:* Re: [Matplotlib-users] time axis format >>> >>> Thank you Paul for the helping hand, >>> However I was looking for >>> slightly different solution like in the attached plots. I used >>> ferret to do this based on the length of the time axis it chose >>> the mode of labelling. for example in case of 2 year plot it >>> made month labeling as j f m etc and in case of 1 year as there >>> is enough space on x axis it made jan feb etc with single label >>> of year. >>> >>> In the attached python plot (ATser_RAMA_HYCOM_U_8n90e.png) every >>> tick point is lablled for year, which I wanted to avoid and get >>> plots similar to the first types thought it is not done >>> automatically but at least manually. >>> >>> >>> *************************************************************** >>> Sudheer Joseph >>> Indian National Centre for Ocean Information Services >>> Ministry of Earth Sciences, Govt. of India >>> POST BOX NO: 21, IDA Jeedeemetla P.O. >>> Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 >>> Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), >>> Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) >>> E-mail:sjo...@gm... >>> <javascript:return>;sud...@ya... <javascript:return> >>> Web- http://oppamthadathil.tripod.com >>> *************************************************************** >>> >>> ------------------------------------------------------------------------ >>> *From:* Paul Hobson <pmh...@gm... <javascript:return>> >>> *To:* Sudheer Joseph <sud...@ya... >>> <javascript:return>> >>> *Cc:* "mat...@li... >>> <javascript:return>" <mat...@li... >>> <javascript:return>> >>> *Sent:* Friday, 7 June 2013 8:50 PM >>> *Subject:* Re: [Matplotlib-users] time axis format >>> >>> >>> >>> >>> On Thu, Jun 6, 2013 at 11:39 PM, Sudheer Joseph >>> <sud...@ya... <javascript:return>> wrote: >>> >>> Dear Experts, >>> I have been experimenting with the >>> plot_dates option of matplotlib to plot time series data >>> and have below questions >>> >>> I have used >>> loc = mdates.AutoDateLocator() >>> ax.xaxis.set_major_locator(loc) >>> ax.xaxis.set_major_formatter(mpl.dates.DateFormatter('%b\n >>> %Y')) >>> >>> >>> and got the tick labels in attached plot >>> >>> However I feel the repeatd year labeling is not needed >>> here and it is required once in a year only , Also if I >>> need to plot long time seris insted of "MAR" "APR" I >>> wanted to get them reduced to "M" "A" etc so that the >>> lavel congestion can be avoided. >>> >>> >>> I notice that below options are available, but was >>> wondering how commbinatins of these locateors are used >>> ie mark every month and every year once each. >>> >>> >>> Is there a way to achive the above or does it need >>> further development? >>> >>> fmt = mdates.DateFormatter('%Y-%m-%d') >>> loc = >>> mdates.WeekdayLocator(byweekday=mdates.MONDAY,interval=4) >>> locator = mdates.YearLocator() >>> >>> >>> If I were trying to do this, I'd cobble something together >>> using by the minor and major formatters. >>> e.g.,... >>> import matplotlib.dates as mdates >>> import matplotlib.pyplot as plt >>> >>> fig, ax = plt.subplots() >>> >>> majorLocs = mdates.MonthLocator(bymonth[1,7]) >>> majorFmt = mdates.DateFormatter('%b\n%Y') >>> >>> minorLocs = mdates.MonthLocator(bymonth[1,7]) >>> minorFmt = mdates.DateFormatter('%b') >>> >>> ax.xaxis.set_major_locator(majorLocs) >>> ax.xaxis.set_major_formatter(majorFmt) >>> >>> ax.xaxis.set_minor_locator(minorLocs) >>> ax.xaxis.set_minor_formatter(minorFmt) >>> >>> >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> This SF.net email is sponsored by Windows: >>> >>> Build for Windows Store. >>> >>> http://p.sf.net/sfu/windows-dev2dev >>> >>> >>> >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Windows: >> >> Build for Windows Store. >> >> http://p.sf.net/sfu/windows-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> |
From: Eric F. <ef...@ha...> - 2013-06-11 07:43:53
|
On 2013/06/10 6:16 PM, Sudheer Joseph wrote: > Thank you Eric and CM, > I have the below piece of code and added the new definition for minorLocs, but gets the below error. I believe I did not fully understand the concept you mentioned. > The concept is "subclassing": writing a class that "inherits" most of its behavior from another class, while modifying some aspects. > minorLocs = mdates.MonthLocator(bymonth=[1,3,5,7,9,11],bymonthday=15) > minorFmt = mdates.DateFormatter('%b') > The problem with your change to the following is that MonthLetter should be subclassing DateFormatter, as I had it. With your change it is trying to subclass an instance of DateFormatter, not the class itself. > class MonthLetter(minorFmt): > def __init__(self): > DateFormatter.__init__(self, "%b") > def __call__(*args): > s = DateFormatter.__call__(*args) > return s[:1] > minorFmt = MonthLetter() In the context of your usage, the one change you do need to make to the way I wrote the subclasses is to change my "DateFormatter" to "mdates.DateFormatter", since you are importing mdates rather than doing from matplotlib.dates import DateFormatter (Or, you can add the above import line to your block of imports.) Eric |
From: Sudheer J. <sud...@ya...> - 2013-06-11 04:46:24
|
Got a solution as below p.setp(ax.xaxis.get_minorticklabels(), rotation=90 ) but still to understand how to get single letter from month name! with best regards, Sudheer ----- Original Message ----- > From: Sudheer Joseph <sud...@ya...> > To: Eric Firing <ef...@ha...>; "mat...@li..." <mat...@li...> > Cc: > Sent: Tuesday, 11 June 2013 9:46 AM > Subject: Re: [Matplotlib-users] time axis format > > > > Thank you Eric and CM, > I have the below piece of code and added the new definition for minorLocs, but > gets the below error. I believe I did not fully understand the concept you > mentioned. > > minorLocs = mdates.MonthLocator(bymonth=[1,3,5,7,9,11],bymonthday=15) > minorFmt = mdates.DateFormatter('%b') > > class MonthLetter(minorFmt): > def __init__(self): > DateFormatter.__init__(self, "%b") > def __call__(*args): > s = DateFormatter.__call__(*args) > return s[:1] > minorFmt = MonthLetter() > > > > > 531 def viewlim_to_dt(self): > --> 532 vmin, vmax = self.axis.get_view_interval() > 533 return num2date(vmin, self.tz), num2date(vmax, self.tz) > 534 > > AttributeError: 'NoneType' object has no attribute 'get_view_interva > > > > From: Eric Firing <ef...@ha...> > > To: mat...@li... >> Sent: Tuesday, 11 June 2013 6:11 AM >> Subject: Re: [Matplotlib-users] time axis format >> >> >> On 2013/06/10 2:08 PM, Sudheer Joseph wrote: >>> >>> Thank you, >>> So there is no way to get J F M A etc with out reducing font size? We >>> often need to make presentation in front of senior people who insist > for >>> bigger fonts. >>> With best regards, >>> Sudheer >> >> One way is to subclass DateFormatter, e.g., >> >> class MonthLetter(DateFormatter): >> def __init__(self): >> DateFormatter.__init__(self, "%b") >> >> def __call__(*args): >> s = DateFormatter.__call__(*args) >> return s[:1] >> >> class MonthLetterYear(DateFormatter): >> def __init__(self): >> DateFormatter.__init__(self, "%b\n%Y") >> >> def __call__(*args): >> s = DateFormatter.__call__(*args) >> return = s[:1] + s[3:] >> >> ... >> >> majorFmt = MonthLetterYear() >> minorFmt = MonthLetter() >> >> >> Not tested, but something like that should work. >> >> Eric >> >> >>> >>> >>> > ------------------------------------------------------------------------ >>> *From: * Paul Hobson <pmh...@gm...>; >>> *To: * Sudheer Joseph <sud...@ya...>; >>> *Cc: * mat...@li... >>> <mat...@li...>; >>> *Subject: * Re: [Matplotlib-users] time axis format >>> *Sent: * Mon, Jun 10, 2013 8:08:18 PM >>> >>> In that case, I would use ax.tick_params(...) to make the font smaller. >>> >>> >>> On Sat, Jun 8, 2013 at 7:36 AM, Sudheer Joseph > <sud...@ya... >>> <javascript:return>> wrote: >>> >>> Dear Paul, >>> The issue I am facing is like in the attached plot >>> where the month naming get cluttered. >>> with best regards, >>> Sudheer >>> *************************************************************** >>> Sudheer Joseph >>> Indian National Centre for Ocean Information Services >>> Ministry of Earth Sciences, Govt. of India >>> POST BOX NO: 21, IDA Jeedeemetla P.O. >>> Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 >>> Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), >>> Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) >>> E-mail:sjo...@gm... >>> <javascript:return>;sud...@ya... > <javascript:return> >>> Web- http://oppamthadathil.tripod.com >>> *************************************************************** >>> >>> > ------------------------------------------------------------------------ >>> *From:* Sudheer Joseph <sud...@ya... >>> <javascript:return>> >>> *To:* Paul Hobson <pmh...@gm... > <javascript:return>> >>> *Cc:* "mat...@li... >>> <javascript:return>" > <mat...@li... >>> <javascript:return>> >>> *Sent:* Saturday, 8 June 2013 7:46 PM >>> >>> *Subject:* Re: [Matplotlib-users] time axis format >>> >>> Thank you Paul for the helping hand, >>> However I was looking for >>> slightly different solution like in the attached plots. I used >>> ferret to do this based on the length of the time axis it chose >>> the mode of labelling. for example in case of 2 year plot it >>> made month labeling as j f m etc and in case of 1 year as there >>> is enough space on x axis it made jan feb etc with single label >>> of year. >>> >>> In the attached python plot (ATser_RAMA_HYCOM_U_8n90e.png) > every >>> tick point is lablled for year, which I wanted to avoid and get >>> plots similar to the first types thought it is not done >>> automatically but at least manually. >>> >>> >>> *************************************************************** >>> Sudheer Joseph >>> Indian National Centre for Ocean Information Services >>> Ministry of Earth Sciences, Govt. of India >>> POST BOX NO: 21, IDA Jeedeemetla P.O. >>> Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 >>> Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), >>> Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) >>> E-mail:sjo...@gm... >>> <javascript:return>;sud...@ya... > <javascript:return> >>> Web- http://oppamthadathil.tripod.com >>> *************************************************************** >>> >>> > ------------------------------------------------------------------------ >>> *From:* Paul Hobson <pmh...@gm... > <javascript:return>> >>> *To:* Sudheer Joseph <sud...@ya... >>> <javascript:return>> >>> *Cc:* "mat...@li... >>> <javascript:return>" > <mat...@li... >>> <javascript:return>> >>> *Sent:* Friday, 7 June 2013 8:50 PM >>> *Subject:* Re: [Matplotlib-users] time axis format >>> >>> >>> >>> >>> On Thu, Jun 6, 2013 at 11:39 PM, Sudheer Joseph >>> <sud...@ya... <javascript:return>> > wrote: >>> >>> Dear Experts, >>> I have been experimenting with the >>> plot_dates option of matplotlib to plot time series > data >>> and have below questions >>> >>> I have used >>> loc = mdates.AutoDateLocator() >>> ax.xaxis.set_major_locator(loc) >>> > ax.xaxis.set_major_formatter(mpl.dates.DateFormatter('%b\n >>> %Y')) >>> >>> >>> and got the tick labels in attached plot >>> >>> However I feel the repeatd year labeling is not needed >>> here and it is required once in a year only , Also if I >>> need to plot long time seris insted of "MAR" > "APR" I >>> wanted to get them reduced to "M" > "A" etc so that the >>> lavel congestion can be avoided. >>> >>> >>> I notice that below options are available, but was >>> wondering how commbinatins of these locateors are used >>> ie mark every month and every year once each. >>> >>> >>> Is there a way to achive the above or does it need >>> further development? >>> >>> fmt = mdates.DateFormatter('%Y-%m-%d') >>> loc = >>> > mdates.WeekdayLocator(byweekday=mdates.MONDAY,interval=4) >>> locator = mdates.YearLocator() >>> >>> >>> If I were trying to do this, I'd cobble something > together >>> using by the minor and major formatters. >>> e.g.,... >>> import matplotlib.dates as mdates >>> import matplotlib.pyplot as plt >>> >>> fig, ax = plt.subplots() >>> >>> majorLocs = mdates.MonthLocator(bymonth[1,7]) >>> majorFmt = mdates.DateFormatter('%b\n%Y') >>> >>> minorLocs = mdates.MonthLocator(bymonth[1,7]) >>> minorFmt = mdates.DateFormatter('%b') >>> >>> ax.xaxis.set_major_locator(majorLocs) >>> ax.xaxis.set_major_formatter(majorFmt) >>> >>> ax.xaxis.set_minor_locator(minorLocs) >>> ax.xaxis.set_minor_formatter(minorFmt) >>> >>> >>> >>> >>> >>> >>> >>> > ------------------------------------------------------------------------------ >>> This SF.net email is sponsored by Windows: >>> >>> Build for Windows Store. >>> >>> http://p.sf.net/sfu/windows-dev2dev >>> >>> >>> >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Windows: >> >> Build for Windows Store. >> >> http://p.sf.net/sfu/windows-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Sudheer J. <sud...@ya...> - 2013-06-11 04:37:57
|
Thank you CM, I tried to rotate the labels but only major ticks get rotated and when I try with minor ticks as below I get error minlabels = ax.xaxis.get_minor_ticks() p.xticks(minlabels,rotation=90) --> 192 base = float(dt.toordinal()) 193 if hasattr(dt, 'hour'): 194 base += (dt.hour/HOURS_PER_DAY + dt.minute/MINUTES_PER_DAY + AttributeError: 'XTick' object has no attribute 'toordinal' From: C M <cmp...@gm...> To: mat...@li... >Sent: Tuesday, 11 June 2013 6:41 AM >Subject: Re: [Matplotlib-users] time axis format > > > > > > >On Mon, Jun 10, 2013 at 8:08 PM, Sudheer Joseph <sud...@ya...> wrote: > > >>Thank you, >>So there is no way to get J F M A etc with out reducing font size? > >I bet there a number of ways. Offhand I don't know the one that, once I hear about it, I will say, "D'oh, that's so easy" but I bet it exists. But you could modify the DateFormatter class. It is set to return a strftime result string. Here is the function: > >def __call__(self, x, pos=0): > if x==0: > raise ValueError('DateFormatter found a value of x=0, which is an illegal date. This usually occurs because you have not informed the axis that it is plotting dates, eg with ax.xaxis_date()') > dt = num2date(x, self.tz) > return self.strftime(dt, self.fmt) > >All you would have to do is change that last line to: > > return self.strftime(dt, self.fmt)[0] > >To slice just the first letter of the month. > >So you could subclass DateFormatter to do this, since you probably don't want to modify the actual DateFormatter class always in this way. > >Also, aside from the J F M A approach, you could just rotate the month's name, and that will reduce crowding while keeping the month a little clearer (I think "JAN FEB MAR APR" is more intuitive and pleasant to read on a graph). > >Che > > > >We often need to make presentation in front of senior people who insist for bigger fonts. >>With best regards, >>Sudheer >> >> >> >>________________________________ >> From: Paul Hobson <pmh...@gm...>; >>To: Sudheer Joseph <sud...@ya...>; >>Cc: mat...@li... <mat...@li...>; >> >>Subject: Re: [Matplotlib-users] time axis format >>Sent: Mon, Jun 10, 2013 8:08:18 PM >> >> >> >>In that case, I would use ax.tick_params(...) to make the font smaller. >> >> >> >>On Sat, Jun 8, 2013 at 7:36 AM, Sudheer Joseph <sud...@ya...> wrote: >> >>Dear Paul, >>> The issue I am facing is like in the attached plot where the month naming get cluttered. >>>with best regards, >>>Sudheer >>> >>> >>>*************************************************************** >>>Sudheer Joseph >>>Indian National Centre for Ocean Information Services >>>Ministry of Earth Sciences, Govt. of India >>>POST BOX NO: 21, IDA Jeedeemetla P.O. >>>Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 >>>Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), >>>Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) >>>E-mail:sjo...@gm...;sud...@ya... >>>Web- http://oppamthadathil.tripod.com >>>*************************************************************** >>> >>> >>>>________________________________ >>>> From: Sudheer Joseph <sud...@ya...> >>>>To: Paul Hobson <pmh...@gm...> >>>>Cc: "mat...@li..." <mat...@li...> >>>>Sent: Saturday, 8 June 2013 7:46 PM >>>> >>>>Subject: Re: [Matplotlib-users] time axis format >>>> >>>> >>>> >>>>Thank you Paul for the helping hand, >>>> However I was looking for slightly different solution like in the attached plots. I used ferret to do this based on the length of the time axis it chose the mode of labelling. for example in case of 2 year plot it made month labeling as j f m etc and in case of 1 year as there is enough space on x axis it made jan feb etc with single label of year. >>>> >>>>In the attached python plot (ATser_RAMA_HYCOM_U_8n90e.png) every tick point is lablled for year, which I wanted to avoid and get plots similar to the first types thought it is not done automatically but at least manually. >>>> >>>> >>>> >>>> >>>> >>>>*************************************************************** >>>>Sudheer Joseph >>>>Indian National Centre for Ocean Information Services >>>>Ministry of Earth Sciences, Govt. of India >>>>POST BOX NO: 21, IDA Jeedeemetla P.O. >>>>Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 >>>>Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), >>>>Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) >>>>E-mail:sjo...@gm...;sud...@ya... >>>>Web- http://oppamthadathil.tripod.com >>>>*************************************************************** >>>> >>>> >>>>>________________________________ >>>>> From: Paul Hobson <pmh...@gm...> >>>>>To: Sudheer Joseph <sud...@ya...> >>>>>Cc: "mat...@li..." <mat...@li...> >>>>>Sent: Friday, 7 June 2013 8:50 PM >>>>>Subject: Re: [Matplotlib-users] time axis format >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>On Thu, Jun 6, 2013 at 11:39 PM, Sudheer Joseph <sud...@ya...> wrote: >>>>> >>>>>Dear Experts, >>>>>> I have been experimenting with the plot_dates option of matplotlib to plot time series data and have below questions >>>>>> >>>>>> I have used >>>>>>loc = mdates.AutoDateLocator() >>>>>>ax.xaxis.set_major_locator(loc) >>>>>>ax.xaxis.set_major_formatter(mpl.dates.DateFormatter('%b\n %Y')) >>>>>> >>>>>> >>>>>>and got the tick labels in attached plot >>>>>> >>>>>>However I feel the repeatd year labeling is not needed here and it is required once in a year only , Also if I need to plot long time seris insted of "MAR" "APR" I wanted to get them reduced to "M" "A" etc so that the lavel congestion can be avoided. >>>>>> >>>>>> >>>>>>I notice that below options are available, but was wondering how commbinatins of these locateors are used ie mark every month and every year once each. >>>>>> >>>>>> >>>>>>Is there a way to achive the above or does it need further development? >>>>>> >>>>>>fmt = mdates.DateFormatter('%Y-%m-%d') >>>>>>loc = mdates.WeekdayLocator(byweekday=mdates.MONDAY,interval=4) >>>>>>locator = mdates.YearLocator() >>>>>> >>>>> >>>>> >>>>>If I were trying to do this, I'd cobble something together using by the minor and major formatters. >>>>>e.g.,... >>>>>import matplotlib.dates as mdates >>>>>import matplotlib.pyplot as plt >>>>> >>>>> >>>>>fig, ax = plt.subplots() >>>>> >>>>> >>>>>majorLocs = mdates.MonthLocator(bymonth[1,7]) >>>>>majorFmt = mdates.DateFormatter('%b\n%Y') >>>>> >>>>> >>>>> >>>>>minorLocs = mdates.MonthLocator(bymonth[1,7]) >>>>>minorFmt = mdates.DateFormatter('%b') >>>>> >>>>> >>>>> >>>>>ax.xaxis.set_major_locator(majorLocs) >>>>>ax.xaxis.set_major_formatter(majorFmt) >>>>> >>>>> >>>>> >>>>>ax.xaxis.set_minor_locator(minorLocs) >>>>>ax.xaxis.set_minor_formatter(minorFmt) >>>>> >>>>> >>>> >>>> >> >>------------------------------------------------------------------------------ >>This SF.net email is sponsored by Windows: >> >>Build for Windows Store. >> >>http://p.sf.net/sfu/windows-dev2dev >>_______________________________________________ >>Matplotlib-users mailing list >>Mat...@li... >>https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > >------------------------------------------------------------------------------ >This SF.net email is sponsored by Windows: > >Build for Windows Store. > >http://p.sf.net/sfu/windows-dev2dev >_______________________________________________ >Matplotlib-users mailing list >Mat...@li... >https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > |
From: Sudheer J. <sud...@ya...> - 2013-06-11 04:16:59
|
Thank you Eric and CM, I have the below piece of code and added the new definition for minorLocs, but gets the below error. I believe I did not fully understand the concept you mentioned. minorLocs = mdates.MonthLocator(bymonth=[1,3,5,7,9,11],bymonthday=15) minorFmt = mdates.DateFormatter('%b') class MonthLetter(minorFmt): def __init__(self): DateFormatter.__init__(self, "%b") def __call__(*args): s = DateFormatter.__call__(*args) return s[:1] minorFmt = MonthLetter() 531 def viewlim_to_dt(self): --> 532 vmin, vmax = self.axis.get_view_interval() 533 return num2date(vmin, self.tz), num2date(vmax, self.tz) 534 AttributeError: 'NoneType' object has no attribute 'get_view_interva From: Eric Firing <ef...@ha...> To: mat...@li... >Sent: Tuesday, 11 June 2013 6:11 AM >Subject: Re: [Matplotlib-users] time axis format > > >On 2013/06/10 2:08 PM, Sudheer Joseph wrote: >> >> Thank you, >> So there is no way to get J F M A etc with out reducing font size? We >> often need to make presentation in front of senior people who insist for >> bigger fonts. >> With best regards, >> Sudheer > >One way is to subclass DateFormatter, e.g., > >class MonthLetter(DateFormatter): > def __init__(self): > DateFormatter.__init__(self, "%b") > > def __call__(*args): > s = DateFormatter.__call__(*args) > return s[:1] > >class MonthLetterYear(DateFormatter): > def __init__(self): > DateFormatter.__init__(self, "%b\n%Y") > > def __call__(*args): > s = DateFormatter.__call__(*args) > return = s[:1] + s[3:] > >... > >majorFmt = MonthLetterYear() >minorFmt = MonthLetter() > > >Not tested, but something like that should work. > >Eric > > >> >> >> ------------------------------------------------------------------------ >> *From: * Paul Hobson <pmh...@gm...>; >> *To: * Sudheer Joseph <sud...@ya...>; >> *Cc: * mat...@li... >> <mat...@li...>; >> *Subject: * Re: [Matplotlib-users] time axis format >> *Sent: * Mon, Jun 10, 2013 8:08:18 PM >> >> In that case, I would use ax.tick_params(...) to make the font smaller. >> >> >> On Sat, Jun 8, 2013 at 7:36 AM, Sudheer Joseph <sud...@ya... >> <javascript:return>> wrote: >> >> Dear Paul, >> The issue I am facing is like in the attached plot >> where the month naming get cluttered. >> with best regards, >> Sudheer >> *************************************************************** >> Sudheer Joseph >> Indian National Centre for Ocean Information Services >> Ministry of Earth Sciences, Govt. of India >> POST BOX NO: 21, IDA Jeedeemetla P.O. >> Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 >> Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), >> Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) >> E-mail:sjo...@gm... >> <javascript:return>;sud...@ya... <javascript:return> >> Web- http://oppamthadathil.tripod.com >> *************************************************************** >> >> ------------------------------------------------------------------------ >> *From:* Sudheer Joseph <sud...@ya... >> <javascript:return>> >> *To:* Paul Hobson <pmh...@gm... <javascript:return>> >> *Cc:* "mat...@li... >> <javascript:return>" <mat...@li... >> <javascript:return>> >> *Sent:* Saturday, 8 June 2013 7:46 PM >> >> *Subject:* Re: [Matplotlib-users] time axis format >> >> Thank you Paul for the helping hand, >> However I was looking for >> slightly different solution like in the attached plots. I used >> ferret to do this based on the length of the time axis it chose >> the mode of labelling. for example in case of 2 year plot it >> made month labeling as j f m etc and in case of 1 year as there >> is enough space on x axis it made jan feb etc with single label >> of year. >> >> In the attached python plot (ATser_RAMA_HYCOM_U_8n90e.png) every >> tick point is lablled for year, which I wanted to avoid and get >> plots similar to the first types thought it is not done >> automatically but at least manually. >> >> >> *************************************************************** >> Sudheer Joseph >> Indian National Centre for Ocean Information Services >> Ministry of Earth Sciences, Govt. of India >> POST BOX NO: 21, IDA Jeedeemetla P.O. >> Via Pragathi Nagar,Kukatpally, Hyderabad; Pin:5000 55 >> Tel:+91-40-23886047(O),Fax:+91-40-23895011(O), >> Tel:+91-40-23044600(R),Tel:+91-40-9440832534(Mobile) >> E-mail:sjo...@gm... >> <javascript:return>;sud...@ya... <javascript:return> >> Web- http://oppamthadathil.tripod.com >> *************************************************************** >> >> ------------------------------------------------------------------------ >> *From:* Paul Hobson <pmh...@gm... <javascript:return>> >> *To:* Sudheer Joseph <sud...@ya... >> <javascript:return>> >> *Cc:* "mat...@li... >> <javascript:return>" <mat...@li... >> <javascript:return>> >> *Sent:* Friday, 7 June 2013 8:50 PM >> *Subject:* Re: [Matplotlib-users] time axis format >> >> >> >> >> On Thu, Jun 6, 2013 at 11:39 PM, Sudheer Joseph >> <sud...@ya... <javascript:return>> wrote: >> >> Dear Experts, >> I have been experimenting with the >> plot_dates option of matplotlib to plot time series data >> and have below questions >> >> I have used >> loc = mdates.AutoDateLocator() >> ax.xaxis.set_major_locator(loc) >> ax.xaxis.set_major_formatter(mpl.dates.DateFormatter('%b\n >> %Y')) >> >> >> and got the tick labels in attached plot >> >> However I feel the repeatd year labeling is not needed >> here and it is required once in a year only , Also if I >> need to plot long time seris insted of "MAR" "APR" I >> wanted to get them reduced to "M" "A" etc so that the >> lavel congestion can be avoided. >> >> >> I notice that below options are available, but was >> wondering how commbinatins of these locateors are used >> ie mark every month and every year once each. >> >> >> Is there a way to achive the above or does it need >> further development? >> >> fmt = mdates.DateFormatter('%Y-%m-%d') >> loc = >> mdates.WeekdayLocator(byweekday=mdates.MONDAY,interval=4) >> locator = mdates.YearLocator() >> >> >> If I were trying to do this, I'd cobble something together >> using by the minor and major formatters. >> e.g.,... >> import matplotlib.dates as mdates >> import matplotlib.pyplot as plt >> >> fig, ax = plt.subplots() >> >> majorLocs = mdates.MonthLocator(bymonth[1,7]) >> majorFmt = mdates.DateFormatter('%b\n%Y') >> >> minorLocs = mdates.MonthLocator(bymonth[1,7]) >> minorFmt = mdates.DateFormatter('%b') >> >> ax.xaxis.set_major_locator(majorLocs) >> ax.xaxis.set_major_formatter(majorFmt) >> >> ax.xaxis.set_minor_locator(minorLocs) >> ax.xaxis.set_minor_formatter(minorFmt) >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Windows: >> >> Build for Windows Store. >> >> http://p.sf.net/sfu/windows-dev2dev >> >> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > >------------------------------------------------------------------------------ >This SF.net email is sponsored by Windows: > >Build for Windows Store. > >http://p.sf.net/sfu/windows-dev2dev >_______________________________________________ >Matplotlib-users mailing list >Mat...@li... >https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > |