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 10 results of 10

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
> 
`-
From: Mark S. <ms...@bi...> - 2005年05月30日 10:51:44
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.
Mark
From: Christian M. <mee...@un...> - 2005年05月30日 10:36:44
Thanks, Matt!
It took me a while to understand this: Your mini-script worked like 
expected. I could change the size easily. But my own program still 
didn't react to any change in the figsize parameter.
However, as soon as I took out the toolbar, everything was fine! There 
seems to be a conflict with the sizers, which I could not solve until 
now. I will dive into this and post an update, if I find a solution.
Cheers
Christian
On 29 May 2005, at 05:08, Matt Newville wrote:
> Christian,
>
> I don't recall seeing this behavior of absurdly small figures
> and no response to figsize argement, even using wxPython 2.5.3
> on Mac OS X (though, admittedly I'm using matplotlib 0.8).
>
> The script below works fine for me, and changing the figsize
> argument to Figure() does change the figure size. Does this work
> for you -- you might have to change the wxversion.select() line,
> or just comment it out. If this works for you, can you post a
> simple, self-contained script that fails?
>
> Cheers,
>
> --Matt
>

Showing 10 results of 10

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





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

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

More information about our ad policies

Ad destination/click URL:

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