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

Showing results of 509

<< < 1 .. 4 5 6 7 8 .. 21 > >> (Page 6 of 21)
From: plankton <and...@dl...> - 2009年07月23日 10:22:04
plankton wrote:
> 
> Greetings all,
> 
> I rotate a vector field and than I tried to interpolate it to a new grid
> using griddata. 
> 
> CODE:
> 
> x_grid_unique = unique(x_grid)
> y_grid_unique = unique(y_grid)
> x_meshgrid, y_meshgrid = meshgrid(x_grid_unique, y_grid_unique)
> x_rot_meshgrid = reshape(x_rot, [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> y_rot_meshgrid = reshape(y_rot, [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> u_rot_meshgrid = reshape(u_rot, [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> v_rot_meshgrid = reshape(v_rot, [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> u_interpolate = griddata(x_rot, y_rot, u_rot, x_rot_meshgrid, 
> y_rot_meshgrid)
> v_interpolate = griddata(x_rot, y_rot, v_rot, x_rot_meshgrid, 
> y_rot_meshgrid)
> 
> 
> 
> I unfortunately griddata returns some nan (It seems that there are
> multiple occurrences of the same [X,Y] pair in the data). In matlab you
> can use griddata with additional options e.g. ru =
> griddata(nx,ny,nu,rx,ry,'linear', {'QJ'}) to fix this, but this seems to
> be not possible using the griddata function in matplotlib. Is there any
> other way to avoid a return of nan?
> 
> For any help many thanks in advance
> 
> Andreas
> 
> 
> 
> 
Problem solved more or less. Griddata produces only at the boundary of the
vector field nan, which seems to be the result of my data matrixes u and v.
They contain serveral colums and rows with zeros at the boundary, which
leads to nan at the boundary. Finaly this is not a great problem and can be
fixed easily by adding zeros at the boundary after using griddata. 
But maybe this can be fixed otherwise e.g. using griddata with parameters,
so that it is not necessary to fix the matrix by rewriting the boundary.
Therefore, following a sample script, which demonstrates the problem. 
SAMPLE SCRIPT
--CODE--
from pylab import *
def rotate(x, y, angle):
 x_rot = x * cos(angle) - y * sin(angle)
 y_rot = x * sin(angle) + y * cos(angle)
 return x_rot, y_rot 
 
def generate_new_grid(x_rot, y_rot, x_elements, y_elements):
 xmin = min(x_rot)
 xmax = max(x_rot) 
 ymin = min(y_rot)
 ymax = max(y_rot) 
 x = linspace(xmin, xmax, x_elements)
 y = linspace(ymin, ymax, y_elements)
 x_tecplot_vector = zeros(25, float)
 y_tecplot_vector = zeros(25, float)
 for i in range(5):
 first = i *5
 last = (i+1) * 5
 x_tecplot_vector[first:last] = x
 y_tecplot_vector[first:last] = y[i]
 return x_tecplot_vector, y_tecplot_vector 
# ###################################
u = zeros(25, float)
u[12] = 1
v = zeros(25, float)
v[11] = 2
x = zeros(5, float)
y = zeros(5, float)
x = linspace(1, 5, 5)
y = linspace(1, 5, 5)
x_grid, y_grid= generate_new_grid(x, y, 5, 5)
print y_grid
# ###################################
angle = 0.1
x_rot, y_rot = rotate(x_grid, y_grid, angle)
x_elements = 5 
y_elements = 5
x_grid, y_grid= generate_new_grid(x_rot, y_rot, x_elements, y_elements)
u_rot, v_rot = rotate(u, v, angle)
x_meshgrid, y_meshgrid = meshgrid(x_grid, y_grid)
x_rot_meshgrid = reshape(x_grid, [ 5, 5] )
y_rot_meshgrid = reshape(y_grid, [ 5, 5] )
u_rot_meshgrid = reshape(u_rot, [ 5, 5] )
u_interpolate = griddata(x_rot, y_rot, u_rot, x_rot_meshgrid, 
y_rot_meshgrid)
#save('test.dat', u_interpolate)
print u_interpolate
--CODE--
-- 
View this message in context: http://www.nabble.com/griddata-returns-nan-tp24537481p24623042.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: davide l. <las...@gm...> - 2009年07月23日 06:46:58
Yes,
That did it. The partition had to be mounted with option
execin /etc/fstab!!
Thanks.
Cheers
Davide
Ah, thanks!
On Thu, Jul 23, 2009 at 12:18 PM, John Hunter<jd...@gm...> wrote:
> bar width or 1.0 corresponds to 1 day. The default width to the bar
> command is 0.8, which is too thin for months, just right for days, and
> too wide for hours. Eg, for hours do
>
> bar(x, y, width=0.8*1/24.) # width is 0.8 hours
>
> for months, do something like
>
> bar(x, y, width=0.8*30/24.) # width approx 80% of a month
It would be nice for the documentation to say something like "width:
	the widths of the bars as a proportion of the width of 1 day" instead
of "width: 	the widths of the bars"
Nick
From: per f. <per...@gm...> - 2009年07月23日 03:01:14
hi all,
i'm trying to find the function for the pdf of a multivariate normal pdf. i
know that multivariate_normal can be used to sample from the multivariate
normal distribution, but i just want to get the pdf for a given vector of
means and a covariance matrix. is there a function to do this?
thank you.
On Tue, Jul 21, 2009 at 8:00 PM, Nick Seow<nic...@gm...> wrote:
> Hi,
>
> I'm worried that I'm doing something stupid, but can't quite spot it.
>
> testBarCharts() :- X axis in integers. Works fine.
> testBarChartsDTMonths() :- X axis in datetimes, 1 month between data
> points. Works fine
> testBarChartsDTHours() :- X axis in datetimes, 1 hour between data
under the hood, mpl converts datetime objects to days since 1/1/0000,
using a floating point representation for fractions of a day. So a
bar width or 1.0 corresponds to 1 day. The default width to the bar
command is 0.8, which is too thin for months, just right for days, and
too wide for hours. Eg, for hours do
 bar(x, y, width=0.8*1/24.) # width is 0.8 hours
for months, do something like
 bar(x, y, width=0.8*30/24.) # width approx 80% of a month
Perhaps bar should take a width=None arg and try to infer the ideal
with, eg assuming even spacing, but for now you need to specify the
width in fractional days when making bar plots with datetimes.
JDH
From: John H. <jd...@gm...> - 2009年07月23日 02:12:55
On Tue, Jul 21, 2009 at 3:32 PM, Barnette, Daniel W<dw...@sa...> wrote:
> I've written a python gui to matplotlib which allows the user to plot either cartesian, semi-log, or log-log plots. Log plots can be generated for typical base values except for base 2. Is this a bug, or is there some reason that matplotlib does not do log plots using base 2?
Can you post an example which shows your problem? The following works for me:
 In [14]: x, y = np.random.rand(2, 100)
 In [15]: loglog(x, y, basex=2)
 Out[15]: [<matplotlib.lines.Line2D object at 0x11a1a2d0>]
JDH
From: John H. <jd...@gm...> - 2009年07月23日 01:59:40
On Wed, Jul 22, 2009 at 8:50 PM, Ryan May<rm...@gm...> wrote:
> I'm willing to. However, I just noticed that with just the pylab_import_all
> 0, you get the import numpy as np and import matplotlib.pyplot as plt
> automatically. Also, nicely, these don't show up when you type 'whos'. This
> is with ipython 0.9.1. Should I just add the pylab_import_all 0 to the FAQ?
Should be enough, but it would be nice to have a little bit on how to
write a profile to add extra imports (eg scipy as sp) to an ipython
profile and load it in the same FAQ. Yes, they could find it reading
the ipython docs, but the easier it is to get the info the more useful
it will be.
From: Ryan M. <rm...@gm...> - 2009年07月23日 01:51:03
On Wed, Jul 22, 2009 at 8:34 PM, John Hunter <jd...@gm...> wrote:
> On Wed, Jul 22, 2009 at 8:04 PM, Ryan May<rm...@gm...> wrote:
> > On Wed, Jul 22, 2009 at 6:09 PM, Christopher Barker <
> Chr...@no...>
> > wrote:
> >>
> >> Hi folks,
> >>
> >> Does anyone know if there is a way to use ipython with the advantages of
> >> the -pylab option (separate gui thread, etc.), but without the whole
> >> pylab namespace getting sucked in?
> >
> > Put this in your ~/.ipython/ipythonrc:
> >
> > pylab_import_all 0
> >
> > That gives you exactly what you want. In my case, I also made a profile
> > that imports numpy as np and matplotlib.pyplot as plt, so that I can get
> the
> > equivalent of the ease pylab without the pollution.
>
> Hey Ryan -- could you write up a sphinx/rest FAQ that describes all
> these steps in detail, eg how you create the profile and how you start
> ipython, so we can add it to the site docs? If you are uncomfortable
> with the docs, I can apply the patch.
I'm willing to. However, I just noticed that with just the pylab_import_all
0, you get the import numpy as np and import matplotlib.pyplot as plt
automatically. Also, nicely, these don't show up when you type 'whos'. This
is with ipython 0.9.1. Should I just add the pylab_import_all 0 to the FAQ?
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
From: Eric F. <ef...@ha...> - 2009年07月23日 01:42:27
Johan Carlin wrote:
> Hi all,
> 
> I have just migrated from Matlab to Scipy. Matplotlib has been great so 
> far. However, I have some trouble getting imshow to behave like Matlab's 
> image function.
> 
> If you do image(eye(8)) in matlab, you get this:
> 
> http://www.flickr.com/photos/phineasgage/3746211714/
> 
> If you do imshow(eye(8)) in matplotlib, you get this:
> 
> http://www.flickr.com/photos/phineasgage/3745417651/
> 
> How do I get matplotlib to stop interpolating or blurring the borders in 
> the image? I have tried setting interpolation=None (the default 
> behaviour), but this has no effect.
interpolation='nearest'
Eric
> 
> I use matplotlib-0.98.5.2n2 as part of the Enthought distro on Red Hat 4 
> Linux. Any help would be greatly appreciated.
> 
> Johan
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: John H. <jd...@gm...> - 2009年07月23日 01:40:15
On Wed, Jul 22, 2009 at 8:04 PM, Ryan May<rm...@gm...> wrote:
> On Wed, Jul 22, 2009 at 6:09 PM, Christopher Barker <Chr...@no...>
> wrote:
>>
>> Hi folks,
>>
>> Does anyone know if there is a way to use ipython with the advantages of
>> the -pylab option (separate gui thread, etc.), but without the whole
>> pylab namespace getting sucked in?
>
> Put this in your ~/.ipython/ipythonrc:
>
> pylab_import_all 0
>
> That gives you exactly what you want. In my case, I also made a profile
> that imports numpy as np and matplotlib.pyplot as plt, so that I can get the
> equivalent of the ease pylab without the pollution.
Hey Ryan -- could you write up a sphinx/rest FAQ that describes all
these steps in detail, eg how you create the profile and how you start
ipython, so we can add it to the site docs? If you are uncomfortable
with the docs, I can apply the patch.
Thanks
JDH
From: Ryan M. <rm...@gm...> - 2009年07月23日 01:05:20
On Wed, Jul 22, 2009 at 6:09 PM, Christopher Barker
<Chr...@no...>wrote:
> Hi folks,
>
> Does anyone know if there is a way to use ipython with the advantages of
> the -pylab option (separate gui thread, etc.), but without the whole
> pylab namespace getting sucked in?
Put this in your ~/.ipython/ipythonrc:
pylab_import_all 0
That gives you exactly what you want. In my case, I also made a profile
that imports numpy as np and matplotlib.pyplot as plt, so that I can get the
equivalent of the ease pylab without the pollution.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
From: dpo <dom...@gm...> - 2009年07月23日 00:38:35
Hello,
I am running Matplotlib 0.98.6svn compiled from source on OSX and Sphinx
0.6.2. I am trying the following example to test plot_directive
.. plot::
 from numpy import linspace, sin
 import matplotlib.pylab as plt
 x = linspace(0.01,25, 10000)
 plt.plot(x, sin(x)/x)
 plt.show()
When I 'make html', I get the warning messages:
/Users/dpo/local/dev/pyorder/doc/source/pymc60.rst:: WARNING: image file not
readable: build/plot_directive/inline/2d6f2be741.png
/Users/dpo/local/dev/pyorder/doc/source/pymc60.rst:: WARNING: image file not
readable: build/plot_directive/inline/2d6f2be741.pdf
and the plot is not embedded in my html page. The links 'hires.png' and
'pdf' do point to (readable) images, though. From build/html:
$ ls -l plot_directive/inline/
total 104
-rw-r--r-- 1 dpo dpo 41347 22 Jul 20:01 2d6f2be741.hires.png
-rw-r--r-- 1 dpo dpo 7370 22 Jul 20:01 2d6f2be741.pdf
Strangely, there is no 'png' link even though my conf.py specifies
plot_formats = ['png', 'hires.png', 'pdf']
If I look at the generated html, I notice that the "img" tag wants the png,
which doesn't exist. That is one problem.
The other problem is that the "img" tag searches for the png file in
build/plot_directive/inline/, which does not exist either.
The same happens in the LaTeX output. When I 'make latex' followed by 'make
all-pdf' from build/latex, I get the error message:
LaTeX Warning: File `build/plot_directive/inline/2d6f2be741.pdf' not found
on input line 499.
!pdfTeX error: pdflatex (file build/plot_directive/inline/2d6f2be741.pdf):
cannot find image file
 ==> Fatal error occurred, no output PDF file produced!
Indeed, the image files are in plot_directive/inline/ and not in
build/plot_directive/inline/. Changing the path in the .tex solves the
problem.
Thanks in advance,
Dominique
-- 
View this message in context: http://www.nabble.com/Help-with-plot_directive-tp24617359p24617359.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
Hi,
basically I'm looking for something like 'waitfor' or 'uiwait' from the Matlab.
I want to achieve is the following behavior:
- show a figure with several subplot/images to the user
- let the user click on some stuff to get coordinates, handles, ...
- wait until the user has closed the window
- based on the returned data, show a new figure and let the user select some more stuff
- repeat
What is the best way to do something similar in matplotlib?
I tried to use pylab.show() several times in the same script but then soon found out that this is not recommend / does not work.
Right now a combination of ion() and waitforbuttonpress seems to be the only way to achieve something similar to what i want to do, but i was wondering if there are other ways.
Any ideas?
Thanks,
Jan
From: Robert K. <rob...@gm...> - 2009年07月22日 23:38:33
On 2009年07月22日 18:09, Christopher Barker wrote:
> Hi folks,
>
> Does anyone know if there is a way to use ipython with the advantages of
> the -pylab option (separate gui thread, etc.), but without the whole
> pylab namespace getting sucked in?
>
> I love ipython pylab mode, but like to use namespaces to keep things clean.
ipython -wthread
-- 
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
 -- Umberto Eco
From: Christopher B. <Chr...@no...> - 2009年07月22日 23:09:26
Hi folks,
Does anyone know if there is a way to use ipython with the advantages of 
the -pylab option (separate gui thread, etc.), but without the whole 
pylab namespace getting sucked in?
I love ipython pylab mode, but like to use namespaces to keep things clean.
thanks,
-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: Barnette, D. W <dw...@sa...> - 2009年07月22日 22:23:44
I've written a python gui to matplotlib which allows the user to plot either cartesian, semi-log, or log-log plots. Log plots can be generated for typical base values except for base 2. Is this a bug, or is there some reason that matplotlib does not do log plots using base 2?
Using base 2, the log-log plot error is:
------ begin snippet -----
Exception in Tkinter callback
Traceback (most recent call last):
 File "C:\python251_102507\lib\lib-tk\Tkinter.py", line 1403, in __call__
 return self.func(*args)
 File "C:\python251_102507\lib\site-packages\matplotlib\backends\backend_tkagg.
py", line 211, in resize
 self.show()
 File "C:\python251_102507\lib\site-packages\matplotlib\backends\backend_tkagg.
py", line 214, in draw
 FigureCanvasAgg.draw(self)
 File "C:\python251_102507\lib\site-packages\matplotlib\backends\backend_agg.py
", line 261, in draw
 self.figure.draw(self.renderer)
 File "C:\python251_102507\lib\site-packages\matplotlib\figure.py", line 759, i
n draw
 for a in self.axes: a.draw(renderer)
 File "C:\python251_102507\lib\site-packages\matplotlib\axes.py", line 1523, in
 draw
 a.draw(renderer)
 File "C:\python251_102507\lib\site-packages\matplotlib\axis.py", line 712, in
draw
 for tick, loc, label in self.iter_ticks():
 File "C:\python251_102507\lib\site-packages\matplotlib\axis.py", line 659, in
iter_ticks
 minorLocs = self.minor.locator()
 File "C:\python251_102507\lib\site-packages\matplotlib\ticker.py", line 1026,
in __call__
 if len(subs) > 1 or subs[0] != 1.0:
IndexError: index out of bounds
----- end snippet -----
From: Jeff W. <js...@fa...> - 2009年07月22日 21:58:04
plankton wrote:
> Greetings all,
>
> I rotate a vector field and than I tried to interpolate it to a new grid
> using griddata. 
>
> CODE:
>
> x_grid_unique = unique(x_grid)
> y_grid_unique = unique(y_grid)
> x_meshgrid, y_meshgrid = meshgrid(x_grid_unique, y_grid_unique)
> x_rot_meshgrid = reshape(x_rot, [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> y_rot_meshgrid = reshape(y_rot, [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> u_rot_meshgrid = reshape(u_rot, [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> v_rot_meshgrid = reshape(v_rot, [ len(x_meshgrid[:, 0]),
> len(x_meshgrid[0, :])] )
> u_interpolate = griddata(x_rot, y_rot, u_rot, x_rot_meshgrid, 
> y_rot_meshgrid)
> v_interpolate = griddata(x_rot, y_rot, v_rot, x_rot_meshgrid, 
> y_rot_meshgrid)
>
>
>
> I unfortunately griddata returns some nan (It seems that there are multiple
> occurrences of the same [X,Y] pair in the data). In matlab you can use
> griddata with additional options e.g. ru =
> griddata(nx,ny,nu,rx,ry,'linear', {'QJ'}) to fix this, but this seems to be
> not possible using the griddata function in matplotlib. Is there any other
> way to avoid a return of nan?
>
> For any help many thanks in advance
>
> Andreas
>
>
>
> 
Andreas: Can you provide a standalone script that I can run which 
demonstrates the problem? Otherwise, it's hard to know what's going on.
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Michael L. <mgl...@gm...> - 2009年07月22日 20:43:49
Hi,
I'm used to the following definition of autocorrelation:
R(\tau) = \frac{<(X_t - \mu)(X_{t+\tau}-\mu)>}{\sigma^2}
However, it looks like acorr is just giving me
R(\tau) = \sum{X_t*X_{t+\tau}}
Just specifying normed=True doesn't get the first formula. Is there some
trivial option that I've missed?
Here's what I did:
It's easy enough to subtract \mu from my timeseries, but when I ask acorr to
normalize things for me, I get the whole timeseries normalized by the value
of R(0):
 if normed: c/= np.dot(x,x)
I really do want the formula I gave, which requires each point of the
autocorrelation to be averaged separately. So, I modified my local version
of acorr to say
 if normed:
 nrm = arange(len(x))
 nrm = hstack((nrm,nrm[:-1][::-1]))*std(x)**2
 c /= nrm
Thanks,
-michael
-- 
Michael Lerner, Ph.D.
IRTA Postdoctoral Fellow
Laboratory of Computational Biology NIH/NHLBI
5635 Fishers Lane, Room T909, MSC 9314
Rockville, MD 20852 (UPS/FedEx/Reality)
Bethesda MD 20892-9314 (USPS)
From: Christopher B. <Chr...@no...> - 2009年07月22日 18:57:52
Hi all,
I'm passing in "None" for the timezone in AutoDateFormatter.
What I am getting is "UTC", but what I want is nothing.
Looking at the code, I see lines like:
 self._formatter = DateFormatter("%H:%M:%S %Z", self._tz)
so my None is getting passed through. Then in DateFormatter, I see:
 if tz is None: tz = _get_rc_timezone()
Which looks like it's getting a timezone from an rc parameter. This
strikes me as "not such a good idea". Far too easy to get the timezone
wrong -- I'm not sure there should be such a thing as a default time zone.
However, the issue at hand is that I want to not show the timezone at
all. I would have thought that None would be a good way to spell that,
but it's taken already to mean "default".
So that means editing/overriding AutoDateFormatter. The way it's
written, I pretty much have to re-write the entire thing, which isn't so
bad, but it might be nicer if we could make it easier to override just
part of it.
One idea:
Some say that the "right" way to spell "case/switch" in Python is a 
dict, rather than a collection of if--elifs. So in this case, we could 
make a dict of format strings, something like below.
I've tried this, and I can now easily override the formatting for a 
particular time range, like so:
 Formatter = mpl.dates.AutoDateFormatter(locator, tz=None)
 # edit the format strings to remove the TZ spec
 # this only works with my custom version of AutoDateLocator
 Formatter.format_strings[1.0/24.0] = "%H:%M:%S"
I do agree with the comments that there are other ways to improve this,
but maybe this is a start.
-Chris
class AutoDateFormatter(ticker.Formatter):
 """
 This class attempts to figure out the best format to use. This is
 most useful when used with the :class:`AutoDateLocator`.
 """
 # This can be improved by providing some user-level direction on
 # how to choose the best format (precedence, etc...)
 # Perhaps a 'struct' that has a field for each time-type where a
 # zero would indicate "don't show" and a number would indicate
 # "show" with some sort of priority. Same priorities could mean
 # show all with the same priority.
 # Or more simply, perhaps just a format string for each
 # possibility...
 def __init__(self, locator, tz=None):
 self._locator = locator
 self._formatter = DateFormatter("%b %d %Y %H:%M:%S %Z", tz)
 self._tz = tz
 self.format_strings = { 365.0 : "%Y",
 30.0 : "%b %Y",
 1.0 : "%b %d %Y",
 7.0 : "%b %d %Y",
 1.0/24.0 : "%H:%M:%S %Z",
 1.0/(24*60) : "%H:%M:%S %Z",
 1.0/(24*3600) : "%H:%M:%S %Z",
 }
 self.fallback_format = "%b %d %Y %H:%M:%S %Z"
 def __call__(self, x, pos=0):
 scale = float( self._locator._get_unit() )
 f_string = self.format_strings.get(scale, self.fallback_format)
 self._formatter = DateFormatter(f_string, self._tz)
 return self._formatter(x, pos)
-- 
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...
-- 
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...
Never mind I found a mirror at 
http://www.lfd.uci.edu/~gohlke/download/matplotlib-0.98.5.3.win32-py2.6.zip
-mike w.
Mike Waters wrote:
> Is anyone else having this problem? Is there another website that I can 
> try?
>
> -mike w.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> 
From: davide l. <las...@gm...> - 2009年07月22日 17:30:03
Well,
actually i'm using Ubuntu at work on a virtual machine, and the svn copy is
in a partition mounted at boot by a line in /etc/fstab.
If i remember correctly this filesystem is mounted with options users. I'm
at home now, i'll try with the exec option tomorrow.
Is anyone else having this problem? Is there another website that I can 
try?
-mike w.
From: Michael D. <md...@st...> - 2009年07月22日 17:20:00
You can use the "Agg" or "PDF" backends to run matplotlib without 
display support:
import matplotlib
matplotlib.use("PDF")
Cheers,
Mike
John Kerenyi wrote:
> Thank you for your response. Your response made me wonder how the script would operate in a non-graphic environment--I had tested it on a login node but not on a computing node. It appears that even though I have no need for any graphic display, the modules I am loading expect to have it nonetheless. I invoke matplotlib using the standard "import matplotlib.pyplot as plt" line. Here is the output when run on a compute node:
>
> -------------------------
>
> [ac.jkerenyi@n123 pygraph]$ ./run_pygraph.py png
> Creating Top 100 V/C ratios graph...
> Traceback (most recent call last):
> File "./run_pygraph.py", line 566, in <module>
> GraphTop100VC (Top100VCFilename)
> File "./run_pygraph.py", line 326, in GraphTop100VC
> fig=plt.figure()
> File "/soft/python/lib/python2.6/site-packages/matplotlib/pyplot.py", line 251, in figure
> **kwargs)
> File "/soft/python/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 90, in new_figure_manager
> window = Tk.Tk()
> File "/soft/python/lib/python2.6/lib-tk/Tkinter.py", line 1643, in __init__
> self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
> _tkinter.TclError: no display name and no $DISPLAY environment variable
>
> ---------------------
>
> Can anyone advise if there another way to invoke matplotlib that does not require graphic support?
>
> With respect to your suggestion that I run python setup.py build, I don't seem to have the necessary permissions but the sysadmin is very helpful and once I have a little more information on the new problem I'll get his help again.
>
> Thanks again,
>
> John Kerenyi
>
> -----Original Message-----
> From: Jouni K. Seppänen [mailto:jk...@ik...] 
> Sent: Wednesday, July 22, 2009 9:38 AM
> To: mat...@li...
> Subject: Re: [Matplotlib-users] PDF backend errors out; PNG works fine
>
> "John Kerenyi" <jo...@mo...> writes:
>
> 
>> File
>> "/soft/python/lib/python2.6/site-packages/matplotlib/backends/backend_
>> pd
>> f.py", line 44, in <module>
>> from matplotlib import ttconv
>> ImportError:
>> /soft/python/lib/python2.6/site-packages/matplotlib/ttconv.so: 
>> undefined
>> symbol: _ZTVSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE
>> 
>
> Sounds like a mismatch between C++ libraries on the system where matplotlib was built and where it is being used. You mentioned a cluster; perhaps your sysadmin compiled matplotlib on a special node that has more libraries installed than the computation nodes. I don't know how to fix this, but as a first step you could try compiling matplotlib on a computation node (submit something like "python setup.py build" as a job the same way you would submit another task on the
> cluster) and seeing if that gives more clues about what is missing.
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: John K. <jo...@mo...> - 2009年07月22日 17:12:27
Thank you for your response. Your response made me wonder how the script would operate in a non-graphic environment--I had tested it on a login node but not on a computing node. It appears that even though I have no need for any graphic display, the modules I am loading expect to have it nonetheless. I invoke matplotlib using the standard "import matplotlib.pyplot as plt" line. Here is the output when run on a compute node:
-------------------------
[ac.jkerenyi@n123 pygraph]$ ./run_pygraph.py png
Creating Top 100 V/C ratios graph...
Traceback (most recent call last):
 File "./run_pygraph.py", line 566, in <module>
 GraphTop100VC (Top100VCFilename)
 File "./run_pygraph.py", line 326, in GraphTop100VC
 fig=plt.figure()
 File "/soft/python/lib/python2.6/site-packages/matplotlib/pyplot.py", line 251, in figure
 **kwargs)
 File "/soft/python/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 90, in new_figure_manager
 window = Tk.Tk()
 File "/soft/python/lib/python2.6/lib-tk/Tkinter.py", line 1643, in __init__
 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
---------------------
Can anyone advise if there another way to invoke matplotlib that does not require graphic support?
With respect to your suggestion that I run python setup.py build, I don't seem to have the necessary permissions but the sysadmin is very helpful and once I have a little more information on the new problem I'll get his help again.
Thanks again,
John Kerenyi
-----Original Message-----
From: Jouni K. Seppänen [mailto:jk...@ik...] 
Sent: Wednesday, July 22, 2009 9:38 AM
To: mat...@li...
Subject: Re: [Matplotlib-users] PDF backend errors out; PNG works fine
"John Kerenyi" <jo...@mo...> writes:
> File
> "/soft/python/lib/python2.6/site-packages/matplotlib/backends/backend_
> pd
> f.py", line 44, in <module>
> from matplotlib import ttconv
> ImportError:
> /soft/python/lib/python2.6/site-packages/matplotlib/ttconv.so: 
> undefined
> symbol: _ZTVSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE
Sounds like a mismatch between C++ libraries on the system where matplotlib was built and where it is being used. You mentioned a cluster; perhaps your sysadmin compiled matplotlib on a special node that has more libraries installed than the computation nodes. I don't know how to fix this, but as a first step you could try compiling matplotlib on a computation node (submit something like "python setup.py build" as a job the same way you would submit another task on the
cluster) and seeing if that gives more clues about what is missing.
--
Jouni K. Seppänen
http://www.iki.fi/jks
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Gökhan S. <gok...@gm...> - 2009年07月22日 16:58:47
On Wed, Jul 22, 2009 at 11:47 AM, Jouni K. Seppänen <jk...@ik...> wrote:
> davide lasagna <las...@gm...> writes:
>
> > ImportError:
> > /home/davide/partizione/matplotlib/lib/matplotlib/_path.so: failed to
> > map segment from shared object: Operation not permitted
> >
> > Could it be that i've installed in the wrong directory? If yes how can
> > i cope with this?
>
> Apparently this could be caused by SELinux (good luck with configuring
> that correctly), or perhaps your /home filesystem is mounted with the
> noexec option to prevent users from running their own code. Ask your
> system administrator how to install libraries so that Python can call
> dlopen on them.
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
I also have been bitten by SELinux a couple times. On my personal Fedora 11
laptop, and previously on FC10 my resolution was to completely disable
SELinux to eliminate installation and running issues.
Fortunately, I have not dealt with administrative restrictions on our
machines that sit in the lab. Once I heard of a complain in this regard
sys-admin will be the first to know after me :)
-- 
Gökhan
9 messages has been excluded from this view by a project administrator.

Showing results of 509

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