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






Showing 22 results of 22

From: Jae-Joon L. <lee...@gm...> - 2010年02月06日 22:58:50
The above version has some typos (while it works it had some
side-effects), here is the corrected one.
-JJ
import matplotlib.blocking_input as blocking_input
if blocking_input.BlockingMouseInput.add_click ==
blocking_input.BlockingContourLabeler.add_click:
 def mouse_event_stop(self, event ):
 blocking_input.BlockingInput.pop(self,-1)
 self.fig.canvas.stop_event_loop()
 def add_click(self, event):
 self.button1(event)
 def pop_click(self, event, index=-1):
 if self.inline:
 pass
 else:
 self.cs.pop_label()
 self.cs.ax.figure.canvas.draw()
 blocking_input.BlockingMouseInput.mouse_event_stop = mouse_event_stop
 blocking_input.BlockingContourLabeler.add_click = add_click
 blocking_input.BlockingContourLabeler.pop_click = pop_click
On Sat, Feb 6, 2010 at 5:52 PM, David Arnold <dwa...@su...> wrote:
> JJ,
>
> Very nice repair, as this works precisely as it should. I use this tool in Matlab all the time when teaching multivariable calculus.
>
> D.
>
> On Feb 6, 2010, at 2:41 PM, Jae-Joon Lee wrote:
>
>> This is a known bug, and I think I fixed it in the svn. Meanwhile, you
>> may use the monkey patching.
>> Insert these lines in your script (before you call clabel).
>>
>> Regards,
>>
>> -JJ
>>
>>
>> import matplotlib.blocking_input as blocking_input
>> def mouse_event_stop(self, event ):
>>  blocking_input.BlockingInput.pop(self,-1)
>>  self.fig.canvas.stop_event_loop()
>> def add_click(self, event):
>>  self.button1(event)
>> def pop_click(self, event, index=-1):
>>  if self.inline:
>>    pass
>>  else:
>>    self.cs.pop_label()
>>    self.cs.ax.figure.canvas.draw()
>>
>> blocking_input.BlockingMouseInput.mouse_event_stop = mouse_event_stop
>> blocking_input.BlockingMouseInput.add_click = add_click
>> blocking_input.BlockingMouseInput.pop_click = pop_click
>>
>>
>>
>> On Sat, Feb 6, 2010 at 2:01 AM, David Arnold <dwa...@su...> wrote:
>>> Hi,
>>>
>>> I'm trying to get manual labeling of contours to work:
>>>
>>> import numpy as np
>>> import matplotlib.mlab as mlab
>>> import matplotlib.pyplot as plt
>>>
>>> delta = 0.025
>>> x = np.arange(-3.0, 3.0, delta)
>>> y = np.arange(-2.0, 2.0, delta)
>>> X, Y = np.meshgrid(x, y)
>>> Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
>>> Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
>>> # difference of Gaussians
>>> Z = 10.0 * (Z2 - Z1)
>>>
>>> plt.figure()
>>> CS = plt.contour(X, Y, Z, 6,
>>>         linewidths=np.arange(.5, 4, .5),
>>>         colors=('r', 'green', 'blue', (1,1,0), '#afeeee', '0.5')
>>>         )
>>> plt.clabel(CS, fontsize=9, inline=1, manual=True)
>>> plt.title('Crazy lines')
>>>
>>> plt.show()
>>>
>>> On my macbook, clicking with the touchpad does not seem to work.
>>>
>>> Any ideas?
>>>
>>> David.
>>>
>>> ------------------------------------------------------------------------------
>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>> Stay online with enterprise data centers and the best network in the business
>>> Choose flexible plans and management services without long-term contracts
>>> Personal 24x7 support from experience hosting pros just a phone call away.
>>> http://p.sf.net/sfu/theplanet-com
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>
>
From: Ben A. <BAx...@co...> - 2010年02月06日 22:55:38
I looked into this issue a little bit and found that the FigureCanvas must be set on the Figure before the 3D axes is instantiated. A simple re-ordering of the lines in the code below makes mouse rotation work again.
# ...
self.figure = Figure()
self.canvas = FigureCanvas(self, -1, self.figure)
#You must set up the canvas before creating the 3D axes
self.axes = Axes3D(self.figure)
# ...
Perhaps this should be documented somehow? Or maybe a new mplot3d example code should be added. Or maybe 
Axes3D.mouse_init() should warn the user if self.figure.canvas is None.
-Ben
-----Original Message-----
From: Ben Axelrod [mailto:BAx...@co...] 
Sent: Monday, February 01, 2010 3:56 PM
To: mat...@li...
Subject: [Matplotlib-users] Axes3D rotation not working when embedded in backend
I would like to use Axes3D embedded in Wx. This works, but there is no mouse rotation. Clicking and dragging the mouse on the plot does not rotate the 3D axes like it does in the "scatter3d_demo.py". I tried: WX, WXAgg, and TkAgg with similar results. Can this be fixed soon, or can someone point me to where I can try to fix it?
I tested with the latest SVN tree on Linux and Windows.
Thanks,
-Ben
Below is some sample code adapted from "embedding_in_wx2.py", but with an Axes3D instead of the regular plot:
#!/usr/bin/env python
# adapted from example code "embedding_in_wx2.py"
# Used to guarantee to use at least Wx2.8 import wxversion
wxversion.ensureMinimal('2.8')
import numpy as np
import matplotlib
# uncomment the following to use wx rather than wxagg
#matplotlib.use('WX')
#from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas
# comment out the following to use wx rather than wxagg
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.figure import Figure
from mpl_toolkits.mplot3d import Axes3D
import wx
class CanvasFrame(wx.Frame):
 def __init__(self):
 wx.Frame.__init__(self,None,-1,
 'CanvasFrame',size=(550,350))
 self.SetBackgroundColour(wx.NamedColor("WHITE"))
 self.figure = Figure()
 self.axes = Axes3D(self.figure)
 
 xs = np.random.rand(100)
 ys = np.random.rand(100)
 zs = np.random.rand(100)
 self.axes.scatter(xs, ys, zs)
 
 self.canvas = FigureCanvas(self, -1, self.figure)
 self.sizer = wx.BoxSizer(wx.VERTICAL)
 self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
 self.SetSizer(self.sizer)
 self.Fit()
 self.add_toolbar() # comment this out for no toolbar
 def add_toolbar(self):
 self.toolbar = NavigationToolbar2Wx(self.canvas)
 self.toolbar.Realize()
 if wx.Platform == '__WXMAC__':
 # Mac platform (OSX 10.3, MacPython) does not seem to cope with
 # having a toolbar in a sizer. This work-around gets the buttons
 # back, but at the expense of having the toolbar at the top
 self.SetToolBar(self.toolbar)
 else:
 # On Windows platform, default window size is incorrect, so set
 # toolbar width to figure width.
 tw, th = self.toolbar.GetSizeTuple()
 fw, fh = self.canvas.GetSizeTuple()
 # By adding toolbar in sizer, we are able to put it at the bottom
 # of the frame - so appearance is closer to GTK version.
 # As noted above, doesn't work for Mac.
 self.toolbar.SetSize(wx.Size(fw, th))
 self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
 # update the axes menu on the toolbar
 self.toolbar.update()
 def OnPaint(self, event):
 self.canvas.draw()
class App(wx.App):
 def OnInit(self):
 'Create the main window and insert the custom frame'
 frame = CanvasFrame()
 frame.Show(True)
 return True
app = App(0)
app.MainLoop()
#end code
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: David A. <dwa...@su...> - 2010年02月06日 22:52:13
JJ,
Very nice repair, as this works precisely as it should. I use this tool in Matlab all the time when teaching multivariable calculus. 
D.
On Feb 6, 2010, at 2:41 PM, Jae-Joon Lee wrote:
> This is a known bug, and I think I fixed it in the svn. Meanwhile, you
> may use the monkey patching.
> Insert these lines in your script (before you call clabel).
> 
> Regards,
> 
> -JJ
> 
> 
> import matplotlib.blocking_input as blocking_input
> def mouse_event_stop(self, event ):
> blocking_input.BlockingInput.pop(self,-1)
> self.fig.canvas.stop_event_loop()
> def add_click(self, event):
> self.button1(event)
> def pop_click(self, event, index=-1):
> if self.inline:
> pass
> else:
> self.cs.pop_label()
> self.cs.ax.figure.canvas.draw()
> 
> blocking_input.BlockingMouseInput.mouse_event_stop = mouse_event_stop
> blocking_input.BlockingMouseInput.add_click = add_click
> blocking_input.BlockingMouseInput.pop_click = pop_click
> 
> 
> 
> On Sat, Feb 6, 2010 at 2:01 AM, David Arnold <dwa...@su...> wrote:
>> Hi,
>> 
>> I'm trying to get manual labeling of contours to work:
>> 
>> import numpy as np
>> import matplotlib.mlab as mlab
>> import matplotlib.pyplot as plt
>> 
>> delta = 0.025
>> x = np.arange(-3.0, 3.0, delta)
>> y = np.arange(-2.0, 2.0, delta)
>> X, Y = np.meshgrid(x, y)
>> Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
>> Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
>> # difference of Gaussians
>> Z = 10.0 * (Z2 - Z1)
>> 
>> plt.figure()
>> CS = plt.contour(X, Y, Z, 6,
>> linewidths=np.arange(.5, 4, .5),
>> colors=('r', 'green', 'blue', (1,1,0), '#afeeee', '0.5')
>> )
>> plt.clabel(CS, fontsize=9, inline=1, manual=True)
>> plt.title('Crazy lines')
>> 
>> plt.show()
>> 
>> On my macbook, clicking with the touchpad does not seem to work.
>> 
>> Any ideas?
>> 
>> David.
>> 
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the business
>> Choose flexible plans and management services without long-term contracts
>> Personal 24x7 support from experience hosting pros just a phone call away.
>> http://p.sf.net/sfu/theplanet-com
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
From: David A. <dwa...@su...> - 2010年02月06日 22:46:42
Goyo,
Sweet little function. Thanks.
I still feel that a comet routine should be added to matplotlib for the reasons I've delineated.
D.
On Feb 6, 2010, at 1:38 PM, Goyo wrote:
> Hi David,
> 
> El sáb, 06-02-2010 a las 10:21 -0800, David Arnold escribió:
>> Hi Eric,
>> 
>> Matlab has two commands, comet and comet3, that animate the path. They are used as in the following Matlab code:
>> 
>> t=linspace(0,2*pi,2000);
>> x=-sin(t);
>> y=cos(t);
>> comet(x,y)
> 
> You can just write the function:
> 
> import matplotlib.pyplot as plt
> 
> def comet(x, y, fmt='', step=1, **kwargs):
> l, = plt.plot(x, y, fmt, **kwargs)
> num_points = len(x)
> for i in xrange(1, num_points + 1, step):
> l.set_data(x[:i], y[:i])
> plt.draw()
> l.set_data(x, y)
> plt.draw()
> 
> I think this could be better done using animation features of
> matplotlib, but I never used them and I think they varies across
> toolkits. Search the docs for animation examples anyway.
> 
> Goyo
> 
>> 
>> What then happens is the path is drawn "live", as in my python code below.
>> 
>> This is especially useful when teaching parametric equations in calculus. A typical question in that section might be: "find a parametrization for the unit circle that starts at (0,1) and moves around the circle one time in the counterclockwise direction." In this situation, the following is not helpful:
>> 
>> t=linspace(0,2*pi,2000);
>> x=-sin(t);
>> y=cos(t);
>> plot(x,y)
>> 
>> Because the student just sees sees the "finished" path. The comet command, on the other hand, allows the student to "see" that path as it is traced out in real time.
>> 
>> David.
>> 
>> On Feb 6, 2010, at 9:09 AM, Eric Firing wrote:
>> 
>>> David Arnold wrote:
>>>> All,
>>>> I am still wondering why there is no comet command in matplotlib. I was successful with the following:
>>>> import matplotlib.pyplot as plt
>>>> import numpy as np
>>>> len=200
>>>> t=np.linspace(0,2*np.pi,len)
>>>> x=np.cos(t)
>>>> y=np.sin(t)
>>>> xd=[x[0]]
>>>> yd=[y[0]]
>>>> l,=plt.plot(xd,yd)
>>>> plt.axis([-1,1,-1,1])
>>>> for i in np.arange(1,len):
>>>> 	xd.append(x[i])
>>>> 	yd.append(y[i])
>>>> 	l.set_xdata(xd)
>>>> 	l.set_ydata(yd)
>>>> 	plt.draw()
>>>> 	
>>>> plt.show()
>>>> But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython.
>>> 
>>> I don't understand--what's the point of the example? What is "comet", and how does it simplify anything?
>>> 
>>> Eric
>>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the business
>> Choose flexible plans and management services without long-term contracts
>> Personal 24x7 support from experience hosting pros just a phone call away.
>> http://p.sf.net/sfu/theplanet-com
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> 
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jae-Joon L. <lee...@gm...> - 2010年02月06日 22:42:12
This is a known bug, and I think I fixed it in the svn. Meanwhile, you
may use the monkey patching.
Insert these lines in your script (before you call clabel).
Regards,
-JJ
import matplotlib.blocking_input as blocking_input
def mouse_event_stop(self, event ):
 blocking_input.BlockingInput.pop(self,-1)
 self.fig.canvas.stop_event_loop()
def add_click(self, event):
 self.button1(event)
def pop_click(self, event, index=-1):
 if self.inline:
 pass
 else:
 self.cs.pop_label()
 self.cs.ax.figure.canvas.draw()
blocking_input.BlockingMouseInput.mouse_event_stop = mouse_event_stop
blocking_input.BlockingMouseInput.add_click = add_click
blocking_input.BlockingMouseInput.pop_click = pop_click
On Sat, Feb 6, 2010 at 2:01 AM, David Arnold <dwa...@su...> wrote:
> Hi,
>
> I'm trying to get manual labeling of contours to work:
>
> import numpy as np
> import matplotlib.mlab as mlab
> import matplotlib.pyplot as plt
>
> delta = 0.025
> x = np.arange(-3.0, 3.0, delta)
> y = np.arange(-2.0, 2.0, delta)
> X, Y = np.meshgrid(x, y)
> Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
> Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
> # difference of Gaussians
> Z = 10.0 * (Z2 - Z1)
>
> plt.figure()
> CS = plt.contour(X, Y, Z, 6,
>         linewidths=np.arange(.5, 4, .5),
>         colors=('r', 'green', 'blue', (1,1,0), '#afeeee', '0.5')
>         )
> plt.clabel(CS, fontsize=9, inline=1, manual=True)
> plt.title('Crazy lines')
>
> plt.show()
>
> On my macbook, clicking with the touchpad does not seem to work.
>
> Any ideas?
>
> David.
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: James C. <clo...@jh...> - 2010年02月06日 22:07:22
>>>>> "M" == Matthias Michler <Mat...@gm...> writes:
M> I'm sorry, I'm not an expert in eps-graphics. For me the final pics
M> look good and I have no idea what is different between matplotlib
M> eps-files and eps-files generated somewhere else.
Based exclusively on the eps you posted in this thread, MPL took a ttf
font (Bitstream Vera Sans) and created a PostSctipt Type3 font from it,
rather than embedding the original font as a Type42 font. It is still
a vector font, but one which only PS interpreters can rasterize.
The OP's downstream seems to want the fonts to be in a format (such as
Type1, TTF (which is embedded in PostScipt as Type42) or CFF (which is
converted to Type1 when embedded in PostScript)) which their tools can
understand, replace, et cetera.
If one were to edit the eps in a text editor, and replace the Type3 w/
a Type42 of the original TTF, I suspect the OP's downstream might find
the eps more to its liking.
Ttftotype42 from <http://www.lcdf.org/type/> can convert TTF to Type42.
-JimC
-- 
James Cloos <cl...@jh...> OpenPGP: 1024D/ED7DAEA6
From: Goyo <goy...@gm...> - 2010年02月06日 21:38:33
Hi David,
El sáb, 06-02-2010 a las 10:21 -0800, David Arnold escribió:
> Hi Eric,
> 
> Matlab has two commands, comet and comet3, that animate the path. They are used as in the following Matlab code:
> 
> t=linspace(0,2*pi,2000);
> x=-sin(t);
> y=cos(t);
> comet(x,y)
You can just write the function:
import matplotlib.pyplot as plt
def comet(x, y, fmt='', step=1, **kwargs):
 l, = plt.plot(x, y, fmt, **kwargs)
 num_points = len(x)
 for i in xrange(1, num_points + 1, step):
 l.set_data(x[:i], y[:i])
 plt.draw()
 l.set_data(x, y)
 plt.draw()
I think this could be better done using animation features of
matplotlib, but I never used them and I think they varies across
toolkits. Search the docs for animation examples anyway.
Goyo
> 
> What then happens is the path is drawn "live", as in my python code below.
> 
> This is especially useful when teaching parametric equations in calculus. A typical question in that section might be: "find a parametrization for the unit circle that starts at (0,1) and moves around the circle one time in the counterclockwise direction." In this situation, the following is not helpful:
> 
> t=linspace(0,2*pi,2000);
> x=-sin(t);
> y=cos(t);
> plot(x,y)
> 
> Because the student just sees sees the "finished" path. The comet command, on the other hand, allows the student to "see" that path as it is traced out in real time.
> 
> David.
> 
> On Feb 6, 2010, at 9:09 AM, Eric Firing wrote:
> 
> > David Arnold wrote:
> >> All,
> >> I am still wondering why there is no comet command in matplotlib. I was successful with the following:
> >> import matplotlib.pyplot as plt
> >> import numpy as np
> >> len=200
> >> t=np.linspace(0,2*np.pi,len)
> >> x=np.cos(t)
> >> y=np.sin(t)
> >> xd=[x[0]]
> >> yd=[y[0]]
> >> l,=plt.plot(xd,yd)
> >> plt.axis([-1,1,-1,1])
> >> for i in np.arange(1,len):
> >> 	xd.append(x[i])
> >> 	yd.append(y[i])
> >> 	l.set_xdata(xd)
> >> 	l.set_ydata(yd)
> >> 	plt.draw()
> >> 	
> >> plt.show()
> >> But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython.
> > 
> > I don't understand--what's the point of the example? What is "comet", and how does it simplify anything?
> > 
> > Eric
> > 
> 
> 
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Pierre R. <co...@py...> - 2010年02月06日 21:13:56
2010年2月6日 Gael Varoquaux <gae...@no...>:
> On Sat, Feb 06, 2010 at 11:27:50AM +0100, Pierre Raybaut wrote:
> When you start having a somewhat complex set of functions that call
> each other, or when you are getting failures with somebody else's code,
> this is priceless. This is so useful that to debug some code that, when I
> am trying to understand why some code is not working the way it should
> be, I will purposely add an exception, to be able to introspect the code.
> Granted, adding pdb.set_trace() will work without IPython[*], but I find
> it very useful.
>
> [*] It will not work in Spyder as it is quite challenging to have these
> features requiring user terminal interaction in a GUI.
Actually it works in Spyder too (in the external console which is
executed in a another process).
;-)
-Pierre
From: Ted K. <ted...@go...> - 2010年02月06日 21:09:49
Hi
I'd like to generate a surface plot using mplot3d. However, Z is not a
function of X and/or Y. It's just a set of scalar values. So, the following
doesn't work:
X = np.arange(2, 102, 2)
Y = np.arange(0, 15.15, 0.15)
X, Y = np.meshgrid(X, Y)
Z = f[2]
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
Is there a way that I can do this?
Thank you.
Ted
From: Ted K. <ted...@go...> - 2010年02月06日 21:05:33
Hi
I'd like to generate a surface plot using mplot3d. However, Z is not a
function of X and/or Y. It's just a set of scalar values. So, the following
doesn't work:
X = np.arange(2, 102, 2)
Y = np.arange(0, 15.15, 0.15)
X, Y = np.meshgrid(X, Y)
Z = f[2]
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
Is there a way that I can do this?
Thank you.
Ted
From: Wayne W. <sie...@sb...> - 2010年02月06日 19:35:33
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
I can write&nbsp; some fairly decent Python code. In fact, I've&nbsp; recently
written 400-500 lines often using numpy. There are still a number of
concepts that are fuzzy. I have a modest familiarity of OOP from years
ago with C++, and a few things I've picked up from Python. Five years
ago, I was working with Matlab, but my knowledge&nbsp; has diminished. <br>
<br>
Nevertheless, I finally decided to graphics, MPL, to display what I'm
doing. I've&nbsp; had some modest success using very basic operations,
sometime guessing at usage along the way. I've looked through the
bewildering array of MPL, pylab,&nbsp; pyplot docs and examples.&nbsp; It's&nbsp;
slowly fitting together. I decided to give the following web page a
closer look to see what are the differences between the MPL players.
<a class="moz-txt-link-rfc2396E" href="http://matplotlib.sourceforge.net/faq/usage_faq.html">&lt;http://matplotlib.sourceforge.net/faq/usage_faq.html&gt;</a>. I've
copied a few paragraphs at the start of the FAQ below.<br>
<br>
I've studied it fairly carefully, and more or less comprehend it.
However, why does it need words like state-machine, convenience
functions, and object-oriented. I'm familiar with them all, but the
concepts really aren't presented clearly in relationship to the code
below. I'm not even sure if we are&nbsp; pro-pylab or&nbsp; pyplot as the
preferred-style. What part of some of the code is pyplot or otherwise?
Highlight it. Not everyone is clear on some of the assumed Python
concepts here.<br>
<br>
It seems as though Python has a way of aligning itself with other
tools, For example, Matlab and Tk. Despite the apparent appeal of MPL
and Tkinter, seldom, maybe&nbsp; never, is anyone who is attracted to these
ideas really familiar with the tools on which they are based. (Perhaps
its the other way. Everyone knows them )Yet&nbsp; no explanation is
offered.&nbsp; What would that take, 3 pages each? <br>
<br>
============================================<br>
<h2>Matplotlib, pylab, and pyplot: how are they related?<a
 class="headerlink"
 href="http://matplotlib.sourceforge.net/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related"
 title="Permalink to this headline">&para;</a></h2>
<p>Matplotlib is the whole package; <tt class="xref docutils literal"><span
 class="pre">pylab</span></tt> is a module in matplotlib
that gets
installed alongside <a title="" class="reference external"
 href="http://matplotlib.sourceforge.net/api/matplotlib_configuration_api.html#module-matplotlib"><tt
 class="xref docutils literal"><span class="pre">matplotlib</span></tt></a>;
and <a title="" class="reference external"
 href="http://matplotlib.sourceforge.net/api/pyplot_api.html#module-matplotlib.pyplot"><tt
 class="xref docutils literal"><span class="pre">matplotlib.pyplot</span></tt></a>
is a
module in matplotlib.</p>
<p>Pyplot provides a Matlab-style state-machine interface to
the underlying object-oriented plotting library in matplotlib.</p>
<p>Pylab combines the pyplot functionality (for plotting) with the
numpy
functionality (for mathematics and for working with arrays)
in a single namespace, making that namespace
(or environment) even more Matlab-like. This is what you get if
you use the
<em>ipython</em> shell with the <em>-pylab</em> option, which imports
everything
from pylab and makes plotting fully interactive.<br>
</p>
<p>...<br>
</p>
<p>And using pyplot convenience functions, but object-orientation for
the rest:</p>
<div class="highlight-python">
<div class="highlight">
<pre><span class="k">import</span> <span class="nn">matplotlib.pyplot</span> <span
 class="k">as</span> <span class="nn">plt</span>
<span class="k">import</span> <span class="nn">numpy</span> <span
 class="k">as</span> <span class="nn">np</span>
<span class="n">x</span> <span class="o">=</span> <span class="n">np</span><span
 class="o">.</span><span class="n">arange</span><span class="p">(</span><span
 class="mf">0</span><span class="p">,</span> <span class="mf">10</span><span
 class="p">,</span> <span class="mf">0.2</span><span class="p">)</span>
<span class="n">y</span> <span class="o">=</span> <span class="n">np</span><span
 class="o">.</span><span class="n">sin</span><span class="p">(</span><span
 class="n">x</span><span class="p">)</span>
<span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span
 class="o">.</span><span class="n">figure</span><span class="p">()</span>
<span class="n">ax</span> <span class="o">=</span> <span class="n">fig</span><span
 class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span
 class="mf">111</span><span class="p">)</span>
<span class="n">ax</span><span class="o">.</span><span class="n">plot</span><span
 class="p">(</span><span class="n">x</span><span class="p">,</span> <span
 class="n">y</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span
 class="p">()</span>
</pre>
</div>
</div>
So, why do all the extra typing required as one moves away from...<br>
=========================<br>
<p><br>
</p>
<br>
<div class="moz-signature">-- <br>
My life in two words. "Interrupted Projects." -- WTW (quote originator)</div>
</body>
</html>
From: David A. <dwa...@su...> - 2010年02月06日 18:21:22
Hi Eric,
Matlab has two commands, comet and comet3, that animate the path. They are used as in the following Matlab code:
t=linspace(0,2*pi,2000);
x=-sin(t);
y=cos(t);
comet(x,y)
What then happens is the path is drawn "live", as in my python code below.
This is especially useful when teaching parametric equations in calculus. A typical question in that section might be: "find a parametrization for the unit circle that starts at (0,1) and moves around the circle one time in the counterclockwise direction." In this situation, the following is not helpful:
t=linspace(0,2*pi,2000);
x=-sin(t);
y=cos(t);
plot(x,y)
Because the student just sees sees the "finished" path. The comet command, on the other hand, allows the student to "see" that path as it is traced out in real time.
David.
On Feb 6, 2010, at 9:09 AM, Eric Firing wrote:
> David Arnold wrote:
>> All,
>> I am still wondering why there is no comet command in matplotlib. I was successful with the following:
>> import matplotlib.pyplot as plt
>> import numpy as np
>> len=200
>> t=np.linspace(0,2*np.pi,len)
>> x=np.cos(t)
>> y=np.sin(t)
>> xd=[x[0]]
>> yd=[y[0]]
>> l,=plt.plot(xd,yd)
>> plt.axis([-1,1,-1,1])
>> for i in np.arange(1,len):
>> 	xd.append(x[i])
>> 	yd.append(y[i])
>> 	l.set_xdata(xd)
>> 	l.set_ydata(yd)
>> 	plt.draw()
>> 	
>> plt.show()
>> But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython.
> 
> I don't understand--what's the point of the example? What is "comet", and how does it simplify anything?
> 
> Eric
> 
From: Eric F. <ef...@ha...> - 2010年02月06日 17:09:53
David Arnold wrote:
> All,
> 
> I am still wondering why there is no comet command in matplotlib. 
> 
> I was successful with the following:
> 
> import matplotlib.pyplot as plt
> import numpy as np
> 
> len=200
> t=np.linspace(0,2*np.pi,len)
> x=np.cos(t)
> y=np.sin(t)
> xd=[x[0]]
> yd=[y[0]]
> l,=plt.plot(xd,yd)
> plt.axis([-1,1,-1,1])
> 
> for i in np.arange(1,len):
> 	xd.append(x[i])
> 	yd.append(y[i])
> 	l.set_xdata(xd)
> 	l.set_ydata(yd)
> 	plt.draw()
> 	
> plt.show()
> 
> 
> But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython.
> 
I don't understand--what's the point of the example? What is "comet", 
and how does it simplify anything?
Eric
From: Gael V. <gae...@no...> - 2010年02月06日 15:55:55
On Sat, Feb 06, 2010 at 11:27:50AM +0100, Pierre Raybaut wrote:
> > Why not? I use Ipython on OS-X all the time, and it is fabulous, really 
> > fabulous.
> >> > Also, I would rather stick with IDLE. It is the perfect IDE for
> >> > non-CS students who shouldn't be spending their time on the
> >> > complexities of a plotting package.
> > Spyder:
> > http://packages.python.org/spyder/
> > Looks really promising, but I don't think they've got OS-X packages yet.
> > [snip]
I'd like to pitch here the reason why I think there is a huge gain in
using IPython, because I think that not everybody realizes this.
For me, the killing feature is '%debug'. It enables you to drop in the
debugger post mortem. That means that if there is an exception raised
during a calculation, I can drop right where the exception occurred and
inspect the variables there. I can for instance check if a numpy array
has NaNs, and if so where they are, or if a matrix that is supposed to be
symmetric really is. I can also go up the call stack, and see what the
variables are at each level of function calls. Here is a trivial example:
In [1]: def f(x, y=0):
 ...: z = x+y
 ...: return 1/z
 ...: 
In [2]: f(0)
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call
last)
/home/varoquau/<ipython console> in <module>()
/home/varoquau/<ipython console> in f(x, y)
ZeroDivisionError: integer division or modulo by zero
In [3]: %debug
> <ipython console>(3)f()
ipdb> print x
0
ipdb> print y
0
ipdb> print z
0
ipdb> 
Jose Unpinco has written a nice video introducing these features:
http://showmedo.com/videotutorials/video?name=7200060&fromSeriesID=720
When you start having a somewhat complex set of functions that call
each other, or when you are getting failures with somebody else's code,
this is priceless. This is so useful that to debug some code that, when I
am trying to understand why some code is not working the way it should
be, I will purposely add an exception, to be able to introspect the code.
Granted, adding pdb.set_trace() will work without IPython[*], but I find
it very useful.
I am to the point where the post-mortem debugging of IPython may be the
killing feature of Python that I lack with every other work flow. The
reason being that I develop data processing code, and that I am always
experiment and trying to implement new algorithms. As a result, my code
is seldom mature, and I often spend time tracking down where bugs lie.
Also, running my various processing steps take a while. This is why I
rely a lot on post-mortem: I find bugs after minutes or hours of number
crunching, and I want to be as efficient as possible. Post-portem enables
me not to restart the script that crashed.
My 2 cents,
Gaël
[*] It will not work in Spyder as it is quite challenging to have these
features requiring user terminal interaction in a GUI.
From: Christoph G. <cg...@uc...> - 2010年02月06日 12:53:19
Depending on the version and installer used, manually remove
C:\Python25\Lib\site-packages\pylab.py
C:\Python25\Lib\site-packages\matplotlib
C:\Python25\Lib\site-packages\mpl_toolkits
C:\Python25\Lib\site-packages\matplotlib*.egg-info
C:\Python25\Removematplotlib.exe
C:\Python25\matplotlib-wininst.log
The packages dateutil and pytz are also installed along with matplotlib
but might be used by other packages too.
Christoph
On 2/5/2010 12:11 PM, Wayne Watson wrote:
> I'm working in IDLE in Win7. It seems to me it gets stuck in 
> site-packages under C:\Python25. Maybe this is as simple as deleting the 
> entry?
> 
> Well, yes there's a MPL folder under site-packages and an info MPL file 
> of 540 bytes. There are also pylab.py, pyc,and py0 files under site. 
> What to do next?
> 
> On 2/5/2010 7:13 AM, Wayne Watson wrote:
>> I should have installed numpy first, and got some errors installing
>> MPL. I don't see an uninstall in Control Panel Add/Rmv.
>> 
> 
From: Pierre R. <co...@py...> - 2010年02月06日 10:27:26
>
> Date: 2010年2月05日 12:59:41 -0800 From: Christopher Barker 
> <Chr...@no...> Subject: Re: [Matplotlib-users] Matplotlib 
> conflicts with IDLE To: mat...@li... 
> Message-ID: <4B6...@no...> Content-Type: text/plain; 
> charset=ISO-8859-1; format=flowed David MacQuigg wrote:
>> > I can't get Matplotlib to work with IDLE. 
>> 
>
> Sorry, I don't know anything about IDLE, but...
>
> 
>> > I'm running on Mac OS-X, so it looks like IPython is not an option.
>> 
>
> Why not? I use Ipython on OS-X all the time, and it is fabulous, really 
> fabulous.
>
> 
>> > Also, I
>> > would rather stick with IDLE. It is the perfect IDE for non-CS students who
>> > shouldn't be spending their time on the complexities of a plotting package.
>> 
>
> Spyder:
>
> http://packages.python.org/spyder/
>
> Looks really promising, but I don't think they've got OS-X packages yet.
>
> -Chris
> 
Hi there,
I can confirm that Spyder will make these GUI event loop issues go away 
(BTW I saw it running on OS-X, 2 days ago -- note that it requires PyQt 
to be installed). If you are familiar with MATLAB's IDE, you won't be 
disappointed because it works almost the same way (it even communicates 
well with MATLAB thanks to .mat files import/export features).
The great advantage of Spyder over other Python IDEs is the exclusive 
"Workspace" feature: like MATLAB's workspace, that is a global variable 
explorer allowing GUI-based edition of the most used Python objects 
(integers, floats, strings, dictionaries, lists, NumPy arrays, ...). It 
seems unbelievable, but Spyder is really the only IDE providing this 
feature which is IMHO essential for scientific users.
Cheers,
Pierre
From: David A. <dwa...@su...> - 2010年02月06日 07:11:31
All,
I am still wondering why there is no comet command in matplotlib. 
I was successful with the following:
import matplotlib.pyplot as plt
import numpy as np
len=200
t=np.linspace(0,2*np.pi,len)
x=np.cos(t)
y=np.sin(t)
xd=[x[0]]
yd=[y[0]]
l,=plt.plot(xd,yd)
plt.axis([-1,1,-1,1])
for i in np.arange(1,len):
	xd.append(x[i])
	yd.append(y[i])
	l.set_xdata(xd)
	l.set_ydata(yd)
	plt.draw()
	
plt.show()
But it seems that a comet function added to the matplotlib library would greatly simplify things for students using the interactive pylab in ipython.
Any plans?
David
From: David A. <dwa...@su...> - 2010年02月06日 07:01:54
Hi,
I'm trying to get manual labeling of contours to work:
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)
plt.figure()
CS = plt.contour(X, Y, Z, 6,
 linewidths=np.arange(.5, 4, .5),
 colors=('r', 'green', 'blue', (1,1,0), '#afeeee', '0.5')
 )
plt.clabel(CS, fontsize=9, inline=1, manual=True)
plt.title('Crazy lines')
plt.show()
On my macbook, clicking with the touchpad does not seem to work.
Any ideas?
David.
From: nbv4 <cp3...@oh...> - 2010年02月06日 04:58:29
I wrote a bunch of graph scripts for creating on-the-fly line plots with
django. Since I'm running the site on a low memory VPS, I need to run apache
in multi-threaded mode, which means all my code needs to be thread-safe. I
was using Pyplot a lot, which is not thread-safe. A solution I came up with
which worked pretty well was to replace this:
import matplotlib.pyplot as plt
self.fig = plt.figure(figsize=(3.5, 2.5),)
with this:
from matplotlib.figure import Figure
self.fig = Figure(figsize=(3.5, 2.5),)
It worked like a charm on all my graphs. I have a few maps that I created
with Basemap which this method does not seem to work on. My code works
perfectly fine with the first snippet posted above, but if I change it to
the snippet below, I get this error:
File "/srv/proj/maps/states.py" in as_response
 40. return plot_png2(self.plot).__call__()
File "/srv/proj/graphs/image_formats.py" in __call__
 50. edgecolor="white")
File "/usr/lib/pymodules/python2.6/matplotlib/figure.py" in savefig
 1033. self.canvas.print_figure(*args, **kwargs)
the second item in the traceback is this line:
fig.savefig(response,
 format=self.extension,
 bbox_inches="tight",
 pad_inches=.05,
 edgecolor="white")
Any ideas on whats going on here?
-- 
View this message in context: http://old.nabble.com/matplotlib.figure-and-basemap-tp27477116p27477116.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Gary P. <gar...@gm...> - 2010年02月06日 04:46:39
On Fri, Feb 5, 2010 at 3:46 PM, David MacQuigg <mac...@ec...> wrote:
>
> I can't get Matplotlib to work with IDLE. plt.show() makes beutiful plots,
> but IDLE is hung. Entering "exit" in the little pop-up console window
> raises an exception in IDLE, and then leaves the plot window hung. It looks
> like the old "dualing event loops" problem with IDLE, although the
> Matplotlib docs don't use that phrase.
>
> The way I ususally solve this is to use IDLE for editing my scripts, and a
> separate shell to actually run them. Here, I'm not using a saved script.
> This needs to work interactively, for students using Python in a physics
> class. I see that little console window, and it sure looks like that was
> intended to do what I need, but I can't find any documentation on the
> commands. How do I switch back and forth between IDLE and the plot window
> without leaving some process in limbo? Even better, is there an option to
> have the event loop automatically switch back to IDLE after each update?
>
> I'm running on Mac OS-X, so it looks like IPython is not an option. Also, I
> would rather stick with IDLE. It is the perfect IDE for non-CS students who
> shouldn't be spending their time on the complexities of a plotting package.
There's a different version of Idle called VIdle that is supposed to
fix certain problems. I haven't a clue if yours is one of them, but
you might try it. It comes standard in VPython http://www.vpython.org
 ... I don't know if it's available separately.
>
> --
> View this message in context: http://old.nabble.com/Matplotlib-conflicts-with-IDLE-tp27473693p27473693.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Eric F. <ef...@ha...> - 2010年02月06日 02:53:40
David Goldsmith wrote:
> On Mon, Oct 6, 2008 at 10:56 AM, Eric Firing <ef...@ha... 
> <mailto:ef...@ha...>> wrote:
> 
> Christopher Barker wrote:
> 
> David Goldsmith wrote:
> 
> I feel like I must be missing something
> 
> 
> yup -- though it's an understandable miss...
> 
> 
> I think the longstanding separation between the figure.dpi and the
> savefig.dpi is a continual gotcha that we can and should eliminate.
> Savefig should use the figure dpi, so that what is saved corresponds
> to what is on the screen, unless explicitly overridden. One way to
> reduce the problem, with what I hope is an adequate level of
> backwards compatibility, would be to have the savefig.dpi default to
> a special flag setting that means "track the figure.dpi". For
> example, savefig.dpi could be the string, 'screen', by default. This
> could still be overridden by a numerical rcParams setting, or by the
> explicit dpi kwarg setting in savefig() or print_figure().
> 
> There are still other highly confusing dpi things internally--such
> as a renderer.dpi setting that is ignored during rendering.
> 
> Comments?
> 
> 
> This appears to have never been "fixed" (though I see no opposition 
> expressed looking back at the original thread in the archive) - having 
> forgotten about it and the fact that, at the time, it sent me running to 
> PIL, I got bitten by it again (luckily I had a vague recollection of 
> this thread before posting the same problem again and making a complete 
> ass outta myself). I'm not sure if I have the bleeding edge version of 
> MPL, but as I'm now working on the second different computer I've had 
> since the OP, I'm pretty sure I'm running a later version than I was 
> back then. Did this issue ever mature into a ticket?
> 
Not that I know of. I never got back to it, and I don't think anyone 
else did, either.
Eric
> DG
> 
> 
> 
> Eric
> 
> 
> 
> 
> Attached are the results on my computer (see usage details
> below).
> Granted, I'm increasing the resolution each iteration,
> 
> 
> you are increasing the resolution of the figure, and of your
> calculations, but NOT of the output image. The hint was that
> every image was the same size: 1200X900 , which is 12"x9" at 100
> dpi.
> 
> It turns out that print_figure() doesn't respect the figures
> (native DPI), it defaults to 100 dpi, but you can override it:
> 
> > canvas.print_figure("test"+str(DPI)+"dpi.png", dpi=DPI)
> 
> Then you'll get what I think you want.
> 
> Maybe this will help:
> 
> http://www.scipy.org/Cookbook/Matplotlib/AdjustingImageSize
> 
> though it there, I talked about Figure.savefig(). I don't know
> if there is a difference between that and Figure.print_figure()
> 
> -Chris
> 
From: Michiel de H. <mjl...@ya...> - 2010年02月06日 01:29:08
This is not a matplotlib problem but an issue with Python itself. Unlike for example Tcl/Tk, Python does not have support for event loops. Each of the graphics backends (Tkinter, PyGTK, PyQT, the Mac OS X native backend) therefore each implement an event loop on their own. In general, these will clash with each other. Even IDLE's event loop (IDLE uses Tkinter) does not play nice with Tkinter itself: import Tkinter; Tkinter.Tk() opens a Tk window when run from the console, but does nothing when run from IDLE. Until Python itself supports event loops, I doubt that these problems will go away. I believe that ipython has made some progress in addressing these issues, but that of course won't help people who use regular python instead of ipython.
--Michiel.
--- On Fri, 2/5/10, David MacQuigg <mac...@ec...> wrote:
> From: David MacQuigg <mac...@ec...>
> Subject: [Matplotlib-users] Matplotlib conflicts with IDLE
> To: mat...@li...
> Date: Friday, February 5, 2010, 3:46 PM
> 
> I can't get Matplotlib to work with IDLE. plt.show()
> makes beutiful plots,
> but IDLE is hung. Entering "exit" in the little
> pop-up console window
> raises an exception in IDLE, and then leaves the plot
> window hung. It looks
> like the old "dualing event loops" problem with IDLE,
> although the
> Matplotlib docs don't use that phrase.
> 
> The way I ususally solve this is to use IDLE for editing my
> scripts, and a
> separate shell to actually run them. Here, I'm not
> using a saved script. 
> This needs to work interactively, for students using Python
> in a physics
> class. I see that little console window, and it sure
> looks like that was
> intended to do what I need, but I can't find any
> documentation on the
> commands. How do I switch back and forth between IDLE
> and the plot window
> without leaving some process in limbo? Even better,
> is there an option to
> have the event loop automatically switch back to IDLE after
> each update?
> 
> I'm running on Mac OS-X, so it looks like IPython is not an
> option. Also, I
> would rather stick with IDLE. It is the perfect IDE
> for non-CS students who
> shouldn't be spending their time on the complexities of a
> plotting package.
> 
> -- 
> View this message in context: http://old.nabble.com/Matplotlib-conflicts-with-IDLE-tp27473693p27473693.html
> Sent from the matplotlib - users mailing list archive at
> Nabble.com.
> 
> 
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage,
> colocation
> Stay online with enterprise data centers and the best
> network in the business
> Choose flexible plans and management services without
> long-term contracts
> Personal 24x7 support from experience hosting pros just a
> phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
 

Showing 22 results of 22

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