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) |
|
|
|
|
|
|
|
From: Steve S. <el...@gm...> - 2007-09-05 20:51:36
|
Robert Dailey wrote: > Hi, > > I have two questions: > > 1) Is there any way to represent vectors? Currently I'm using 'array' for > vectors. > I suppose you mean vectors in the Matlab way? Then you should have a look at http://scipy.org/NumPy_for_Matlab_Users#head-e9a492daa18afcd86e84e07cd2824a9b1b651935 In short: of course you can do all linalg with numpy.array. With numpy.matrix, some operations (like dot products) can be written more conveniently. > 2) Is there a way to calculate the magnitude (length) of a vector? > a = array([3,1,4]) len(a) a.size # only for a rank-1 array a.shape[0] For some basics on numpy, you may also check out: http://scipy.org/Documentation HTH -- cheers, steve I love deadlines. I like the whooshing sound they make as they fly by. -- Douglas Adams |
|
From: Eric F. <ef...@ha...> - 2007-09-05 19:50:02
|
Hal Huntley wrote: > I'm a sys admin trying to install the matplotlib python package for someone > on our staff. I'm not overly familar with python. > > We are trying to use matplotlib with pylab. > > uname -a > Linux andromeda 2.6.13-1.1532_FC4smp #1 SMP Thu Oct 20 01:51:51 EDT 2005 > i686 i686 i386 GNU/Linux > > The python version we have is the default that we got with the Fedora Core 4 > package. > > python -V > Python 2.4.1 > > I've installed using /usr/bin/easy_install: > matplotlib-0.90.1-py2.4-win32.egg numpy-1.0.3.1-py2.4-win32.egg I've never understood eggs and easy_install, but it certainly doesn't look right that you are installing things labelled "win32" on a Linux box! I'm surprised you got that far. For linux, I like to install from source, since the distro packages for numpy and mpl are usually too old. If you get the tarballs, build and install numpy first, then mpl. You don't need or want Numeric or numarray. The build process may fail. If it does, it is because you need to install distro packages with headers for various libraries, and you should be able to see from the failures which headers are missing. Maybe someone else can provide more detailed instructions for Fedora C4. Eric > > If we get in to python and give the command: >>>> from pylab import * > > We get: > == > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File > "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/pylab.py", line 1, in ? > from matplotlib.pylab import * > File > "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/pylab.py", line 201, in ? > import mlab #so I can override hist, psd, etc... > File > "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/mlab.py", line 64, in ? > import nxutils > File > "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/nxutils.py", line 17, in ? > from matplotlib._ns_nxutils import * > File > "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/_ns_nxutils.py", line 7, in ? > __bootstrap__() > File > "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/_ns_nxutils.py", line 5, in __bootstrap__ > del __bootstrap__, __loader__ > NameError: global name '__loader__' is not defined > == > > I've read that numeric may need to be installed, so I got "Numeric-24.2" > and did: > python setup.py build > python setup.py install > > That didn't help solve the issue. > > Is there some other package that needs to be installed? I checked the FAQ > and this issue does not seem to be there. > > Regards, > > Hal Huntley > SRI International > > ------------------------------------------------------------------------- > 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: Eric F. <ef...@ha...> - 2007-09-05 19:05:56
|
C M wrote: > > > > x = [1,2,3] > > y = [10,20,30] > > self.subplot.plot(x, y) > > I don't understand--where did "self" come from? > > > Sorry--"self" here refers to an instance of a wxPanel class in my > wxPython app. > It is the parent window for the mpl subplot which is meant to be a child > of it. > The subplot is itself a child of a Figure, so the creation is like this: > > self.figure = Figure(None, dpi) > self.subplot = self.figure.add_subplot(111) add_subplot makes an Axes instance and puts it in the Figure instance; self.subplot is this Axes instance, as I had guessed. So, you can apply any Axes method to it. Eric |
|
From: Hal H. <ha...@so...> - 2007-09-05 19:02:16
|
I'm a sys admin trying to install the matplotlib python package for someone
on our staff. I'm not overly familar with python.
We are trying to use matplotlib with pylab.
uname -a
Linux andromeda 2.6.13-1.1532_FC4smp #1 SMP Thu Oct 20 01:51:51 EDT 2005
i686 i686 i386 GNU/Linux
The python version we have is the default that we got with the Fedora Core 4
package.
python -V
Python 2.4.1
I've installed using /usr/bin/easy_install:
matplotlib-0.90.1-py2.4-win32.egg numpy-1.0.3.1-py2.4-win32.egg
If we get in to python and give the command:
>>> from pylab import *
We get:
==
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/pylab.py", line 1, in ?
from matplotlib.pylab import *
File
"/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/pylab.py", line 201, in ?
import mlab #so I can override hist, psd, etc...
File
"/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/mlab.py", line 64, in ?
import nxutils
File
"/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/nxutils.py", line 17, in ?
from matplotlib._ns_nxutils import *
File
"/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/_ns_nxutils.py", line 7, in ?
__bootstrap__()
File
"/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/_ns_nxutils.py", line 5, in __bootstrap__
del __bootstrap__, __loader__
NameError: global name '__loader__' is not defined
>>>
==
I've read that numeric may need to be installed, so I got "Numeric-24.2"
and did:
python setup.py build
python setup.py install
That didn't help solve the issue.
Is there some other package that needs to be installed? I checked the FAQ
and this issue does not seem to be there.
Regards,
Hal Huntley
SRI International
|
|
From: C M <cmp...@gm...> - 2007-09-05 18:24:55
|
> x = [1,2,3] > > y = [10,20,30] > > self.subplot.plot(x, y) > > I don't understand--where did "self" come from? Sorry--"self" here refers to an instance of a wxPanel class in my wxPython app. It is the parent window for the mpl subplot which is meant to be a child of it. The subplot is itself a child of a Figure, so the creation is like this: self.figure = Figure(None, dpi) self.subplot = self.figure.add_subplot(111) If we assume that self.subplot is in fact an axes instance, then you can > use > self.subplot.plot_date(...), where the arguments would be the same as if > you were using pylab.plot_date(...). Is it? How is Figure() related to axes? Maybe it would also help for you to look at dates.py (one of the mpl > modules)? I will try; so far, when I try to adapt the examples given in this thread to an wx embedded app it is not working... Thanks, Che |
|
From: Patrick B. <pat...@gm...> - 2007-09-05 18:20:53
|
Never mind - I missed a key point in the documentation. For anyone who's
wondering:
lg = legend()
lg.get_frame().set_facecolor('black')
works fine.
--Patrick
On 9/5/07, Patrick Bradley <pat...@gm...> wrote:
>
> Hi all,
>
> Can you change the background of the figure legends generated by
> matplotlib? I'd like to have some white-on-black figures for a few
> presentations that I'm giving, and I can change the figure and axes
> facecolor attributes accordingly (as well as the default text and axis label
> colors), but I can't find an option anywhere to change the background of the
> legend: it still shows up as a white box. Any ideas?
>
> Thanks in advance.
>
> Yours,
> Patrick
>
|
|
From: Eric F. <ef...@ha...> - 2007-09-05 18:12:52
|
Ping Yeh wrote:
> 2007/9/5, Eric Firing <ef...@ha...>:
>> Ping Yeh wrote:
>> [snip]
>>> 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
>>
>
> Hi Eric,
>
> Thanks for the info. I searched for the numpy record array and it is
> indeed very close to what I want for the data storage! Thanks!
>
> Just one quick question, though (I admit I don't have much experience
> with numpy...). Can a record array store string data? I'll have some
> of these in the attribute data, not used for plotting but needed for
> other purposes.
Yes. Here is an example:
In [27]:dd1 = numpy.dtype({'names': ['x', 'y', 'i', 'comment'],
'formats': ['<f8', '<f8', '<i4', 'S20']})
In [28]:xx = numpy.array([(1.1, 2.2, 1, 'first'), (1.2, 2.3, 2,
'second')], dtype=dd1)
In [29]:xx
Out[29]:
array([(1.1000000000000001, 2.2000000000000002, 1, 'first'),
(1.2, 2.2999999999999998, 2, 'second')],
dtype=[('x', '<f8'), ('y', '<f8'), ('i', '<i4'), ('comment',
'|S20')])
In [30]:xx['x']
Out[30]:array([ 1.1, 1.2])
In [31]:xx['comment']
Out[31]:
array(['first', 'second'],
dtype='|S20')
There is one non-obvious thing to note: in line 28, each record must be
a *tuple*, not a *list*.
Note also that you must allow enough space for the maximum length of
string. Alternatively, the strings can be stored as objects:
In [32]:dd2 = numpy.dtype({'names': ['x', 'y', 'i', 'comment'],
'formats': ['<f8', '<f8', '<i4', 'O']})
In [33]:xx = numpy.array([(1.1, 2.2, 1, 'first'), (1.2, 2.3, 2,
'second')], dtype=dd2)
In [34]:xx['comment']
Out[34]:array([first, second], dtype=object)
In [35]:xx['x']
Out[35]:array([ 1.1, 1.2])
Eric
|
|
From: Patrick B. <pat...@gm...> - 2007-09-05 17:59:36
|
Hi all, Can you change the background of the figure legends generated by matplotlib? I'd like to have some white-on-black figures for a few presentations that I'm giving, and I can change the figure and axes facecolor attributes accordingly (as well as the default text and axis label colors), but I can't find an option anywhere to change the background of the legend: it still shows up as a white box. Any ideas? Thanks in advance. Yours, Patrick |
|
From: Robert D. <rcd...@gm...> - 2007-09-05 17:02:08
|
Hi, I have two questions: 1) Is there any way to represent vectors? Currently I'm using 'array' for vectors. 2) Is there a way to calculate the magnitude (length) of a vector? Thanks. |
|
From: Ping Y. <pin...@gm...> - 2007-09-05 10:09:36
|
Hello,
Thanks to quick hints/tips from Eric and Lionel, I have a module for
conditional plotting and histogramming without defining a table type!
It works with numerical arrays quite well, but does not work on string
arrays in conditions.
I paste the code below since they are quite short. Hope that's not
considered spam on this list. :)
cheers and thanks,
Ping
from pylab import *
def __prepare(arg):
cond = arg[-1]
indices = find(cond)
toplot = []
atype = type(array([0,1]))
for vec in arg[:-1]:
if type(vec) == type(""): toplot.append(vec)
if type(vec) == atype: toplot.append(array([vec[i] for i in indices]))
return toplot
def cplot(*arg, **kw):
'''Make a conditional plot. Example:
cplot(t, x, y > 3) => a plot of { (t[i],x[i]) | y[i] > 3}
cplot(x, y > 3) => a plot of { (i,x[i]) | y[i] > 3}
The condition string can have multiple conditions joined by logical
operators & | ^. All keyword arguments are passed intact to plot().
'''
toplot = __prepare(arg)
return plot(*toplot, **kw)
def chist(*arg, **kw):
'''Make a conditional histogram. Example:
chist(x, y > 3) => a histogram plot of {x[i] | y[i] > 3}
The condition string can have multiple conditions joined by logical
operators & | ^. All keyword arguments are passed intact to hist().
'''
toplot = __prepare(arg)
return hist(*toplot, **kw)
def testcplot():
t = arange(0,1.0, 0.01)
x = sin(t*2*pi)
y = exp(-t/0.5)
plot(t, x)
plot(t, y)
cplot(t, x, "o", y<0.2)
if __name__ == '__main__':
testcplot()
|
|
From: Xavier G. <gn...@ob...> - 2007-09-05 10:05:28
|
Eric Firing wrote: > 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 > Hi, Your first method is not working on my box (no change) but the second one is just fine :) However, it is not as intuitive as other matplotlib ways of doing things. Is there a simple way to modify the colorbar code to get something like colorbar(fontsize=20) work ? Or maybe as a method like that : cb=colorbar() cb.set_fontsize(20) Any comments ? 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: Andres L. <and...@ut...> - 2007-09-05 09:48:27
|
Hi all!
I'm new to matplotlib so please excuse me, if this is a bit too simple
problem.
I'm trying to animate simple plot using example anim.py
It works well when I just write functions as follows:
def joonista(x):
line, = p.plot(ala, x)
p.draw()
time.sleep(0.1)
def lpc(x):
x2=empty(real(ap))
for t in range(maxt):
x2[alg]=x[alg+1]
x2[ap-1]=x[alg]
for k in range(alg+1,ap-1):
x2[k]=x[k+1]
x=x2
joonista(x2)
but when I write the functions in a more general way and define an
additional function "lpc1" to make some calculation, like this:
def joonista(x):
line, = p.plot(ala, x)
p.draw()
time.sleep(0.1)
def lpc(x):
x2=empty(real(ap))
for t in range(maxt):
x2=lpc1(x)
x=x2
joonista(x2)
def lpc1(x):
x2=empty(real(ap))
x2[alg]=x[alg+1]
x2[ap-1]=x[alg]
for k in range(alg+1,ap-1):
x2[k]=x[k+1]
return x2
the animation still works, but the plot does not clear itself at all,
meaning that all the lines it draws stay there until the end. I'm using
matplotlib version 0.87.1 which comes with ubuntu. The full code is
added in the end.
So is this expected behavior and I should make the code in a different
way or what? I could try to upgrade to newer version of matplotlib if
that could be useful.
Regards,
Andres
The full program code:
#!/usr/bin/env python
import pylab as p
from numpy import *
import time
def joonista(x):
line, = p.plot(ala, x)
p.draw()
time.sleep(0.1)
def gaussikover():
for i in ala:
x[i]=math.exp(-(i-ap2)**2./a)
return x
def lpc(x):
x2=empty(real(ap))
for t in range(maxt):
## x2[alg]=x[alg+1]
## x2[ap-1]=x[alg]
## for k in range(alg+1,ap-1):
## x2[k]=x[k+1]
x2=lpc1(x)
x=x2
joonista(x2)
def lpc1(x):
x2=empty(real(ap))
x2[alg]=x[alg+1]
x2[ap-1]=x[alg]
for k in range(alg+1,ap-1):
x2[k]=x[k+1]
return x2
p.ion()
alg=0
ap=100
ap2=ap/2
x=empty(real(ap))
a=70.
maxt=20
ala=range(ap)
x=gaussikover()
lpc(x)
|
|
From: Ping Y. <pin...@gm...> - 2007-09-05 08:42:42
|
Hi Lionel,
Thanks for the tips. The histogram plot I need can be done by hist(x). :)
I tried your commands and I like the find() function! However,
xi = x[ind]
failed with an "IndexError: invalid index". The same operation can be done with
xi = array([x[i] for i in ind])
but if a numpy function can do that it may be faster for large arrays.
cheers,
Ping
2007/9/5, Lionel Roubeyrie <lro...@li...>:
> Hi Ping,
> don't know if it could help you :
>
> from pylab import *
>
> > d = Table("xyt.dat")
> x,y,t = load("xyt.dat", unpack=true)
>
> > d.plot("x", "t") # make a plot of x vs. t, N points are drawn
> plot(t, x)
>
> > d.plot("x") # make a histogram plot of x, N entries in the histogram
> bar(range(len(x)), x)
>
> > d.plot("x", "y < 3") # make a histogram plot of x where y is less than 3.
> ind = find(y < 3)
> xi = x[ind]
> bar(range(len(xi)), xi)
>
> Cheers
>
>
> -------------------------------------------------------------------------
> 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: Ping Y. <pin...@gm...> - 2007-09-05 08:33:23
|
2007/9/5, Eric Firing <ef...@ha...>: > Ping Yeh wrote: > [snip] > > > > 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 > Hi Eric, Thanks for the info. I searched for the numpy record array and it is indeed very close to what I want for the data storage! Thanks! Just one quick question, though (I admit I don't have much experience with numpy...). Can a record array store string data? I'll have some of these in the attribute data, not used for plotting but needed for other purposes. Thanks, Ping |
|
From: Lionel R. <lro...@li...> - 2007-09-05 07:50:23
|
Hi Ping,
don't know if it could help you :
from pylab import *
> d = Table("xyt.dat")
x,y,t = load("xyt.dat", unpack=true)
> d.plot("x", "t") # make a plot of x vs. t, N points are drawn
plot(t, x)
> d.plot("x") # make a histogram plot of x, N entries in the histogram
bar(range(len(x)), x)
> d.plot("x", "y < 3") # make a histogram plot of x where y is less than 3.
ind = find(y < 3)
xi = x[ind]
bar(range(len(xi)), xi)
Cheers
|
|
From: Eric F. <ef...@ha...> - 2007-09-05 07:46:36
|
C M wrote: [...] > 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) I don't understand--where did "self" come from? If we assume that self.subplot is in fact an axes instance, then you can use self.subplot.plot_date(...), where the arguments would be the same as if you were using pylab.plot_date(...). All this might be clarified if you look at the code for pylab.plot and pylab.plot_date. I may be missing something; I was not paying attention to earlier parts of this thread, I haven't done much with dates and have never used plot_date myself, and I have no experience with embedding. Maybe it would also help for you to look at dates.py (one of the mpl modules)? Eric > > 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: 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 |