SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

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)
2
(3)
3
(14)
4
(11)
5
(10)
6
(7)
7
8
(3)
9
(16)
10
(9)
11
(12)
12
(1)
13
(14)
14
(10)
15
16
(1)
17
(7)
18
(9)
19
(7)
20
(10)
21
22
(1)
23
24
(1)
25
(5)
26
(7)
27
(1)
28
29
(2)
30
(2)
31
(11)




Showing 10 results of 10

From: Amol A. <pf...@gm...> - 2015年03月14日 19:17:52
Hello all,
I am trying to make Grotrian diagrams using matplotlib.
For those who don't know about grotrian diagrams here's the link(
http://en.wikipedia.org/wiki/Grotrian_diagram)
They essentially depict transitions between different energy levels of the
atoms.
Currently I have the data regarding the different energy levels of the
various atoms and need matplotlib to get the grotrian diagram of the atom
upon supplying it with the energy level data.
Can anyone please help me with this?
Regards,
Amol
From: Ryan N. <rne...@gm...> - 2015年03月14日 13:30:58
Brenton,
It's good to know that those other solutions work. Unfortunately, I'm just
sitting down at my Windows 7 computer, and I can't reproduce your problem.
I'm also using the Anaconda Python distribution, which might have different
behavior than your installation method.
However, you're in luck, because there are many, many ways to get IPython
to do what you want. (In fact, anything the Python interpreter does,
IPython does better.) All the possible options, though, can make things a
little tricky... Here's a couple of examples:
C:\> ipython -i filename.py
That will start IPython and automatically load the Python file "filename".
That way anything you define in "filename" will be available in the new
IPython session. Alternatively, you can use the IPython "%run" magic from
inside an IPython session:
In [1]: %run filename.py
That has the same effect as the first example.
As an alternative, IPython notebooks (
http://ipython.org/ipython-doc/stable/notebook/notebook.html) are a very
nice way to interactively work with some data while also retaining all of
the analysis code in a script-like manner. You can have your plots
displayed in the webpage by typing the following in one of the cells:
import matplotlib.pyplot as plt
%matplotlib inline
You can install this using pip:
C:\> pip install ipython[all]
I'm sorry I couldn't help you with your original problem, but I hope these
suggestions help.
Ryan
On Sat, Mar 14, 2015 at 8:54 AM, Brenton Horne <bre...@gm...>
wrote:
> On 14/03/2015 10:31 PM, Ryan Nelson wrote:
>
> >>> import matplotlib
> >>> matplotlib.use('TkAgg')
> >>> import matplotlib.pyplot as plt
> >>> plt.plot([1,2,3])
> >>> plt.show()
>
> That works fine.
>
> And
>
> import matplotlib
> >>> matplotlib.use('TkAgg')
> >>> import matplotlib.pyplot as plt
> >>> plt.ion()
> >>> plt.plot([1,2,3])
>
> works fine in IPython. I avoid using IPython btw because I don't know how
> to call py files from it. When it comes to python commands I like to save
> them as py files so I don't have to continually type them out. I know how
> to call files in the python shell as I access it via the command prompt
> (i.e., by typing python filename.py).
>
From: Ryan N. <rne...@gm...> - 2015年03月14日 12:31:30
Sorry Brenton, I meant for my reply to go to the entire list.
Anyway, in your response, I take it that you meant to say that the window
appears and disappears immediately. Yes?
What happens if you restart the Python interpreter and type the following?
>>> import matplotlib
>>> matplotlib.use('TkAgg')
>>> import matplotlib.pyplot as plt
>>> plt.plot([1,2,3])
>>> plt.show()
Does my first example work fine in the IPython interpreter? (Sorry, I'm not
on my Windows machine right now, so I can't tell you if I'm seeing the same
problem.)
Ryan
On Sat, Mar 14, 2015 at 8:21 AM, Brenton Horne <bre...@gm...>
wrote:
> Yes, a popup window appears but it appears immediately after it appears.
>
> On 14/03/2015 10:03 PM, Ryan Nelson wrote:
>
> Brenton,
>
> Unfortunately, those particular examples are out of date. First of all,
> I would not recommend using pylab at all -- and I think that many other
> folks will give you the same advice. (For reasons that I can describe later
> if you are interested.)
>
> IPython is a much different beast than the vanilla Python interpreter,
> especially in how it handles GUI stuff. Maybe you could temporarily move
> the matplotlibrc file that you created, and try the following from a
> regular Python session:
> >>> import matplotlib
> >>> matplotlib.use('TkAgg')
> >>> import matplotlib.pyplot as plt
> >>> plt.ion()
> >>> plt.plot([1,2,3])
> The second line is telling MPL what backend to use. (You can set this in
> the rc file later, but let's make sure this isn't the problem for now.) The
> third line imports the pyplot module, which is recommended over pylab. The
> fourth line is turning on interactive plotting. Once you execute the plot
> command on the fifth line, a popup window should appear. Yes?
>
> Ryan
>
>
>
> On Sat, Mar 14, 2015 at 5:17 AM, Brenton Horne <bre...@gm...>
> wrote:
>
>> Oh and I have made the mentioned customizations to matplotlibrc
>> (although the TkAgg line was already present). My python version is 2.7.9
>> and matplotlib version is 1.4.3.
>>
>> On 14/03/2015 7:14 PM, Brenton Horne wrote:
>>
>> Hi,
>>
>> I am on Windows 7 64 bit SP1 and I installed matplotlib via wheels files
>> here http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib but now
>> whenever I execute plotting commands from the python shell (e.g., the 'hi
>> mom' example here
>> http://matplotlib.org/1.4.3/users/shell.html?highlight=mailing%20list#other-python-interpreters)
>> it seems like as though some window is trying to pop up but nothing does.
>> Whereas if I try the the hist example here (
>> http://matplotlib.org/1.4.3/users/shell.html?highlight=mailing%20list#ipython-to-the-rescue)
>> in IPython I get a graph pop-up that seems fine.
>>
>> Thanks for your time,
>> Brenton
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website,
>> sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub
>> for all
>> things parallel software development, from weekly thought leadership
>> blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
From: Sudheer J. <sud...@ya...> - 2015年03月14日 10:42:50
Sorry,
 I tried both ax= and axes= both did not work. before testing I thought it is the correct way but did not work some how.
WIth best regards.
Sudheer
fig = plt.figure()
fig.subplots_adjust(left=0.001, wspace=0.01)
ax1 = fig.add_subplot(221);corrplot.Corrplot(df_djf,axes=ax1)
ax2 = fig.add_subplot(222);corrplot.Corrplot(df_mam,axes=ax2)
ax3 = fig.add_subplot(223);corrplot.Corrplot(df_jja,axes=ax3)
ax4 = fig.add_subplot(224);corrplot.Corrplot(df_son,axes=ax4)
 ...: 
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-7-c3cf513439f4> in <module>()
 1 fig = plt.figure()
 2 fig.subplots_adjust(left=0.001, wspace=0.01)
----> 3 ax1 = fig.add_subplot(221);corrplot.Corrplot(df_djf,axes=ax1)
 4 ax2 = fig.add_subplot(222);corrplot.Corrplot(df_mam,axes=ax2)
 5 ax3 = fig.add_subplot(223);corrplot.Corrplot(df_jja,axes=ax3)
TypeError: __init__() got an unexpected keyword argument 'axes'
--------------------------------------------
On Fri, 13/3/15, Adam Hughes <hug...@gm...> wrote:
 Subject: Re: [Matplotlib-users] Corr plot in subplot
 To: "Paul Hobson" <pmh...@gm...>
 Cc: "Sudheer Joseph" <sud...@ya...>, "Matplotlib Users" <mat...@li...>
 Date: Friday, 13 March, 2015, 7:06 PM
 
 All the
 pandas plots that I've used take an axes keyword so
 try:
 
 c =
 corrplot.Corrplot(df, ax=ax1)
 
 or
 c =
 corrplot.Corrplot(df, axes=ax1)
 
 Do either of those
 work?
 On Fri,
 Mar 13, 2015 at 2:04 PM, Paul Hobson <pmh...@gm...>
 wrote:
 What's the function signature of
 corrplot.CorrPlot? Hopefully you can pass an Axes object to
 it argument.-p
 On Fri, Mar 13, 2015 at
 9:02 AM, Sudheer Joseph <sud...@ya...>
 wrote:
 Dear
 Matplotlib exprets,
 
 I am trying to place the corrplot in subplot environment.
 But not able to figure out how to do it properly. Can any
 one advice please?
 
 
 
 
 
 from biokit.viz import corrplot
 
 df = pd.DataFrame(dict(( (k, np.random.random(10)+ord(k)-65)
 for k in letters)))
 
 df = df.corr()
 
 c = corrplot.Corrplot(df)
 
 
 
 I wanted to make the corrplot in below 4 boxes which can
 come out as a single figure. The above data is a test data
 actually I wanted use seasonal data for this purpose.
 
 
 
 fig = plt.figure()
 
 fig.subplots_adjust(left=0.2, wspace=0.6)
 
 ax1 = fig.add_subplot(221)
 
 ax2 = fig.add_subplot(222)
 
 ax3 = fig.add_subplot(223)
 
 ax4 = fig.add_subplot(224)
 
 
 
 
 
 ***************************************************************
 
 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
 
 ***************************************************************
 
 
 
 ------------------------------------------------------------------------------
 
 Dive into the World of Parallel Programming The Go Parallel
 Website, sponsored
 
 by Intel and developed in partnership with Slashdot Media,
 is your hub for all
 
 things parallel software development, from weekly thought
 leadership blogs to
 
 news, videos, case studies, tutorials and more. Take a look
 and join the
 
 conversation now. http://goparallel.sourceforge.net/
 
 _______________________________________________
 
 Matplotlib-users mailing list
 
 Mat...@li...
 
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 
 ------------------------------------------------------------------------------
 
 Dive into the World of Parallel Programming The Go Parallel
 Website, sponsored
 
 by Intel and developed in partnership with Slashdot Media,
 is your hub for all
 
 things parallel software development, from weekly thought
 leadership blogs to
 
 news, videos, case studies, tutorials and more. Take a look
 and join the
 
 conversation now. http://goparallel.sourceforge.net/
 _______________________________________________
 
 Matplotlib-users mailing list
 
 Mat...@li...
 
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 
From: Sudheer J. <sud...@ya...> - 2015年03月14日 10:25:30
Thank you Adam,
 I did not see your response earlier. It worls.
Thanks
Sudheer
 
***
--------------------------------------------
On Fri, 13/3/15, Adam Hughes <hug...@gm...> wrote:
 Subject: Re: [Matplotlib-users] Corr plot in subplot
 To: "Paul Hobson" <pmh...@gm...>
 Cc: "Sudheer Joseph" <sud...@ya...>, "Matplotlib Users" <mat...@li...>
 Date: Friday, 13 March, 2015, 7:06 PM
 
 All the
 pandas plots that I've used take an axes keyword so
 try:
 
 c =
 corrplot.Corrplot(df, ax=ax1)
 
 or
 c =
 corrplot.Corrplot(df, axes=ax1)
 
 Do either of those
 work?
 On Fri,
 Mar 13, 2015 at 2:04 PM, Paul Hobson <pmh...@gm...>
 wrote:
 What's the function signature of
 corrplot.CorrPlot? Hopefully you can pass an Axes object to
 it argument.-p
 On Fri, Mar 13, 2015 at
 9:02 AM, Sudheer Joseph <sud...@ya...>
 wrote:
 Dear
 Matplotlib exprets,
 
 I am trying to place the corrplot in subplot environment.
 But not able to figure out how to do it properly. Can any
 one advice please?
 
 
 
 
 
 from biokit.viz import corrplot
 
 df = pd.DataFrame(dict(( (k, np.random.random(10)+ord(k)-65)
 for k in letters)))
 
 df = df.corr()
 
 c = corrplot.Corrplot(df)
 
 
 
 I wanted to make the corrplot in below 4 boxes which can
 come out as a single figure. The above data is a test data
 actually I wanted use seasonal data for this purpose.
 
 
 
 fig = plt.figure()
 
 fig.subplots_adjust(left=0.2, wspace=0.6)
 
 ax1 = fig.add_subplot(221)
 
 ax2 = fig.add_subplot(222)
 
 ax3 = fig.add_subplot(223)
 
 ax4 = fig.add_subplot(224)
 
 
 
 
 
 ***************************************************************
 
 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
 
 ***************************************************************
 
 
 
 ------------------------------------------------------------------------------
 
 Dive into the World of Parallel Programming The Go Parallel
 Website, sponsored
 
 by Intel and developed in partnership with Slashdot Media,
 is your hub for all
 
 things parallel software development, from weekly thought
 leadership blogs to
 
 news, videos, case studies, tutorials and more. Take a look
 and join the
 
 conversation now. http://goparallel.sourceforge.net/
 
 _______________________________________________
 
 Matplotlib-users mailing list
 
 Mat...@li...
 
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 
 ------------------------------------------------------------------------------
 
 Dive into the World of Parallel Programming The Go Parallel
 Website, sponsored
 
 by Intel and developed in partnership with Slashdot Media,
 is your hub for all
 
 things parallel software development, from weekly thought
 leadership blogs to
 
 news, videos, case studies, tutorials and more. Take a look
 and join the
 
 conversation now. http://goparallel.sourceforge.net/
 _______________________________________________
 
 Matplotlib-users mailing list
 
 Mat...@li...
 
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
 
From: Brenton H. <bre...@gm...> - 2015年03月14日 09:18:02
Oh and I have made the mentioned customizations to matplotlibrc 
(although the TkAgg line was already present). My python version is 
2.7.9 and matplotlib version is 1.4.3.
On 14/03/2015 7:14 PM, Brenton Horne wrote:
> Hi,
>
> I am on Windows 7 64 bit SP1 and I installed matplotlib via wheels 
> files here http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib but 
> now whenever I execute plotting commands from the python shell (e.g., 
> the 'hi mom' example here 
> http://matplotlib.org/1.4.3/users/shell.html?highlight=mailing%20list#other-python-interpreters) 
> it seems like as though some window is trying to pop up but nothing 
> does. Whereas if I try the the hist example here 
> (http://matplotlib.org/1.4.3/users/shell.html?highlight=mailing%20list#ipython-to-the-rescue) 
> in IPython I get a graph pop-up that seems fine.
>
> Thanks for your time,
> Brenton
From: Brenton H. <bre...@gm...> - 2015年03月14日 09:15:08
Hi,
I am on Windows 7 64 bit SP1 and I installed matplotlib via wheels files 
here http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib but now 
whenever I execute plotting commands from the python shell (e.g., the 
'hi mom' example here 
http://matplotlib.org/1.4.3/users/shell.html?highlight=mailing%20list#other-python-interpreters) 
it seems like as though some window is trying to pop up but nothing 
does. Whereas if I try the the hist example here 
(http://matplotlib.org/1.4.3/users/shell.html?highlight=mailing%20list#ipython-to-the-rescue) 
in IPython I get a graph pop-up that seems fine.
Thanks for your time,
Brenton
From: Sudheer J. <sud...@ya...> - 2015年03月14日 07:52:52
Thank you Paul,
 I could not follow fully what you meant by that in reply. but below is the info available with corrplot.
Kindly provide some help.
With best regards,
Sudheer
 Here are some examples provided that the data is created and pass to c::
 | 
 | c = corrplot.Corrplor(dataframe)
 | c.plot(cmap=('Orange', 'white', 'green'))
 | c.plot(method='circle')
 | c.plot(colorbar=False, shrink=.8, upper='circle' )
 | 
--------------------------------------------
On Fri, 13/3/15, Paul Hobson <pmh...@gm...> wrote:
 Subject: Re: [Matplotlib-users] Corr plot in subplot
 To: "Sudheer Joseph" <sud...@ya...>
 Cc: "Matplotlib Users" <mat...@li...>
 Date: Friday, 13 March, 2015, 6:04 PM
 
 What's
 the function signature of corrplot.CorrPlot? Hopefully you
 can pass an Axes object to it
 argument.-p
 On Fri, Mar 13, 2015 at
 9:02 AM, Sudheer Joseph <sud...@ya...>
 wrote:
 Dear
 Matplotlib exprets,
 
 I am trying to place the corrplot in subplot environment.
 But not able to figure out how to do it properly. Can any
 one advice please?
 
 
 
 
 
 from biokit.viz import corrplot
 
 df = pd.DataFrame(dict(( (k, np.random.random(10)+ord(k)-65)
 for k in letters)))
 
 df = df.corr()
 
 c = corrplot.Corrplot(df)
 
 
 
 I wanted to make the corrplot in below 4 boxes which can
 come out as a single figure. The above data is a test data
 actually I wanted use seasonal data for this purpose.
 
 
 
 fig = plt.figure()
 
 fig.subplots_adjust(left=0.2, wspace=0.6)
 
 ax1 = fig.add_subplot(221)
 
 ax2 = fig.add_subplot(222)
 
 ax3 = fig.add_subplot(223)
 
 ax4 = fig.add_subplot(224)
 
 
 
 
 
 ***************************************************************
 
 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
 
 ***************************************************************
 
 
 
 ------------------------------------------------------------------------------
 
 Dive into the World of Parallel Programming The Go Parallel
 Website, sponsored
 
 by Intel and developed in partnership with Slashdot Media,
 is your hub for all
 
 things parallel software development, from weekly thought
 leadership blogs to
 
 news, videos, case studies, tutorials and more. Take a look
 and join the
 
 conversation now. http://goparallel.sourceforge.net/
 
 _______________________________________________
 
 Matplotlib-users mailing list
 
 Mat...@li...
 
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 
Hello,
I'm trying to learn if there is a better or less tedious way of changing the
x-axis time scale interval size when plotting time series data using
MATPLOTLIB.
To account for all the different x-axis intervals that I may end up using, I
usually do the following imports:
from matplotlib.dates import YearLocator, MonthLocator, WeekdayLocator,
DateFormatter, DayLocator
from matplotlib.dates import MO, TU, WE, TH, FR, SA, SU
Then I specify specific intervals by doing the following:
year = YearLocator()
month = MonthLocator(bymonth=range(1,13), bymonthday=1, interval=1)
week = WeekdayLocator(byweekday=MO) # Every MOnday
day = DayLocator(bymonthday=range(1,32), interval=1)
Then apply any of the above formats by doing:
axes.xaxis.set_major_locator(year)
axes.xaxis.set_major_locator(month)
I find all that above too tedious since I may then decide to change the
intervals to something different to experiment.
With R's ggplot2 or Yhat's ggplot, it is very simple and intuitive to change
the x-axis scale interval. You just need to specify the breaks and
minor_breaks interval like so:
scale_x_datetime(labels=date_format("%Y-%m"), breaks="3 months",
minor_breaks="1 month")
I've quit using MATPLOTLIB for plotting time series data because of this. 
However, I thought perhaps there is a better way that I am not aware of.
If there is a better way, please educate me! Thanks!
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Less-tedious-way-to-change-the-x-axis-scale-intervals-with-time-series-data-tp45175.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Okay. I figured out the problem. You need to pass a dictionary to the
config magic. Here is the relevant code:
%config InlineBackend.print_figure_kwargs = {'bbox_inches':None}
I created a PR with IPython (https://github.com/ipython/ipython/pull/8051)
to add this information to the %matplotlib documentation, so this doesn't
cause confusion for others.
Thanks to all the IPython and MPL devs for these great tools!
On Fri, Mar 13, 2015 at 7:07 PM, Wes Turner <wes...@gm...> wrote:
> Ryan,
>
>
> http://wrdrd.github.io/docs/consulting/data-science.html#data-visualization-tools
> On Mar 13, 2015 1:59 PM, "Ryan Nelson" <rne...@gm...> wrote:
>
>> I'm constructing a multi-plot figure using an IPython notebook (v3) and
>> matplotlib (v1.4.3) inline magic. I was manually setting the axes bounds,
>> and I ended up with something like the following:
>>
>> ########
>> import matplotlib.pyplot as plt
>> %matplotlib inline
>>
>> bottom = 0.12
>> top = 0.9
>> left = 0.12
>> axwidth = (1-(left*2))/3
>>
>> fig = plt.figure(figsize=(10,4))
>>
>> ax1 = fig.add_axes((left, bottom, axwidth, top))
>> ax1.set_title('Title')
>> #ax1.tick_params(labelleft=False)
>>
>> ax2 = fig.add_axes((left+axwidth, bottom, axwidth, top),
>> sharex=ax1, sharey=ax1)
>> ax2.tick_params(labelleft=False)
>>
>> ax3 = fig.add_axes((left+axwidth*2, bottom, axwidth, top),
>> sharex=ax1, sharey=ax1)
>> ax3.tick_params(labelleft=False)
>>
>> fig.savefig('junk.pdf', format='pdf')
>> fig.savefig('junk2.png')
>> #######
>>
>> Obviously, the bottom+top that I've selected is >1, so the axes should go
>> off the top of the figure. (Stupid, I know...) The axes in both the PDF and
>> PNG formatted files are clipped by the top of the figure as you would
>> expect; however, the figure that is displayed in the Notebook looks just
>> fine. In addition, if you add a title to one of the axes, the figure in
>> IPython suddenly creates more space for the text. Maybe it is rearranging
>> the axes information behind the scenes?
>>
>> I'm curious why this design decision was made. I would say this is a bug.
>> Now that I know about this behavior, I can easily fix it. But new users
>> will be baffled when their saved figure looks nothing like the displayed
>> figure in the notebook.
>>
>> Ryan
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPy...@sc...
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
> _______________________________________________
> IPython-dev mailing list
> IPy...@sc...
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>

Showing 10 results of 10

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /