SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S
1
(2)
2
(13)
3
(13)
4
(11)
5
(15)
6
(16)
7
(1)
8
(2)
9
(1)
10
(16)
11
(19)
12
(8)
13
(20)
14
(9)
15
(2)
16
(9)
17
(29)
18
(14)
19
(13)
20
(10)
21
(1)
22
(3)
23
(4)
24
(26)
25
(11)
26
(11)
27
(8)
28
(4)
29
(2)
30
(10)
31
(17)




Showing results of 315

1 2 3 .. 13 > >> (Page 1 of 13)
From: Stephen W. <ste...@cs...> - 2005年05月31日 23:55:42
Ken McIvor wrote:
> http://agni.phys.iit.edu/~kmcivor/potpourri/wxmpl-demos.py
An interesting looking script. But 'import wxmpl' fails on my system 
(MPL V0.80). Am I missing something?
As an aside, it would be nice if a demo/tutorial script like this could 
be made backend-independent. I normally use TkAgg in preference to WX 
or WXAgg.
From: Chris B. <Chr...@no...> - 2005年05月31日 19:37:54
Ken McIvor wrote:
> Following Chris Barker's instructions in the matplotlib-0.72 OSX 
> installer package, I have created a package for matplotlib 0.80.
great! thanks for picking up the mantle on this. I'd been meaning to get 
to it, but you know how it is.
Does this version work with TK? I can't remember what I put in the notes 
with the one I sent out.
> http://agni.phys.iit.edu/~kmcivor/potpourri/matplotlib-0.80-py2.3- 
> macosx10.3.zip
> 
> It looks like all of the basic tests work just fine, but I would 
> appreciate feedback from any adventurous 10.3 users. Information on 
> getting packages included on pythonmac.org would also be helpful.
Just send a note to Bob Ippolito. Also, try to name and package it to 
match the rest of the stuff on that site.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
 		
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: John H. <jdh...@ac...> - 2005年05月31日 18:18:51
>>>>> "Jeff" == Jeff Peery <jef...@se...> writes:
 Jeff> also is there a way to get the spacing of major ticks with
 Jeff> minor ticks? I would like to set my tick labels based on
 Jeff> what data point is being plotted.
Have you seen Chapter 5 of the users guide "Tick Locators and
Formatters", and the examples
 examples/major_minor_demo1.py 
 examples/major_minor_demo2.py
 examples/custom_ticker1.py 
You can extend the tick locating and formatting classes to do what you
want.
See also http://matplotlib.sf.net/matplotlib.ticker.html
Let me know if you have any more questions....
JDH
From: dimitri p. <dim...@gm...> - 2005年05月31日 18:09:35
Yes, this could could very well be a matplotlib issue. I will try to do som=
e=20
tests, thanks for cc'ing it to the matplotlib list.
Dimitri
On 5/31/05, John Gill <jn...@eu...> wrote:
>=20
> I think this might be a matplotlib issue.
>=20
> I've been having some refresh issues with matplotlib since switching to=
=20
> 2.6. In particular I've noticed that if I put my mouse over the toolbar=
=20
> and let a tooltip pop up the canvas does not get repainted.
>=20
> Up to now I'd been assuming this problem was isolated to me (I use=20
> ratpoison as a window manager, which can confuse some apps).
>=20
> I've cc'ed the matplotlib list in case anyone can throw some light on=20
> this.
>=20
> John
>=20
> dimitri pater wrote:=20
>=20
> Hello,
> I upgraded to PyGTK 2.6 from 2.4 . Now, when I switch from page 2 on a=20
> Gtk.Notebook back to page 1, page 1 still shows some elements from page 2=
=20
> (it is not refreshed, just some parts). Both pages contain graphs created=
=20
> with Matplotlib. I never had problems like this with 2.4...
> Any clues somebody? If necessary, I will attach the source files.
>=20
> Best regards,
> Dimitri
>=20
> ------------------------------
>=20
> _______________________________________________
> pygtk mailing list py...@da...
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> =20
> =20
--=20
Please visit dimitri's website: www.serpia.com <http://www.serpia.com>
From: Fernando P. <Fer...@co...> - 2005年05月31日 17:23:30
phi...@ho... wrote:
> Hi list,
> 
> I want to realize an applciation similar to matplotlib in interactive mode.
> From the python shell, we can load a file of data, extract some data, 
> plot them.
> A figure is then added to the window. The window can stay opened.
> After having plotted them, we are able to load another file from the 
> python shell, load a file of data, extract some data, plot them.
> The new figure will be add in the window.
> 
> For the moment, i did the window, but i'm having some problems due to 
> the gtk.main() thread.
> I can't do anything except concerning signals in the window.
> I'm not able to right something in the python shell as soon as the 
> window is displayed.
> 
> How can i get control on the python shell to write in it new command?
You may want to look at ipython, which in its -pylab mode, handles ths 
automatically for you: you get an interactive prompt with non-blocking control 
of matplotlib windows, for the Tk, WX, GTK and Qt backends (FLTK is not 
supported).
Cheers,
f
From: Jeff P. <jef...@se...> - 2005年05月31日 16:56:30
Hello, when I use 'set_ticklabels' to set the tick labels using a string
array only the major locators are labeled. I have an array of data that
I want to plot against strings. The problem is that matplotlib plots my
data but the labels are put only on the major ticks so they do not
correspond to the proper data element. Heres an example:
I want to plot the data [1,2,3,4,5,6] against the strings
['a','b','c','d','e',f'] - there is one string per data point
Matplotlib plots the major ticks only. So if the minor ticks are spaced
1 between major ticks then matplot lib would plot my data as follows:
1,'a'
2,'minor tick'
3,'b'
4,'minor tick'
5,'c'
6,'minor tick'
so the labels do not correspond to the proper data point. How can I fix
this? Thanks
also is there a way to get the spacing of major ticks with minor ticks?
I would like to set my tick labels based on what data point is being
plotted. 
Thanks!
Jeff 
From: Ken M. <mc...@ii...> - 2005年05月31日 14:58:15
Following Chris Barker's instructions in the matplotlib-0.72 OSX 
installer package, I have created a package for matplotlib 0.80. It is 
currently available at
	http://agni.phys.iit.edu/~kmcivor/potpourri/matplotlib-0.80-py2.3- 
macosx10.3.zip
It looks like all of the basic tests work just fine, but I would 
appreciate feedback from any adventurous 10.3 users. Information on 
getting packages included on pythonmac.org would also be helpful. 
Thanks!
Ken
From: John H. <jdh...@ac...> - 2005年05月31日 14:18:31
>>>>> "Alan" == Alan G Isaac <ai...@am...> writes:
 Alan> 1. This is indeed much faster. 2. It still slows to a crawl
 Alan> as t grows. Should it? 3. The only thing that slows down is
 Alan> draw(), so the problem does not lie with the updating of the
 Alan> line instances.
No, it shouldn't get significantly slower (it doesn't on my system)
but I think I know what is wrong; in matplotlib-0.72 I introduced an
optimization to make line marker drawing much faster -
http://matplotlib.sourceforge.net/whats_new.html#0.72-line_marker_optimizations_in_agg
- but quickly had to revert it for win32 because it caused a segfault
in rare conditions, only on win32. I spent some time with Maxim, the
antigrain author, but was never able to reproduce the segfault in
standalone agg code. Last Friday I spent some time tracking it down
and with the updated information, Maxim was able to find and fix the
agg bug [Editor's note: I'm *very* proud to have found a bug in agg
code -- they are very rare critters]. So the good news is the next mpl
release will have the optimization also for win32. If you would like
to give it a test drive, there is an alpha build at
 http://matplotlib.sf.net/matplotlib-0.81alpha.win32-py2.4.exe
There have been fairly significant changes at the extension code
level, so I suggest flushing your site-packages/matplotlib directory.
 Alan> P.S. Suppose I run the script and then press enter in the
 Alan> shell before closing the graph window. I get the following
 Alan> 'NULL tstate' error: Fatal Python error:
 Alan> PyEval_RestoreThread: Null tstate abnormal program
 Alan> termination Perhaps this is to be expected.
We've never been able to free ourselves of this annoyance in all the
contexts tkagg is used in (interactive, scripted, embedded,
animation). If you search the archives, you'll see numerous threads
on this one but as far as I can tell, it only happens at program
termination in interactive/animated mode and is annoying but harmless.
JDH
From: John H. <jdh...@ac...> - 2005年05月31日 13:37:55
>>>>> "Christian" == Christian Meesters <mee...@un...> writes:
 Christian> solved the problem, where add_splot_toolbar() - a
 Christian> toolbar function very much like the 2nd toolbar in the
 Christian> wx examples - is added only just after arranging the
 Christian> sizer. I was unable to arrange the toolbar with the
 Christian> sizer - regardless of the sizer and the layout I
 Christian> used. Hence the problem is definitively wx-related,
 Christian> possibly together with a problem in Panther's
 Christian> framework, since I find the old sequence of commands in
 Christian> the examples and the misbehaving canvas there as well.
 Christian> May I suggest adding a comment in the examples for OSX
 Christian> users so that they are aware of a possible conflict
 Christian> there?
Would you be willing to add the comments to one or more of the
embedding_in_wx*.py examples and send them to me?
Thanks!
JDH
From: John H. <jdh...@ac...> - 2005年05月31日 13:37:29
>>>>> "Jack" == Jack Andrews <ef...@iv...> writes:
 Jack> hi there, matplotlib is great! i want to create bar-charts,
 Jack> save to PNG and produce an HTML map to be used over the PNG.
 Jack> something like this:
 Jack> <map name="a"> <area shape="rect" coords="20,90,25,30"
 Jack> href="1.html"> <area shape="rect" coords="40,60,45,30"
 Jack> href="2.html"> </map> <img src="a.png" usemap="#a">
 Jack> so that when the user clicks on bar1 or bar2 of the chart,
 Jack> the appropriate URL is loaded.
 Jack> is there a way to get the coordinates of the bar from
 Jack> matlab, or do i have to do some optical-chart-recognition?
 Jack> (or make my own little charting package)
Andrew Dalke has recently written a nice tutorial on how to use
matplotlib to make clickable html images -
http://www.dalkescientific.com/writings/diary/archive/2005/04/24/interactive_html.html
As for your specific question about the extent of the bars, you can
get them as follows; note that in matplotlib 0,0 is the bottom, left
of the figure. You may need to correct for this if html click maps
assume 0 is the top of the image. Andrew's tutorial covers this a bit
import matplotlib
matplotlib.use('Agg')
import pylab as p
import matplotlib.numerix as nx
dpi = 80
f = p.figure(dpi=dpi)
# figure width and height in pixels
figw, figh = f.get_width_height()
x = nx.arange(5)
y = x**2
patches = p.bar(x,y)
for patch in patches:
 l,b,w,h = patch.get_window_extent().get_bounds()
 print l,b,w,h
p.savefig('somefile', dpi=dpi)
Note that matplotlib enables you to have a different dpi setting for
the "display" figure and the saved figure, so to make sure they are
the same, pass the same dpi to figure and savefig. If you need to
correct for the figure y origin at top, you can use figh which is the
height of the figure.
Hope this helps. If at all possible, please resist the urge to write
your own plotting package :-) Trust me, I know it is hard to resist.
If matplotlib can't do something you need, pester us a bit and we'll
try to add it. Else python will die from the curse of too many
plotting packages....
JDH
From: <phi...@ho...> - 2005年05月31日 13:37:01
Hi list,
I want to realize an applciation similar to matplotlib in interactive mode.
 From the python shell, we can load a file of data, extract some data, 
plot them.
A figure is then added to the window. The window can stay opened.
After having plotted them, we are able to load another file from the 
python shell, load a file of data, extract some data, plot them.
The new figure will be add in the window.
For the moment, i did the window, but i'm having some problems due to 
the gtk.main() thread.
I can't do anything except concerning signals in the window.
I'm not able to right something in the python shell as soon as the 
window is displayed.
How can i get control on the python shell to write in it new command?
Another question is:
I must be able to start the application from the python shell and by 
lauching the main.py files which contains a
if __name__ == "__main__":
There is some problem when i try to declare new element with the from 
import, as i declare my module in the __init__.py of my module as import pv.
None of the components of my module are found.
That's why i add to try if we import from the application or from the 
python shell.
#declare from the application
try:
 from internationalization import _
 from ihm.interface import interface
except:
#declare from the python shell.
 from pv.ihm.interface import interface
Is there a more elegant way to do this?
regards,
Philippe Collet
From: Darren D. <dd...@co...> - 2005年05月31日 12:20:34
On Tuesday 31 May 2005 7:15 am, Dr. Werner Pessenhofer wrote:
> Hi,
>
> I try to fit some data but do not get the result I want. The problem is,
> that I have only few data points:
>
> Data file:
>
> # Dosierung pH
> 0 9.35
> 1 8.70
> 2 8.34
> 3 8.06
> 4 7.85
> 5 7.67
>
> What I want, is to create a fitting curve with the corresponding values
> e.g. the parameters of a cubic fitting.
>
> I tried this with polyfit:
>
> #!/usr/bin/python
>
> from pylab import *
>
> X =3D load('Dosierung-pH.dat',comments=3D"#")
>
> x =3D X[:,0]
> y =3D X[:,1]
>
> xlabel(r'$Dosierung H_2P_2O_7~10~[ml]$')
> ylabel(r'$pH-Wert$')
>
> # Fitting:
> coeffs =3D polyfit(x,y,4)
> besty =3D polyval(coeffs,x)
> xnew =3D arange(0,5,0.1)
> plot (x,y,'bo',x,besty)
>
> show()
>
> Due to the view x-values, the curve is not a curve but a line with kinks.
>
> Using
>
> xnew =3D arange(0,5,0.1) and
> plot (x,y,'bo',xnew,besty)
>
> do not work, because xnew and besty have then not the same length.
>
> The second question is, how can I get the curve values a,b,c,d out ? I
> would something expect like
>
> y =3D a*x^3 + b*x^2 + c*x +d
>
> printing the values for a,b,c,d for further using.
Your variable coeffs contains this data, note that your script is doing a 4=
th=20
order fit:
y=3Dcoeffs[0]*x^4 + coeffs[1]*x^3 + coeffs[2]*x^2 + coeffs[3]*x +coeffs[4]
As for your first question, you need to pass xnew to polyval. Try this scri=
pt:
#!/usr/bin/python
from pylab import *
X =3D load('Dosierung-pH.dat',comments=3D"#")
x =3D X[:,0]
y =3D X[:,1]
xlabel(r'$Dosierung H_2P_2O_7~10~[ml]$')
ylabel(r'$pH-Wert$')
# Fitting:
coeffs =3D polyfit(x,y,4)
xnew =3D arange(0,5.1,0.1)
besty =3D polyval(coeffs,xnew)
plot (x,y,'bo',xnew,besty)
show()
Darren
From: Dr. W. P. <w.p...@tu...> - 2005年05月31日 11:16:14
Hi,
I try to fit some data but do not get the result I want. The problem is, 
that I have only few data points:
Data file:
# Dosierung pH
0 9.35
1 8.70
2 8.34
3 8.06
4 7.85
5 7.67
What I want, is to create a fitting curve with the corresponding values 
e.g. the parameters of a cubic fitting.
I tried this with polyfit:
#!/usr/bin/python
 from pylab import *
X = load('Dosierung-pH.dat',comments="#")
x = X[:,0]
y = X[:,1]
xlabel(r'$Dosierung H_2P_2O_7~10~[ml]$')
ylabel(r'$pH-Wert$')
# Fitting:
coeffs = polyfit(x,y,4)
besty = polyval(coeffs,x)
xnew = arange(0,5,0.1)
plot (x,y,'bo',x,besty)
show()
Due to the view x-values, the curve is not a curve but a line with kinks.
Using
xnew = arange(0,5,0.1) and
plot (x,y,'bo',xnew,besty)
do not work, because xnew and besty have then not the same length.
The second question is, how can I get the curve values a,b,c,d out ? I 
would something expect like
y = a*x^3 + b*x^2 + c*x +d
printing the values for a,b,c,d for further using.
Regards
Werner
From: John G. <jn...@eu...> - 2005年05月31日 10:48:41
I think this might be a matplotlib issue.
I've been having some refresh issues with matplotlib since switching to 
2.6. In particular I've noticed that if I put my mouse over the toolbar 
and let a tooltip pop up the canvas does not get repainted.
Up to now I'd been assuming this problem was isolated to me (I use 
ratpoison as a window manager, which can confuse some apps).
I've cc'ed the matplotlib list in case anyone can throw some light on this.
John
dimitri pater wrote:
> Hello,
> I upgraded to PyGTK 2.6 from 2.4 . Now, when I switch from page 2 on a 
> Gtk.Notebook back to page 1, page 1 still shows some elements from 
> page 2 (it is not refreshed, just some parts). Both pages contain 
> graphs created with Matplotlib. I never had problems like this with 2.4...
> Any clues somebody? If necessary, I will attach the source files.
>
> Best regards,
> Dimitri
>
>------------------------------------------------------------------------
>
>_______________________________________________
>pygtk mailing list py...@da...
>http://www.daa.com.au/mailman/listinfo/pygtk
>Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> 
>
From: Christian M. <mee...@un...> - 2005年05月31日 07:37:41
One - hopefully final - update:
As some might remember my original snippet was this:
class SAXS_wx(wx.Frame):
	def __init__(self,parent,id,title):
		wx.Frame.__init__(self,None,-1,"SPlot")
<snip>
		self.fig = Figure(figsize=(5,4),dpi=100)
		self.axes = self.fig.add_subplot(111)
		self.canvas = FigureCanvas(self, -1, self.fig)
		self.parent = self.canvas.GetParent()
		self.canvas.mpl_connect('motion_notify_event',self.mouse_move)
		sizer = wx.BoxSizer(wx.VERTICAL)
		self.sizer = sizer
		sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW|wx.EXPAND)
		
		self.add_splot_toolbar()
		
		self.SetSizer(self.sizer)
		self.Fit()
The problem was that changing the figsize parameter had no effect on 
the frame size. Changing to
self.SetSizer(self.sizer)
self.Fit()
self.add_splot_toolbar()
solved the problem, where add_splot_toolbar() - a toolbar function very 
much like the 2nd toolbar in the wx examples - is added only just after 
arranging the sizer. I was unable to arrange the toolbar with the sizer 
- regardless of the sizer and the layout I used. Hence the problem is 
definitively wx-related, possibly together with a problem in Panther's 
framework, since I find the old sequence of commands in the examples 
and the misbehaving canvas there as well.
May I suggest adding a comment in the examples for OSX users so that 
they are aware of a possible conflict there?
Thanks once more,
Christian
From: Jack A. <ef...@iv...> - 2005年05月31日 03:56:57
hi there, matplotlib is great!
i want to create bar-charts, save to PNG and produce an HTML map to be
used over the PNG. something like this:
<map name="a">
<area shape="rect" coords="20,90,25,30" href="1.html">
<area shape="rect" coords="40,60,45,30" href="2.html">
</map>
<img src="a.png" usemap="#a">
so that when the user clicks on bar1 or bar2 of the chart, the appropriate
URL is loaded.
is there a way to get the coordinates of the bar from matlab, or do i have
to do some optical-chart-recognition? (or make my own little charting
package)
thanks,
jack.
From: Fernando P. <Fer...@co...> - 2005年05月31日 01:50:20
Arnd Baecker wrote:
> On 2005年5月30日, John Hunter wrote:
> 
> 
>>>>>>>"Fernando" == Fernando Perez <Fer...@co...> writes:
> 
> 
> There is another point:
> For me the y-axis label does not show up in Fernando's example.
> 
> Changing the end of the code to:
> ##############################
> raw_input("before x-label")
> pylab.xlabel('Time t[s]')
> raw_input("after x-label, before y-label")
> pylab.ylabel('Response')
> raw_input("after y-label")
> #####################
> shows that the xlabel is shown after the pylab.ylabel line
> and the ylabel is never shown.
Mmh, very strange. I can confirm that the labels do both (x/y) display 
correctly for me, on a Fedora Core 3 box using mpl 0.80 on Python 2.3.4 
(the default), and the TkAgg backend.
However, on my box all other backends (WX, GTK, Qt) fail to even open 
the display window _at all_. The code runs (confirmed by some print 
statements), but it never opens a window at all. This, despite the fact 
that these backends all work just fine in 'ipython -pylab'.
Trying to get some info from matplotlib wasn't very enlightening:
[~/test]> ./pplot.py --verbose-helpful
matplotlib data path /usr/share/matplotlib
loaded rc file /usr/local/home/fperez/.matplotlibrc
matplotlib version 0.80
verbose.level helpful
interactive is False
platform is linux2
numerix Numeric 23.7
font search path ['/usr/share/matplotlib']
loaded ttfcache file /usr/local/home/fperez/.ttffont.cache
backend GTKAgg version 2.4.1
t 0.0
t 0.1
t 0.2
t 0.3
[...]
I haven't the foggiest idea what the problem may be...
Best,
f
From: Matt N. <new...@ca...> - 2005年05月30日 23:02:37
Christian,
Hmm, it does sound like there might be a sizer conflict. Do you
get the tiny-figurecanvase behavior with the embedding_in_wx*.py
examples?? These have toolbars, but start off with reasonable
sizes, and respond to resizing ok for me.
--Matt
From: Arnd B. <arn...@we...> - 2005年05月30日 21:15:57
On 2005年5月30日, John Hunter wrote:
> >>>>> "Fernando" == Fernando Perez <Fer...@co...> writes:
There is another point:
For me the y-axis label does not show up in Fernando's example.
Changing the end of the code to:
##############################
raw_input("before x-label")
pylab.xlabel('Time t[s]')
raw_input("after x-label, before y-label")
pylab.ylabel('Response')
raw_input("after y-label")
#####################
shows that the xlabel is shown after the pylab.ylabel line
and the ylabel is never shown.
This is on debian linux, python 2.3, matplotlib.__version__ 0.80
> Fernando> One word of caution: you'll notice that in the above,
> Fernando> the xplt script runs very fast, while the mpl one is
> Fernando> unacceptably slow (and it consumes a TON of cpu). There
> Fernando> may be a trick to provide acceptable update speeds for
> Fernando> dynamically resized plots, but unfortunately I don't use
> Fernando> that kind of plotting much, so I can't really offer much
> Fernando> help there.
>
> Yes, this will run extremely slow, because each plot command creates a
> new matplotlib.lines.Line2D object, which at draw time means a new
> transformation, a new graphics context, etc. By the time you reach
> the end of the loop, you'll have a ton of extra overhead in object
> creation and function calls.
>
> If possible, I suggest creating just two line objects and manipulating
> their data directly, as in
>
> from math import sin, cos
> import matplotlib.numerix as nx
> import pylab
> pylab.ion() # interactive on, so each plot updates the window
>
> pylab.hold('on')
> allt = [0] # grow these lists and set the line data with them
> allsin = [sin(0)]
> allcos = [cos(0)]
> lsin, = pylab.plot(allt, allsin, 'g+') # lsin is a Line2D instance
> lcos, = pylab.plot(allt, allcos, 'ro') # lcos is a Line2D instance
> pylab.xlabel('Time t[s]')
> pylab.ylabel('Response')
> pylab.axis([0,10,-1,1])
> for t in nx.arange(0.1,10,0.1):
> allt.append(t)
> allsin.append(sin(t))
> allcos.append(cos(t))
> lsin.set_data(allt, allsin)
> lcos.set_data(allt, allcos)
> pylab.draw()
>
> # to prevent the window from closing
> raw_input()
>
> Fernando> I get the feeling that there's an O(N^2) problem
> Fernando> somewhere in there, because it seems to me that the plot
> Fernando> update slows down worse than linearly as more points are
> Fernando> added. But I didn't really measure it, it's just a gut
> Fernando> feeling.
>
> This will still be slower than xplt, but shouldn't be mind-numbingly
> slow.
On my machine it is slower by a factor 15
(import matplotlib ; matplotlib.rc.func_globals["get_backend"]()
gives 'GTKAgg').
As I am a speed fanatic ;-) I would surely like this
to be faster. But one should not forget
that matplotlib does quite a lot
(in particular antialising, sophisticated markers etc.).
> I have some concrete ideas on how to make animation faster, and
> have started working on them, but don't have anything ready yet.
That sounds great - looking very much forward to this!
Would this also result in a shorter code for the matplotlib example
(which is at the moment more than twice as long
than the scipy.xplt one)?
Best,
Arnd
From: Alan G I. <ai...@am...> - 2005年05月30日 20:29:56
On 2005年5月30日, John Hunter apparently wrote: 
> If possible, I suggest creating just two line objects and 
> manipulating their data directly, as in 
> from math import sin, cos 
> import matplotlib.numerix as nx 
> import pylab 
> pylab.ion() # interactive on, so each plot updates the window 
> pylab.hold('on') 
> allt = [0] # grow these lists and set the line data with them 
> allsin = [sin(0)] 
> allcos = [cos(0)] 
> lsin, = pylab.plot(allt, allsin, 'g+') # lsin is a Line2D instance 
> lcos, = pylab.plot(allt, allcos, 'ro') # lcos is a Line2D instance 
> pylab.xlabel('Time t[s]') 
> pylab.ylabel('Response') 
> pylab.axis([0,10,-1,1]) 
> for t in nx.arange(0.1,10,0.1): 
> allt.append(t) 
> allsin.append(sin(t)) 
> allcos.append(cos(t)) 
> lsin.set_data(allt, allsin) 
> lcos.set_data(allt, allcos) 
> pylab.draw() 
> # to prevent the window from closing 
> raw_input() 
1. This is indeed much faster.
2. It still slows to a crawl as t grows. Should it?
3. The only thing that slows down is draw(), so the problem 
 does not lie with the updating of the line instances.
Alan Isaac
P.S. Suppose I run the script and then press enter in the 
shell before closing the graph window. I get the following 
'NULL tstate' error:
 Fatal Python error: PyEval_RestoreThread: Null tstate
 abnormal program termination
Perhaps this is to be expected.
From: John H. <jdh...@ac...> - 2005年05月30日 17:48:38
>>>>> "Fernando" == Fernando Perez <Fer...@co...> writes:
 Fernando> One word of caution: you'll notice that in the above,
 Fernando> the xplt script runs very fast, while the mpl one is
 Fernando> unacceptably slow (and it consumes a TON of cpu). There
 Fernando> may be a trick to provide acceptable update speeds for
 Fernando> dynamically resized plots, but unfortunately I don't use
 Fernando> that kind of plotting much, so I can't really offer much
 Fernando> help there.
Yes, this will run extremely slow, because each plot command creates a
new matplotlib.lines.Line2D object, which at draw time means a new
transformation, a new graphics context, etc. By the time you reach
the end of the loop, you'll have a ton of extra overhead in object
creation and function calls.
If possible, I suggest creating just two line objects and manipulating
their data directly, as in
from math import sin, cos
import matplotlib.numerix as nx
import pylab
pylab.ion() # interactive on, so each plot updates the window
pylab.hold('on')
allt = [0] # grow these lists and set the line data with them
allsin = [sin(0)]
allcos = [cos(0)]
lsin, = pylab.plot(allt, allsin, 'g+') # lsin is a Line2D instance
lcos, = pylab.plot(allt, allcos, 'ro') # lcos is a Line2D instance
pylab.xlabel('Time t[s]')
pylab.ylabel('Response')
pylab.axis([0,10,-1,1])
for t in nx.arange(0.1,10,0.1):
 allt.append(t)
 allsin.append(sin(t))
 allcos.append(cos(t))
 lsin.set_data(allt, allsin)
 lcos.set_data(allt, allcos)
 pylab.draw()
# to prevent the window from closing
raw_input()
 Fernando> I get the feeling that there's an O(N^2) problem
 Fernando> somewhere in there, because it seems to me that the plot
 Fernando> update slows down worse than linearly as more points are
 Fernando> added. But I didn't really measure it, it's just a gut
 Fernando> feeling.
This will still be slower than xplt, but shouldn't be mind-numbingly
slow. I have some concrete ideas on how to make animation faster, and
have started working on them, but don't have anything ready yet.
JDH
From: Fernando P. <Fer...@co...> - 2005年05月30日 17:00:34
Nils Wagner wrote:
> Hi all,
> 
> I am going to switch over to matplotlib.
> How can I convert the example with respect to matplotlib ?
[~/test]> cat xplot.py
#!/usr/bin/env python
"""xplt-based dynamic plot"""
from scipy import *
xplt.hold('on')
for t in arange(0,10,0.1):
 xplt.plot(t,sin(t),'g+')
 xplt.pause(10)
 xplt.plot(t,cos(t),'ro')
xplt.xlabel('Time t[s]')
xplt.ylabel('Response')
# to prevent the window from closing
raw_input()
[~/test]> cat pplot.py
#!/usr/bin/env python
"""pylab-based dynamic plot"""
from scipy import *
import pylab
pylab.ion() # interactive on, so each plot updates the window
pylab.hold('on')
for t in arange(0,10,0.1):
 pylab.plot([t],[sin(t)],'g+')
 pylab.plot([t],[cos(t)],'ro')
pylab.xlabel('Time t[s]')
pylab.ylabel('Response')
# to prevent the window from closing
raw_input()
###
As you can see, all I did was pretty much do xplt->pylab, plus a few 
very minor changes. The matplotlib website has a lot of documentation, 
including illustrated screenshots, an examples package, a tutorial and a 
full user's guide. Since both mpl and xplt were trying to mimic matlab 
syntax, the transition should be pretty easy for you.
One word of caution: you'll notice that in the above, the xplt script 
runs very fast, while the mpl one is unacceptably slow (and it consumes 
a TON of cpu). There may be a trick to provide acceptable update speeds 
for dynamically resized plots, but unfortunately I don't use that kind 
of plotting much, so I can't really offer much help there.
I get the feeling that there's an O(N^2) problem somewhere in there, 
because it seems to me that the plot update slows down worse than 
linearly as more points are added. But I didn't really measure it, it's 
just a gut feeling.
Cheers,
f
From: Tim L. <ti...@cs...> - 2005年05月30日 15:59:17
On 2005年5月30日, Nils Wagner <nw...@me...> wrote...
> Hi all,
>=20
> I am going to switch over to matplotlib.
> How can I convert the example with respect to matplotlib ?
>=20
>=20
> from scipy import *
> from scipy.xplt import *
> import gui_thread
> xplt.hold('on')
> for t in arange(0,10,0.1):
> xplt.plot(t,sin(t),'g+')
> xplt.pause(10)
> xplt.plot(t,cos(t),'ro')
> xplt.xlabel('Time t[s]')
> xplt.ylabel('Response')
import time
=66rom pylab import *
ion()
for t in arange(0, 2, 0.1):
 scatter([t], [sin(t)], color=3D'g', marker=3D's')
 time.sleep(0.05)
 scatter([t], [cos(t)], color=3D'r', marker=3D'o')
 draw()
xlabel('Time t[s]')
ylabel('Response')
ioff()
show()
This is how I would best approximate what your xplt code does. I'm sure
someone will point out how this could be done better, but psuedo animation
isn't my thing :)
If you have a look around in the examples directory of the source
distribution you should be able to find plenty of snippets which give you
a feel for how to write matplotlib code. anim.py is kind of similar to
what you've done here.
Feel free to ask here if you have any other questions.
Cheers,
Tim
>=20
> Nils
>=20
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit http://developer.yahoo.net/?fr=3Doffad-ysdn-ostg-q22=
005
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>=20
`-
From: Nils W. <nw...@me...> - 2005年05月30日 15:27:20
Hi all,
I am going to switch over to matplotlib.
How can I convert the example with respect to matplotlib ?
 
from scipy import *
from scipy.xplt import *
import gui_thread
xplt.hold('on')
for t in arange(0,10,0.1):
 xplt.plot(t,sin(t),'g+')
 xplt.pause(10)
 xplt.plot(t,cos(t),'ro')
xplt.xlabel('Time t[s]')
xplt.ylabel('Response')
Nils
From: Tim L. <ti...@cs...> - 2005年05月30日 11:02:05
On 2005年5月30日, Mark Saward <ms...@bi...> wrote...
> Hi,
> 
> I need to make a small application that will do real time graphs. 
> Basically, it will receive data, and then:
> * store that data in a database
> * display it on a graph
> The graph will be Time vs Input so that a user can watch the graph 
> grow. Updates may be needed as quickly as 5 times per second.
> 
> Can matplotlib do this, or should I be looking at using something else? 
> If it can, how? I've taken a browse through the website but can't find 
> relevant information.
Have a look at anim.py in the examples directory of source distribution.
This should give you an idea of how to attack the problem. Feel free to
get back to us if you have any problems.
Cheers,
Tim
> 
> Mark
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
`-
5 messages has been excluded from this view by a project administrator.

Showing results of 315

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