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



Showing 21 results of 21

From: Eric F. <ef...@ha...> - 2007年02月14日 20:51:13
Mark,
It sounds like what you want axis('scaled') to do is nothing other than
gca().set_aspect(1, adjustable='box')
draw_if_interactive()
I think this is a bit out of character with things like axis('equal'). 
Part of this character is that automatic things are turned on, so that 
going back and forth between axis('equal') and axis('scaled') switches 
back and forth between the same two plots; the result is not 
history-dependent.
At your request (between the 0.87.7 and 0.90 releases), I put in a 
little bit of history-dependence by making axis('scaled') call to
 self.set_autoscale_on(False) # Req. by Mark Bakker
after the set_aspect() call. This means that you can get the behavior 
you want simply by changing your example to
from pylab import *
plot([1,2,3],[1,2,1])
axis('scaled')
axis([1,2,1,2]) # define new axis limits
Is this good enough? Do you really need to be able to set the axis 
limits *before* the call to axis('scaled')? If so, then I am inclined 
to make this a separate option for the axis command, because I think the 
present behavior of axis('scaled') is sensible in the context of the 
other existing options.
Eric
Mark Bakker wrote:
> Eric -
> 
> I just installed version 0.90 on my windows machine and it seems that 
> axis('scaled') doesn't work properly yet.
> I thought axis('scaled') will change the axes such that the aspect ratio 
> is equal WITHOUT changing the limits on the axes.
> A simple example shows that this goes wrong (I thought this used to work):
> 
> from pylab import *
> plot([1,2,3],[1,2,1])
> axis([1,2,1,2]) # define new axis limits
> axis('scaled')
> 
> And now Python comes back with ( 1.0, 3.0, 0.80000000000000004, 2.0), 
> which are the limits of the original plot command obtained using 
> autoscale_view.
> I think this is an easy fix in the axis function of axes.py.
> Here you do an autoscale_view, which shouldn't be done in the 'scaled' 
> option.
> I think you only need to change the indicated line below.
> 
> Thanks,
> 
> Mark
> 
> def axis(self, *v, **kwargs):
> '''
> Convenience method for manipulating the x and y view limits
> and the aspect ratio of the plot.
> 
> kwargs are passed on to set_xlim and set_ylim -- see their 
> docstrings for details
> '''
> if len(v)==1 and is_string_like(v[0]):
> s = v[0].lower()
> if s=='on': self.set_axis_on()
> elif s=='off': self.set_axis_off()
> elif s in ('equal', 'tight', 'scaled', 'normal', 'auto', 
> 'image'):
> self.set_autoscale_on(True)
> self.set_aspect('auto')
> if s!= 'scaled': self.autoscale_view() # THIS LINE WAS 
> CHANGED BY ADDING THE IF STATEMENT
> self.apply_aspect()
> if s=='equal':
> self.set_aspect('equal', adjustable='datalim')
> elif s == 'scaled':
> self.set_aspect ('equal', adjustable='box', anchor='C')
> self.set_autoscale_on(False) # Req. by Mark Bakker
> elif s=='tight':
> self.autoscale_view (tight=True)
> self.set_autoscale_on(False)
> elif s == 'image':
> self.autoscale_view(tight=True)
> self.set_autoscale_on(False)
> self.set_aspect('equal', adjustable='box', anchor='C')
> 
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Christopher B. <Chr...@no...> - 2007年02月14日 19:53:33
Thanks for doing this, the wx back-ends are a bit neglected at the moment.
Which version of wxPython did you test this all on? We really need some 
work/testing with 2.8.*, I now there are some issues on OS-X, but I 
haven't tried it anywhere else yet.
-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: John H. <jd...@gm...> - 2007年02月14日 19:53:00
On 2/14/07, Darren Dale <dd...@co...> wrote:
> What Ewald is trying to do used to work. The idea is not to work
> interactively, but to run a script and have the plots render in stages, the
> next stage begins when the current windows are closed. I know we have users
> who take advantage of this behavior for presentations.
This was always an unsupported use of show. The FAQ entry
 http://matplotlib.sourceforge.net/faq.html#SHOW
states in bold:
 IMPORTANT: show should called at most once per script and it should be the
 last line of your script. At that point, the GUI takes control of
the interpreter.
 If you want to force a figure draw, use draw instead.
That is worked in some cases can be considered an accident of the
backend and possibly GUI version.
That said, I would like to support this use case, essentially a pause
until some user input is given. Lots of people want it and it is a
useful thing. This came up again back in October. Nadia at STScI
worked on this and I think she thought she had a solution for blocking
calls in a threaded environment. Maybe she can provide some input
here.
JDH
From: John H. <jd...@gm...> - 2007年02月14日 19:37:05
On 2/14/07, David Clark (Lists) <dd...@la...> wrote:
> I'm working on a GUI with wxPython to display several traces of data.
> Using a checkbox, I would like to be able to turn traces on the plot on
> and off. I have managed to find the right methods to turn the whole
> axes on and off, but not individual traces. Any help would be appreciated.
Everythong that draws into a figure (Axes, Text, Line2D, Polygon,
etc...) all derive from Artist which has a visible property. So you
can turn anything off/on with
o.set_visible(True|False)
JDH
From: Nicolas G. <nic...@ga...> - 2007年02月14日 18:59:27
On 2/14/07, Sture Lygren <st...@ro...> wrote:
> Thank's a lot for your informative answer. I've solved the issue now using
> WXAgg as backend. WX was way too slow (plotting two graphs with 8000
> datapoints each)
Happy to know it have solved your issue :-)
NG
From: Sture L. <st...@ro...> - 2007年02月14日 18:55:44
Hi,
Thank's a lot for your informative answer. I've solved the issue now using
WXAgg as backend. WX was way too slow (plotting two graphs with 8000
datapoints each)
regards,
Sture
>> I've been trying to use matplotlib from boa constructor (on windows,
>> running enthon-python2.4-1.0.0 and boa-constructor 0.4.4). For test
>> purpose I have a single button-event call this function:
>>
>> def testPlot():
>> plot([1,2,3])
>> show()
>>
>> Everything is fine for the first event - button fires the function and
>> a plot-window is showing. Killing this window and have a second go at
>> the plot at first seems to work but the window can not be closed and
>> when I try to move said window the whole application crash.
>
> There is a conflict between the GUI library used by boa constructor
> (wxWidgets/wxPython) and the one used by default by matplotlib when
> you run the show() command (Tk).
>
> Each of these two libraries run an event loop, handling all your
> keyboard and mouse inputs. When you start your application, wxWidgets
> has control. When you run show(), Tk takes control and displays your
> matplotlib chart. But when you close the chart window, Tk keeps
> control, so your application freezes.
>
> The solution is to use another backend, compatible with wxpython. Try
> backend WX or WXAgg.
>
> At the top of your script (before import pylab), add this:
> import matplotlib
> matplotlib.use('WX')
>
> or:
> import matplotlib
> matplotlib.use('WXAgg')
>
> More explanations here: http://matplotlib.sourceforge.net/backends.html
>
> For reference, here is information provided on matplotlib's web site:
> http://matplotlib.sourceforge.net/installing.html
> There are known conflicts with some of the backends with some python
> IDEs such as pycrust, idle. If you want to use matplotlib from an IDE,
> please consult backends for compatibility information. You will have
> the greatest likelihood of success if you run the examples from the
> command shell or by double clicking on them, rather than from an IDE.
> If you are interactively generating plots, your best bet is TkAgg from
> the standard python shell or ipython.
>
> Good luck!
>
> -- Nicolas Grilly
>
>
-- 
Sture Lygren
Computer Systems Administrator
Andoya Rocket Range
Work: +4776144451 / Fax: +4776144401
From: David D C. <dd...@la...> - 2007年02月14日 18:29:27
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- --
David D. Clark
Electrical Engineer
P-23, Neutron Science and Technology
e-mail mailto:dd...@la...
GPG Public key 0x018D6523 available at http://www.us.pgp.net
http://www.gnupg.org has information about public key cryptography
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF01UANu7GcwGNZSMRAoXAAKCXUTOg6rJQ+/uWpA9+y9lMvXjDcACgj2Qh
fVgbxatBaf5cT8GsNc3eB70=
=8ZDP
-----END PGP SIGNATURE-----
From: <kc1...@ya...> - 2007年02月14日 18:25:24
Okay, I'll answer my own question. After looking through the code, it appe=
ars I have to do a xgridlines - not gridlines, like:=0A=0Aglines =3D getp(g=
ca(), 'xgridlines')=0A=0A> =0A> Hi list,=0A> =0A> The tutorial indicated th=
at I can use gca to get at the grid =0A> by doing a:=0A> =0A> glines =3D ge=
tp(gca(), 'gridlines')=0A> but when I do that, I get a "Subplot instance ha=
s no =0A> attribute "get_gridlines".=0A> =0A> How do I get to the grid obje=
ct?=0A> =0A> Thanks,=0A> =0A> --=0A> John Henry=0A=0A =0A--=0AJohn Henry=
=0A=0A
From: <kc1...@ya...> - 2007年02月14日 17:59:20
Hi list,=0A=0AThe tutorial indicated that I can use gca to get at the grid =
by doing a:=0A=0Aglines =3D getp(gca(), 'gridlines')=0Abut when I do that, =
I get a "Subplot instance has no attribute "get_gridlines".=0A=0AHow do I g=
et to the grid object?=0A=0AThanks,=0A =0A--=0AJohn Henry=0A=0A
I just downloaded the 0.9 binary and did some testing and also updated 
all the wx examples to use the new wx namespace (i.e. change from "from 
wxPython.wx import *" to "import wx".
dynamic_demo_wx.py
- changed name space using Boa's conversion tool
- moved the timer stuff to __init__, saved a reference and stop the 
timer on close, so that this shuts down correctly.
dynamic_demo_wxagg2.py
- changed name space using Boa's conversion tool
- complains about wxmsw26uh_vc.dll, but runs if one clicks on OK
dynamic_demo_wxagg.py
- changed name space using Boa's conversion tool
- complains about wxmsw26uh_vc.dll, but runs if one clicks on OK
embedding_in_wx.py
- changed name space using Boa's conversion tool
- screen update/refresh is for some reason very slow
embedding_in_wx2.py
- changed name space using Boa's conversion tool
- complains about wxmsw26uh_vc.dll, but runs if one clicks on OK
embedding_in_wx3.py
- changed name space using Boa's conversion tool
- manually made changes regarding XRC as it is not handled by the 
conversion tool
- can't get it to work, as think it is because 
"data/embedding_in_wx3.xrc" is not found - it is not included in the zip?!
embedding_in_wx4.py
- changed name space using Boa's conversion tool
- complains about wxmsw26uh_vc.dll, but runs if one clicks on OK
simple3d_oo.py
- changed name space using Boa's conversion tool
- complains about wxmsw26uh_vc.dll, but runs if one clicks on OK
If someone could take the enclosed and maybe create an updated examples.zip
When a build for wxPython 2.8 is available I will do some more testing, 
especially with regards to py2exe packaging.
Werner
From: David C. (Lists) <dd...@la...> - 2007年02月14日 16:27:58
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I'm working on a GUI with wxPython to display several traces of data.
Using a checkbox, I would like to be able to turn traces on the plot on
and off. I have managed to find the right methods to turn the whole
axes on and off, but not individual traces. Any help would be appreciated.
Thanks,
Dave
- --
David D. Clark
Electrical Engineer
P-23, Neutron Science and Technology
e-mail mailto:dd...@la...
GPG Public key 0x018D6523 available at http://www.us.pgp.net
http://www.gnupg.org has information about public key cryptography
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF0zh9Nu7GcwGNZSMRAgw3AKCuak5AJhp9df71nbZ+/QDDZc86OQCdHVBA
YRXrvtwMQqObyfFA08NKIBw=
=2Th4
-----END PGP SIGNATURE-----
From: Nicolas G. <nic...@ga...> - 2007年02月14日 15:58:58
> I've been trying to use matplotlib from boa constructor (on windows,
> running enthon-python2.4-1.0.0 and boa-constructor 0.4.4). For test
> purpose I have a single button-event call this function:
>
> def testPlot():
> plot([1,2,3])
> show()
>
> Everything is fine for the first event - button fires the function and
> a plot-window is showing. Killing this window and have a second go at
> the plot at first seems to work but the window can not be closed and
> when I try to move said window the whole application crash.
There is a conflict between the GUI library used by boa constructor
(wxWidgets/wxPython) and the one used by default by matplotlib when
you run the show() command (Tk).
Each of these two libraries run an event loop, handling all your
keyboard and mouse inputs. When you start your application, wxWidgets
has control. When you run show(), Tk takes control and displays your
matplotlib chart. But when you close the chart window, Tk keeps
control, so your application freezes.
The solution is to use another backend, compatible with wxpython. Try
backend WX or WXAgg.
At the top of your script (before import pylab), add this:
import matplotlib
matplotlib.use('WX')
or:
import matplotlib
matplotlib.use('WXAgg')
More explanations here: http://matplotlib.sourceforge.net/backends.html
For reference, here is information provided on matplotlib's web site:
http://matplotlib.sourceforge.net/installing.html
There are known conflicts with some of the backends with some python
IDEs such as pycrust, idle. If you want to use matplotlib from an IDE,
please consult backends for compatibility information. You will have
the greatest likelihood of success if you run the examples from the
command shell or by double clicking on them, rather than from an IDE.
If you are interactively generating plots, your best bet is TkAgg from
the standard python shell or ipython.
Good luck!
-- Nicolas Grilly
From: Tomi H. <th...@ik...> - 2007年02月14日 15:30:17
Hello,
I have been working with Mlib and networkX to create a server which 
listens for connections and based on the message it receives, it updates 
and shows a graph. These are great tools but one thing has come up: when 
the graph has been updated and the control goes back so listening 
socket.accept(), the GUI does not refresh anymore. This means that the 
whole GUI turns into gray if some other window is brought on top of it. 
Also it isn't possible to close the GUI window from the 'X' button etc. 
However, when a new message arrives to the server, the GUI is updated but 
then the refreshes are left undone until the next message and this cycle 
repeats over and over.
If I change my program so that after the first draw & show the program 
runs exit, the GUI is refreshed all the time and thus works like it 
should. Any suggestions? I found out that someone else had the same 
problem:
http://article.gmane.org/gmane.comp.python.matplotlib.general/5550/match=ipython+gui+refresh
My system is FC4 with networkX-0.33, Mlib-0.90.0, python 2.4.3, ipython 
0.7.2. I have tried TkAgg, GTKAgg and WxAgg but they all give the same 
result. With GTK backend even the graph doesn't show up so. Maybe ipython 
has something to do with this? My program doesn't have a proper GUI so 
only the graph is shown graphically. That is why I haven't looked at 
embedding Mlib stuff.
Here are two simple examples how the problem could be reproduced. The 
window is not refreshed until the sleep has run out.
1)
import networkx as NX
import pylab as P
import time
G=NX.Graph()
G.add_edge(1,2)
G.add_edge(2,3)
NX.draw(G)
time.sleep(5)
2)
from pylab import *
import time
gcf().text(0.5, 0.95, 'Distance Histograms by Category is a really long 
title')
show()
time.sleep(5)
Thanks for any answers or suggestions!
Tomi Hautakoski
th...@ik...
 When I play in the sandbox, the cat covers me up!
From: Mark B. <ma...@gm...> - 2007年02月14日 13:25:11
I have a follow-up on my previous emai.
I don't think we should do an autoscale_view() for axis('equal') either.
For axis('equal') only the limits of either the x or y axis are adjusted
(enlarged really) until the aspect ratio is equal.
Not sure about the others. Do we ever need to do it?
Mark
From: Mark B. <ma...@gm...> - 2007年02月14日 12:41:52
Eric -
I just installed version 0.90 on my windows machine and it seems that
axis('scaled') doesn't work properly yet.
I thought axis('scaled') will change the axes such that the aspect ratio is
equal WITHOUT changing the limits on the axes.
A simple example shows that this goes wrong (I thought this used to work):
from pylab import *
plot([1,2,3],[1,2,1])
axis([1,2,1,2]) # define new axis limits
axis('scaled')
And now Python comes back with (1.0, 3.0, 0.80000000000000004, 2.0), which
are the limits of the original plot command obtained using autoscale_view.
I think this is an easy fix in the axis function of axes.py.
Here you do an autoscale_view, which shouldn't be done in the 'scaled'
option.
I think you only need to change the indicated line below.
Thanks,
Mark
 def axis(self, *v, **kwargs):
 '''
 Convenience method for manipulating the x and y view limits
 and the aspect ratio of the plot.
 kwargs are passed on to set_xlim and set_ylim -- see their
docstrings for details
 '''
 if len(v)==1 and is_string_like(v[0]):
 s = v[0].lower()
 if s=='on': self.set_axis_on()
 elif s=='off': self.set_axis_off()
 elif s in ('equal', 'tight', 'scaled', 'normal', 'auto',
'image'):
 self.set_autoscale_on(True)
 self.set_aspect('auto')
 if s!= 'scaled': self.autoscale_view() # THIS LINE WAS
CHANGED BY ADDING THE IF STATEMENT
 self.apply_aspect()
 if s=='equal':
 self.set_aspect('equal', adjustable='datalim')
 elif s == 'scaled':
 self.set_aspect('equal', adjustable='box', anchor='C')
 self.set_autoscale_on(False) # Req. by Mark Bakker
 elif s=='tight':
 self.autoscale_view(tight=True)
 self.set_autoscale_on(False)
 elif s == 'image':
 self.autoscale_view(tight=True)
 self.set_autoscale_on(False)
 self.set_aspect('equal', adjustable='box', anchor='C')
From: Darren D. <dd...@co...> - 2007年02月14日 12:13:34
On Wednesday 14 February 2007 6:59:18 am George Nurser wrote:
> On 14/02/07, Ewald Zietsman <ewa...@gm...> wrote:
> > Hi All,
> >
> > I have a slight problem using matplotlib 0.87.7. I'm using Ubuntu 6.10
> > and installed mpl from source. I'm running numpy 1.01, also installed
> > from source.
> >
> > If I run the script below, the first plot shows fine. When I close it the
> > second plot should display but it doesn't. I can only get the first plot
> > to show. Thereafter the plot command doesn't seem to work. I tried
> > reinstalling matplotlib. That didn't work. This works fine if I type it
> > into ipython. It also works on my computer running FC5.
> >
> > Any help will be greatly appreciated.
> >
> > -Ewald
> >
> > # Sample script
> > from pylab import *
> > t = arange(10)
> > f = t*t
> > plot(t,f)
> > show()
> > plot(t,f)
> > show()
>
> Ewald,
>
> It may be that what you are trying should work.
>
> However, I believe that for interactive work it is recommended to use
> ipython -pylab unless you are using the TkAgg backend.
What Ewald is trying to do used to work. The idea is not to work 
interactively, but to run a script and have the plots render in stages, the 
next stage begins when the current windows are closed. I know we have users 
who take advantage of this behavior for presentations.
Darren
From: George N. <gn...@go...> - 2007年02月14日 11:59:22
On 14/02/07, Ewald Zietsman <ewa...@gm...> wrote:
> Hi All,
>
> I have a slight problem using matplotlib 0.87.7. I'm using Ubuntu 6.10 and
> installed mpl from source. I'm running numpy 1.01, also installed from
> source.
>
> If I run the script below, the first plot shows fine. When I close it the
> second plot should display but it doesn't. I can only get the first plot to
> show. Thereafter the plot command doesn't seem to work. I tried reinstalling
> matplotlib. That didn't work. This works fine if I type it into ipython. It
> also works on my computer running FC5.
>
> Any help will be greatly appreciated.
>
> -Ewald
>
> # Sample script
> from pylab import *
> t = arange(10)
> f = t*t
> plot(t,f)
> show()
> plot(t,f)
> show()
>
Ewald,
It may be that what you are trying should work.
However, I believe that for interactive work it is recommended to use
ipython -pylab unless you are using the TkAgg backend. You select
this in your matplotlibrc file (it should go into ~/.matplotlib)
OR
(see http://matplotlib.sourceforge.net/faq.html) you can do the use
command before importing pylab, as described at
http://matplotlib.sourceforge.net/backends.html
 >>> import matplotlib
 >>> matplotlib.use('TkAgg')
 >>> from pylab import *
Note that if you are using an IDE like pycrust, ipython -pylab,
pythonwin, or IDLE, pylab may have already been loaded, and subsequent
calls to use or from pylab import * will have no effect unless you
explicitly force a module reload.
HTH. George Nurser.
From: Ewald Z. <ewa...@gm...> - 2007年02月14日 08:37:03
Hi All,
I have a slight problem using matplotlib 0.87.7. I'm using Ubuntu 6.10 and
installed mpl from source. I'm running numpy 1.01, also installed from
source.
If I run the script below, the first plot shows fine. When I close it the
second plot should display but it doesn't. I can only get the first plot to
show. Thereafter the plot command doesn't seem to work. I tried reinstalling
matplotlib. That didn't work. This works fine if I type it into ipython. It
also works on my computer running FC5.
Any help will be greatly appreciated.
-Ewald
# Sample script
from pylab import *
t = arange(10)
f = t*t
plot(t,f)
show()
plot(t,f)
show()
From: Sture L. <st...@ro...> - 2007年02月14日 07:26:29
Hello,
I've been trying to use matplotlib from boa constructor (on windows,
running enthon-python2.4-1.0.0 and boa-constructor 0.4.4). For test
purpose I have a single button-event call this function:
def testPlot():
	plot([1,2,3])
	show()
Everything is fine for the first event - button fires the function and
a plot-window is showing. Killing this window and have a second go at
the plot at first seems to work but the window can not be closed and
when I try to move said window the whole application crash.
So - why is this happening?
regards,
Sture
-- 
Sture Lygren
Computer Systems Administrator
Andoya Rocket Range
Work: +4776144451 / Fax: +4776144401
From: <kc1...@ya...> - 2007年02月14日 06:43:43
I am having trouble with axes and grids in the y-direction.=0A=0AI have a 3=
 rows x 2 colums figure and I like to have 5 major Y divisions or 4 grid li=
nes for each of the graphs. 5 of the 6 graphs came out properly. For ins=
tance, for a Ymin=3D12, Ymax=3D17, I get grid lines at y=3D13, 14, 15, and =
16. However, the 6th one isn't right. For a Ymin=3D-5 and Ymax=3D5, I g=
et grid lines at y=3D-4, -2, 0, 2, 4 (but the origin does starts with y=3D-=
5). I want to have only 4 grid lines (at y=3D-3, -1, +1, 3). I tried man=
y settings but the result is the same. =0A=0AWhat should I do to get only=
 4 grid lines in the y-direction?=0A=0ARegards,=0A =0A--=0AJohn Henry=0A=0A
From: Giorgio G. <gi...@gi...> - 2007年02月14日 00:21:14
I asked some help last week.
I post here the solution to my problem since I believe it's something of
general interest.
A figure is generated and the user can change the size of the canvas (in
inches) interactively, as if we are zooming in and out the canvas.
This is particularly useful when you are drawing figures that can have few
or many subplots.
I couldn't manage to get this working with a resize so the trick is that
every time we destroy and create the canvas.
Cheers.
-------------------------------------------------------------
import wx, wxmpl
from numpy import *
class PanelWScrolledWindow(wx.ScrolledWindow):
	def __init__(self,parent):
		wx.ScrolledWindow.__init__(self, parent)
		self.mainsizer = wx.BoxSizer(wx.VERTICAL)
		self.BTNsizer = wx.BoxSizer(wx.HORIZONTAL)
		self.width, self.heigth = 3, 6
		BTNsmall = wx.Button(self, -1, "Smaller FIG")
		BTNbig = wx.Button(self, -1, "Bigger FIG")
		self.Bind(wx.EVT_BUTTON, self.onBTNbig, BTNbig)
		self.Bind(wx.EVT_BUTTON, self.onBTNsmall, BTNsmall)
		self.BTNsizer.Add (BTNsmall, 0, wx.GROW|wx.ALL, 1)
		self.BTNsizer.Add (BTNbig, 0, wx.GROW|wx.ALL, 1)
		#Note that in a real world you want the button to be outside
the scrolledwindow
		self.mainsizer.Add (self.BTNsizer, 0, wx.GROW|wx.ALL, 1)
		self.CreateCanvas()
	def CreateCanvas(self, size=(2,4)):
		try:
			self.canvas.Destroy()
		except:
			pass
		
		self.canvas = wxmpl.PlotPanel(self, -1, size)
		self.SetScrollbars(20, 20, size[0]/20, size[1]/20)
		self.mainsizer.Add (self.canvas, 1, wx.GROW|wx.ALL, 1)
		self.SetSizer(self.mainsizer)
		self.FitInside()
		
	def onBTNbig(self,event):
		self.heigth += 1
		self.width +=1
		self.CreateCanvas(size=(self.width,self.heigth))
		plot_simple(self.canvas.get_figure())
	def onBTNsmall(self,event):
		self.heigth -= 1
		self.width -=1
		self.CreateCanvas(size=(self.width,self.heigth))
		plot_simple(self.canvas.get_figure())
class MyFrame(wx.Frame):
	def __init__(self, parent, title):
		wx.Frame.__init__(self, parent)
		self.nb = wx.Notebook(self)
		self.PageOne = PanelWScrolledWindow(self.nb)
		self.PageTwo = wx.Panel(self.nb)
		self.nb.AddPage(self.PageOne, "PageOne")
		self.nb.AddPage(self.PageTwo, "PageTwo")
def plot_simple(fig):
	t = arange(0.0, 2.0, 0.01)
	s = sin(2*pi*t)
	c = cos(2*pi*t)
	
	axes = fig.gca()
	axes.plot(t, s, linewidth=1.0)
	axes.plot(t, c, linewidth=1.0)
	
	axes.set_xlabel('time (s)')
	axes.set_ylabel('voltage (mV)')
	axes.set_title('About as simple as it gets, folks')
	axes.grid(True)
#here we start
app = wx.PySimpleApp()
frm = MyFrame(None, "Test")
frm.SetSize((800,600))
frm.Show()
app.SetTopWindow(frm)
app.MainLoop()

Showing 21 results 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 によって変換されたページ (->オリジナル) /