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






Showing results of 240

<< < 1 .. 7 8 9 10 > >> (Page 9 of 10)
From: Mark B. <ma...@gm...> - 2007年09月05日 07:45:34
Hey Che -
If you include your graphs in a wxPython app, you shouldn't use pylab.
Pylab is a wrapper to (quickly) generate graphs, and is very useful,
especially in interactive mode, as it saves a lot of typing and is much
easier to understand (indeed, a lot like matlab plotting). But for inclusion
in apps you need to use matplotlib, so you are on the right track. This has
been discussed several times on the list, but it may not be so easy to find.
Maybe we should put this on the FAQ page (or maybe it is already there!),
Mark
On 9/4/07, C M <cmp...@gm...> wrote:
>
> Mark, Mark, Brendan, John, thanks for the input. I have a related
> question that may help to continue to clear things up for me. My goal is to
> use matplotlib with wxPython, and I've been able to embed graphs in wxPython
> apps fine so far (in this case, directly, not using wxMPL). What I wanted
> to know is whether it is necessary to use pylab or not. I am a little
> unclear what the purpose of pylab is in distinction to matplotlib itself. I
> gather that pylab is a way to sort of emulate Matlab, but I am unclear as to
> whether I need to be using pylab in my apps or not. I am not doing
> scientific plots, just fairly simple graphs, though I may throw some
> regression lines and r values on there at some point.
>
> I really just want to keep things as simple as possible, and if I don't
> need to use pylab, I'd rather not. Any insight would be helpful. Thank
> you.
> Che M
>
> On 9/4/07, Mark Bakker <ma...@gm...> wrote:
> >
> > Maybe this will get you going:
> >
> > import pylab as p
> > import datetime as d
> > from matplotlib.dates import DateFormatter
> > t = [ d.datetime (2007,9,1,12), d.datetime(2007,9,2,12), d.datetime(2007,9,3,12)
> > ]
> > t = p.date2num(t)
> > p.plot_date( t, [10,20,30] )
> > p.xticks(t)
> > y = DateFormatter('%Y-%m-%d')
> > p.gca().xaxis.set_major_formatter(y)
> > p.draw()
> >
> > Mark
> >
> > From: "C M" <cmp...@gm...>
> > > Subject: [Matplotlib-users] basic understanding of plotting dates
> > >
> > > x = (2007年09月01日 12:00:02, 2007年09月02日 12:00:02, 2007年09月03日 12:00:02)
> > > y = (10, 20, 30)
> > >
> >
> >
>
From: Eric F. <ef...@ha...> - 2007年09月05日 07:36:21
Ping Yeh wrote:
> Hi,
> 
> I checked the manual and briefly searched the mailing list but did not
> find this... Is there a table-like data type with rows as events and
> columns as attributes that I can make plots with? This is called
> "ntuple" in the high energy physics community.
> 
> Let me illustrate with an example. Assume that an event consists of 3
> attributes (x, y, t). With N events we have a table of N x 3 data
> items. Assume that the data items are read from a file "xyt.dat".
> 
> d = Table("xyt.dat")
> d.plot("x", "t") # make a plot of x vs. t, N points are drawn
> d.plot("x") # make a histogram plot of x, N entries in the histogram
> d.plot("x", "y < 3") # make a histogram plot of x where y is less than 3.
> # that is, only {x[i] | y[i] < 3} are used to make the histogram
> 
> If there is no existing modules for this I'll go ahead write one. :)
There is nothing quite like this. As a starting point, though, you 
should become familiar with the ability of numpy to handle record 
arrays; your table data type sounds like a numpy record array. 
Matplotlib is a plotting library built on the numpy N-dimensional array 
library.
Eric
From: Ping Y. <pin...@gm...> - 2007年09月05日 07:18:47
Hi,
I checked the manual and briefly searched the mailing list but did not
find this... Is there a table-like data type with rows as events and
columns as attributes that I can make plots with? This is called
"ntuple" in the high energy physics community.
Let me illustrate with an example. Assume that an event consists of 3
attributes (x, y, t). With N events we have a table of N x 3 data
items. Assume that the data items are read from a file "xyt.dat".
d = Table("xyt.dat")
d.plot("x", "t") # make a plot of x vs. t, N points are drawn
d.plot("x") # make a histogram plot of x, N entries in the histogram
d.plot("x", "y < 3") # make a histogram plot of x where y is less than 3.
 # that is, only {x[i] | y[i] < 3} are used to make the histogram
If there is no existing modules for this I'll go ahead write one. :)
cheers,
Ping
From: C M <cmp...@gm...> - 2007年09月05日 07:00:31
On 9/4/07, Eric Firing <ef...@ha...> wrote:
>
> C M wrote:
> > I realize that the clearer question (and one which ties into my original
> > thread) is: do I need pylab to do plot_date()?
>
> No, plot_date is available as an axes method. Most pylab plotting
> commands are thin wrappers for axes methods.
Thanks for your help in clearing this up and the uses of pylab.
So basically I need to use plot_date but in a figure embedded in a wxPython
app.
Still not sure how this should be written. To make it simple, this plot()
command
works in my app already:
x = [1,2,3]
y = [10,20,30]
self.subplot.plot(x, y)
So, my question is, how would this be modified for a wx app (that is, no
pylab
allowed) and use plot_date()? Assume my dates are as given below.
dates (x axis):
09-01-07 12:00:02
09-02-07 12:00:04
09-03-07 12:00:06
values (y axis):
10
20
30
The examples that Bill and Mark gave above in the list showed how to do
this using pylab, but I just need the simplest example and one which does
not use pylab.
Thanks,
Che
From: Christopher B. <Chr...@no...> - 2007年09月04日 23:03:51
Robert Dailey wrote:
> Ah; Thanks guys. I thought 'arange' was a class, however it is a 
> function. I get it now. Sorry for the confusion!
Just a note: most often (at least if you are working with floating point 
values) you want "linspace", rather than arange:
 >>> N.linspace(3, 99, 33)
array([ 3., 6., 9., 12., 15., 18., 21., 24., 27., 30., 33.,
 36., 39., 42., 45., 48., 51., 54., 57., 60., 63., 66.,
 69., 72., 75., 78., 81., 84., 87., 90., 93., 96., 99.])
fewer surprises with floating point oddities.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Eric F. <ef...@ha...> - 2007年09月04日 22:57:55
C M wrote:
> I realize that the clearer question (and one which ties into my original 
> thread) is: do I need pylab to do plot_date()?
No, plot_date is available as an axes method. Most pylab plotting 
commands are thin wrappers for axes methods.
Eric
From: Eric F. <ef...@ha...> - 2007年09月04日 22:55:54
C M wrote:
> Mark, Mark, Brendan, John, thanks for the input. I have a related 
> question that may help to continue to clear things up for me. My goal 
> is to use matplotlib with wxPython, and I've been able to embed graphs 
> in wxPython apps fine so far (in this case, directly, not using wxMPL). 
> What I wanted to know is whether it is necessary to use pylab or not. I 
> am a little unclear what the purpose of pylab is in distinction to 
> matplotlib itself. I gather that pylab is a way to sort of emulate 
> Matlab, but I am unclear as to whether I need to be using pylab in my 
> apps or not. I am not doing scientific plots, just fairly simple 
> graphs, though I may throw some regression lines and r values on there 
> at some point. 
> 
> I really just want to keep things as simple as possible, and if I don't 
> need to use pylab, I'd rather not. Any insight would be helpful. Thank 
> you.
> Che M
No, you do not need to use pylab. It provides an API that is concise, 
comfortable, and responsive, especially for interactive use. Even in 
scripts that are mostly written in OO fashion, use of a few pylab 
functions (e.g., figure, subplot, show) can simplify the code. This 
does not apply if you are embedding mpl in wx, however; none of the 
examples/embedding_in_*.py demos import pylab.
In addition to its role as an alternative interface to mpl, pylab 
imports most of numpy and some additional functions, providing a 
somewhat matlab-like environment. This can be handy for interactive work.
There is a range of opinion regarding pylab, but I think the center of 
the range is: don't use pylab when mpl is embedded; use it very 
sparingly for normal programming; and for interactive use, if it makes 
you more productive, use it as much as you want.
Eric
From: C M <cmp...@gm...> - 2007年09月04日 22:48:38
I realize that the clearer question (and one which ties into my original
thread) is: do I need pylab to do plot_date()?
On 9/4/07, C M <cmp...@gm...> wrote:
>
> Mark, Mark, Brendan, John, thanks for the input. I have a related
> question that may help to continue to clear things up for me. My goal is to
> use matplotlib with wxPython, and I've been able to embed graphs in wxPython
> apps fine so far (in this case, directly, not using wxMPL). What I wanted
> to know is whether it is necessary to use pylab or not. I am a little
> unclear what the purpose of pylab is in distinction to matplotlib itself. I
> gather that pylab is a way to sort of emulate Matlab, but I am unclear as to
> whether I need to be using pylab in my apps or not. I am not doing
> scientific plots, just fairly simple graphs, though I may throw some
> regression lines and r values on there at some point.
>
> I really just want to keep things as simple as possible, and if I don't
> need to use pylab, I'd rather not. Any insight would be helpful. Thank
> you.
> Che M
>
> On 9/4/07, Mark Bakker <ma...@gm...> wrote:
> >
> > Maybe this will get you going:
> >
> > import pylab as p
> > import datetime as d
> > from matplotlib.dates import DateFormatter
> > t = [ d.datetime (2007,9,1,12), d.datetime(2007,9,2,12), d.datetime(2007,9,3,12)
> > ]
> > t = p.date2num(t)
> > p.plot_date( t, [10,20,30] )
> > p.xticks(t)
> > y = DateFormatter('%Y-%m-%d')
> > p.gca().xaxis.set_major_formatter(y)
> > p.draw()
> >
> > Mark
> >
> > From: "C M" <cmp...@gm...>
> > > Subject: [Matplotlib-users] basic understanding of plotting dates
> > >
> > > x = (2007年09月01日 12:00:02, 2007年09月02日 12:00:02, 2007年09月03日 12:00:02)
> > > y = (10, 20, 30)
> > >
> >
> >
>
From: Pierre GM <pgm...@gm...> - 2007年09月04日 22:23:07
On Tuesday 04 September 2007 17:53:56 Johann Cohen-Tanugi wrote:
> Jouni,
> thanks for your reply.
> I could test that
> plot([1,2,3],[1,2,3])
> setp(gca(), 'xlim', (3.0,1.0))
> works,
> but
> setp(gca(), 'xlim', reversed(getp(gca(), 'xlim')))
Johann,
You may find it easier to use methods instead of functions:
gca().set_xlim(gca().get_xlim()[::-1])
Note the [::-1], that will reverse your tuple.
From: Johann Cohen-T. <co...@sl...> - 2007年09月04日 21:54:05
Jouni,
thanks for your reply.
I could test that
 plot([1,2,3],[1,2,3])
 setp(gca(), 'xlim', (3.0,1.0))
works,
but
setp(gca(), 'xlim', reversed(getp(gca(), 'xlim')))
gives me an error :
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/cohen/<ipython console> in <module>()
/usr/lib/python2.5/site-packages/matplotlib/pylab.py in setp(*args, 
**kwargs)
 1386
 1387 def setp(*args, **kwargs):
-> 1388 ret = _setp(*args, **kwargs)
 1389 draw_if_interactive()
 1390 return ret
/usr/lib/python2.5/site-packages/matplotlib/artist.py in setp(h, *args, 
**kwargs)
 704 funcName = "set_%s"%s
 705 func = getattr(o,funcName)
--> 706 ret.extend( [func(val)] )
 707 return [x for x in flatten(ret)]
 708
/usr/lib/python2.5/site-packages/matplotlib/axes.py in set_xlim(self, 
xmin, xmax, emit, **kwargs)
 1543 raise ValueError('Cannot set nonpositive limits with 
log transform')
 1544
-> 1545 xmin, xmax = mtrans.nonsingular(xmin, xmax, 
increasing=False)
 1546 self.viewLim.intervalx().set_bounds(xmin, xmax)
 1547 if emit: self.callbacks.process('xlim_changed', self)
/usr/lib/python2.5/site-packages/matplotlib/transforms.py in 
nonsingular(vmin, vmax, expander, tiny, increasing)
 272 vmin, vmax = vmax, vmin
 273 swapped = True
--> 274 if vmax - vmin <= max(abs(vmin), abs(vmax)) * tiny:
 275 if vmin==0.0:
 276 vmin = -expander
TypeError: unsupported operand type(s) for -: 'reversed' and 'float'
I guess that the issue is that reversed returns the reversed iterator on 
the sequnce, not the reversed sequence itself.
Best,
Johann
From: C M <cmp...@gm...> - 2007年09月04日 21:45:59
Mark, Mark, Brendan, John, thanks for the input. I have a related question
that may help to continue to clear things up for me. My goal is to use
matplotlib with wxPython, and I've been able to embed graphs in wxPython
apps fine so far (in this case, directly, not using wxMPL). What I wanted
to know is whether it is necessary to use pylab or not. I am a little
unclear what the purpose of pylab is in distinction to matplotlib itself. I
gather that pylab is a way to sort of emulate Matlab, but I am unclear as to
whether I need to be using pylab in my apps or not. I am not doing
scientific plots, just fairly simple graphs, though I may throw some
regression lines and r values on there at some point.
I really just want to keep things as simple as possible, and if I don't need
to use pylab, I'd rather not. Any insight would be helpful. Thank you.
Che M
On 9/4/07, Mark Bakker <ma...@gm...> wrote:
>
> Maybe this will get you going:
>
> import pylab as p
> import datetime as d
> from matplotlib.dates import DateFormatter
> t = [ d.datetime (2007,9,1,12), d.datetime(2007,9,2,12), d.datetime(2007,9,3,12)
> ]
> t = p.date2num(t)
> p.plot_date( t, [10,20,30] )
> p.xticks(t)
> y = DateFormatter('%Y-%m-%d')
> p.gca().xaxis.set_major_formatter(y)
> p.draw()
>
> Mark
>
> From: "C M" <cmp...@gm...>
> > Subject: [Matplotlib-users] basic understanding of plotting dates
> >
> > x = (2007年09月01日 12:00:02, 2007年09月02日 12:00:02, 2007年09月03日 12:00:02)
> > y = (10, 20, 30)
> >
>
>
From: Robert D. <rcd...@gm...> - 2007年09月04日 19:22:43
Ah; Thanks guys. I thought 'arange' was a class, however it is a function. I
get it now. Sorry for the confusion!
On 9/4/07, Steve Lianoglou <lis...@ar...> wrote:
>
> On Sep 4, 2007, at 3:09 PM, Robert Dailey wrote:
>
> > Hi,
> >
> > I come from using Matlab and I was just curious if it was possible
> > to create an arange from a quick for loop of numbers? For example:
> >
> > 0:3:100 would generate:
> > 0, 3, 6, 9, 12, ...., 96, 99
>
> In ipython's pylab mode:
>
> In [1]: arange(3,100,3)
> Out[1]:
> array([ 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45,
> 48, 51,
> 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99])
>
> > And I would want this range to be in an arange() object. Is there a
> > similar way of doing this? Thanks.
>
> Not sure what you mean by an "arange object", but arange returns a
> numpy array.
>
> HTH,
> -steve
>
From: Matthieu B. <mat...@gm...> - 2007年09月04日 19:12:47
Hi,
numpy.arange(0, 100, 3) perhaps ?
Matthieu
2007年9月4日, Robert Dailey <rcd...@gm...>:
>
> Hi,
>
> I come from using Matlab and I was just curious if it was possible to
> create an arange from a quick for loop of numbers? For example:
>
> 0:3:100 would generate:
> 0, 3, 6, 9, 12, ...., 96, 99
>
> And I would want this range to be in an arange() object. Is there a
> similar way of doing this? Thanks.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Robert D. <rcd...@gm...> - 2007年09月04日 19:09:20
Hi,
I come from using Matlab and I was just curious if it was possible to create
an arange from a quick for loop of numbers? For example:
0:3:100 would generate:
0, 3, 6, 9, 12, ...., 96, 99
And I would want this range to be in an arange() object. Is there a similar
way of doing this? Thanks.
From: Eric F. <ef...@ha...> - 2007年09月04日 18:16:39
Xavier Gnata wrote:
> Hi all,
> 
> I looking for a way to modify the colorbar ticks font size.
> a=rand(100,100)
> imshow(a)
> colorbar()
> and then??
> 
> For instance, xticks(fontsize=20) works well to modify the ticks 
> fontsize along the X-axis but colorbar(fontsize=20) does not exists.
> I must be missing something.
cb = colorbar() # grab the Colorbar instance
for t in cb.ax.get_yticklabels():
 t.set_fontsize(20)
The colorbar function makes a new axes object, the "ax" attribute of the 
Colorbar instance returned by the colorbar function. From that you get 
the list of text objects, which you then modify.
The pylab xticks and yticks functions make the retrieval and 
modification of the text objects easier, but they operate only on the 
"current axes", and the colorbar leaves the image axes as current.
An alternative method is to change the current axes:
imaxes = gca()
axes(cb.ax)
yticks(fontsize=20)
axes(imaxes)
Here I saved and restored the original axes in case you want to do 
something with the image axes after modifying the colorbar.
Eric
From: John H. <jd...@gm...> - 2007年09月04日 17:40:16
On 9/4/07, Brendan Barnwell <bre...@br...> wrote:
> Incidentally, is there a reason why matplotlib can't just handle datetime
> objects itself? The requirement of having to manually convert them to an ad-hoc
> matplotlib "format" (which is just an integer) seems rather obtuse.
It can handle native datetime objects, as of recent versions, but it
is not trivial. The original versions of matplotlib assumed you were
passing in floating point (not integer) sequences (matplotlib was
written before python had a datetime object by the way, and we
supported conversion from mx datetime objects). So we supplied some
conversion functions to convert mx dates or python datetimes to
floating point numbers so matplotlib could handle them like all other
numbers, and used custom tick locators and tick formatters decorate
the date axes.
More recent versions of matplotlib support plotting with custom (non
scalar) types via a conversion registry, so you can do the obvious
thing with native datetime objects.
JDH
From: Brendan B. <bre...@br...> - 2007年09月04日 17:15:15
Bill Dandreta wrote:
>>>C M wrote:
>> 1. What exactly must I import (which modules) and how do I import them
>> (in the sense of "import x" vs. "from x import y")?
>> 2. What arguments does the plot_date() command take and what is format
>> of the arguments?
>> 3. Do I have to make the conversion from the date format above to the
>> matplotlib date format? If so, how?
> <<
> 
> The code snippet below should answer most of your questions.
	Incidentally, is there a reason why matplotlib can't just handle datetime 
objects itself? The requirement of having to manually convert them to an ad-hoc 
matplotlib "format" (which is just an integer) seems rather obtuse.
-- 
--Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no path, 
and leave a trail."
	--author unknown
From: Mark B. <ma...@gm...> - 2007年09月04日 15:20:37
Maybe this will get you going:
import pylab as p
import datetime as d
from matplotlib.dates import DateFormatter
t = [ d.datetime (2007,9,1,12), d.datetime(2007,9,2,12),
d.datetime(2007,9,3,12)
]
t = p.date2num(t)
p.plot_date( t, [10,20,30] )
p.xticks(t)
y = DateFormatter('%Y-%m-%d')
p.gca().xaxis.set_major_formatter(y)
p.draw()
Mark
From: "C M" <cmp...@gm...>
> Subject: [Matplotlib-users] basic understanding of plotting dates
>
> x = (2007年09月01日 12:00:02, 2007年09月02日 12:00:02, 2007年09月03日 12:00:02)
> y = (10, 20, 30)
>
From: Bill D. <wjd...@at...> - 2007年09月04日 15:16:18
>>C M wrote:
> 1. What exactly must I import (which modules) and how do I import them
> (in the sense of "import x" vs. "from x import y")?
> 2. What arguments does the plot_date() command take and what is format
> of the arguments?
> 3. Do I have to make the conversion from the date format above to the
> matplotlib date format? If so, how?
<<
The code snippet below should answer most of your questions.
2 problems:
autofmt_xdate() did not rotate the minor tick label, I don't now how to
do that.
I could not figure out how to draw minor tick grid lines.
import datetime as DT
import pylab as P
import time
x = ['2007-09-01 12:00:02', '2007-09-02 12:00:02', '2007-09-03 12:00:02']
y = [10, 20, 30]
fmt='%Y-%m-%d %H:%M:%S'
x1=[DT.datetime(*time.strptime(d,fmt)[:6]) for d in x]
dates=P.date2num(x1)
fig = P.figure()
ax = fig.add_subplot(111)
ax.plot_date(dates, y)
ax.xaxis.set_major_locator( P.DayLocator() )
ax.xaxis.set_minor_locator( P.HourLocator(12))
ax.xaxis.set_major_formatter( P.DateFormatter('%Y-%m-%d') )
ax.xaxis.set_minor_formatter( P.DateFormatter('%Y-%m-%d %H:%M:%S'))
ax.grid(True)
fig.autofmt_xdate()
P.show()
-- 
Bill
wjd...@at...
Gentoo Linux X86_64 2.6.20-gentoo-r8
Reclaim Your Inbox with http://www.mozilla.org/products/thunderbird/
All things cometh to he who waiteth as long as he who waiteth worketh like hell while he waiteth.
From: Xavier G. <gn...@ob...> - 2007年09月04日 12:40:05
Hi all,
I looking for a way to modify the colorbar ticks font size.
a=rand(100,100)
imshow(a)
colorbar()
and then??
For instance, xticks(fontsize=20) works well to modify the ticks 
fontsize along the X-axis but colorbar(fontsize=20) does not exists.
I must be missing something.
Xavier
-- 
############################################
Xavier Gnata
CRAL - Observatoire de Lyon
9, avenue Charles André
69561 Saint Genis Laval cedex
Phone: +33 4 78 86 85 28
Fax: +33 4 78 86 83 86
E-mail: gn...@ob...
############################################ 
From: <jk...@ik...> - 2007年09月04日 12:39:39
Michael Droettboom <md...@st...>
writes:
> I forgot to mention when I added baseline alignment -- I really have no 
> idea how to get a good baseline out of the usetex machinery, or if 
> that's even possible.
In principle it should be possible: TeX aligns its boxes on a baseline
unless you request otherwise, so you just have to make sure you position
your text or formula at known coordinates, and when you examine the
resulting page, you keep track of where the baseline should be. In
practice there probably are some more complications.
Or, resort to some TeX hackery... you can get TeX to report the
dimensions (height, depth, and width) of a box with \showbox:
http://uucode.com/blog/2006/02/26/showbox-in-latex/
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Michael D. <md...@st...> - 2007年09月04日 12:09:29
Thanks for fixing that.
I forgot to mention when I added baseline alignment -- I really have no 
idea how to get a good baseline out of the usetex machinery, or if 
that's even possible.
Now that you've fixed that bug, the baseline-misalignment problem should 
only affect those who explicitly turn on baseline alignment (using 
valignment = "baseline" on a text object).
If we can't get a baseline from usetex, we may have to decide whether 
it's worth keeping baseline alignment in as a feature at all...
Cheers,
Mike
Jouni K. Seppänen wrote:
> Xavier Gnata <gn...@ob...> writes:
> 
>> I do not know if we should post bug reports against matplotlib svn. 
> 
> Posting bug reports is likely to be helpful, but I suspect the
> developers' list might be more appropriate for bugs in the svn version.
> For bugs in released versions, I think John has told people to file a
> bug in the Sourceforge tracker and also send a message to the mailing
> list.
> 
>> Anyway, imshow is now fully broken this way :
> [...]
>> --> 200 w, h, d = renderer.get_text_width_height_descent(
>> ValueError: need more than 2 values to unpack
> 
> It's not in imshow really, but in the usetex branch of
> get_text_width_height_descent in the agg backend. I fixed the immediate
> problem, though baseline alignment is unlikely to work with usetex as of
> now.
> 
From: C M <cmp...@gm...> - 2007年09月04日 04:18:25
This is really basic stuff but I had some problems navigating in the
matplotlib website (*if anyone is interested, I'll list those issues at the
end). I want to simply plot dates. After reading the tutorial, I just
don't understand how to do it.
I will have lists of dates in the format like 2007年09月01日 12:00:02 and a list
of corresponding values. I would like to make a simple line graph with
markers at the data points and axis markers at reasonable intervals such as
each day or each week. My questions are:
1. What exactly must I import (which modules) and how do I import them (in
the sense of "import x" vs. "from x import y")?
2. What arguments does the plot_date() command take and what is format of
the arguments?
3. Do I have to make the conversion from the date format above to the
matplotlib date format? If so, how?
As an example how would I make a line plot with markers for this data?:
x = (2007年09月01日 12:00:02, 2007年09月02日 12:00:02, 2007年09月03日 12:00:02)
y = (10, 20, 30)
Thanks.
--------------------------------------------
*the issues I had with navigating or figuring this out on my own:
Broken links on two of the functions:
http://matplotlib.sourceforge.net/datetime.html
http://matplotlib.sourceforge.net/dateutil.html
In the tutorial, under the dates section, the drange command is used but it
isn't clear which module has to be imported for it to work. I tried it with
matplotlib and Python's datetime module and it didn't work.
In the date_demo1.py and dat_demo2 in the examples, date is gotten from the
quotes_historical_yahoo module calling up Yahoo's stock quotes. The problem
for me was I wasn't sure which format the arguments were in that this
quotes_historical_yahoo() returns.
From: <jk...@ik...> - 2007年09月03日 22:21:03
Johann Cohen-Tanugi <co...@sl...> writes:
> I would like to know if there is an easy to invert a axis (specifically 
> the x-axis), id est to have the labels between say 0 an1 automatically 
> run from right to left.
setp(gca(), 'xlim', reversed(getp(gca(), 'xlim')))
i.e., just put the larger limit before the smaller one.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Johann Cohen-T. <co...@sl...> - 2007年09月03日 21:52:23
hello,
I would like to know if there is an easy to invert a axis (specifically 
the x-axis), id est to have the labels between say 0 an1 automatically 
run from right to left. This is particularly welcome in astrophysical 
context, where the spherical x coordinate of a 2D image is often reversed.
thanks,
Johann
2 messages has been excluded from this view by a project administrator.

Showing results of 240

<< < 1 .. 7 8 9 10 > >> (Page 9 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 によって変換されたページ (->オリジナル) /