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

Showing results of 208

<< < 1 2 3 4 .. 9 > >> (Page 2 of 9)
From: Caleb C. <cad...@gm...> - 2011年04月26日 13:32:55
On Thu, Apr 21, 2011 at 2:07 PM, Michael Droettboom <md...@st...> wrote:
> Ok. I think I've found a leak in the way the spines' paths were being
> updated.
>
> https://github.com/matplotlib/matplotlib/pull/89
>
> Can you apply the patch there and let me know how it improves things for
> you?
>
> Cheers,
> Mike
>
I applied the patch and (at least for a short run), it seems the leak
for wxagg has been fixed. The new results for wxagg is pretty much the
same as the old results for tkagg (which does not have the leak): a
plot of memory usage is very irregular (up and down), but a line fit
has a slope of about 0.009KB. I suspect if I ran this for a few hours
the slope would approach 0 KB.
Thanks so much!! This is a life saver for my project!
Caleb
From: Michael D. <md...@st...> - 2011年04月25日 22:21:43
Currently it's hardcoded. You can see it in this line in backend_pdf.py:
https://github.com/matplotlib/matplotlib/blob/9ca2c4118f684b4e145bd109008f77731d2d7cd4/lib/matplotlib/backends/backend_pdf.py#L1061
You could change that line.
However, long term, I think we need to add a hatch_line_width kwarg to 
artists -- and perhaps further (though this would break backward 
compatibility) separate out the edge color from the hatch line color, so 
one could have (for example) a black rectangle filled with red hatching 
(not currently possible without layering objects).
Cheers,
Mike
On 04/25/2011 04:21 PM, T J wrote:
> On Mon, Apr 25, 2011 at 1:15 PM, T J<tj...@gm...> wrote:
>> I am using the PDF backend and specifying a hatch for a fill_between()
>> call. The resultant PDF looks okay, but the hatch lines are too
>> light.
>>
>> Is there a way to darken them? Also, is it possible to change the
>> color of the hatch lines? I'm okay solutions that are low-level hacks.
>> I just need the PDF to have proper hatches.
>>
> I can change their color by specifying 'edgecolor' to PathPatch, but
> their intensity is still too low. :(
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Xavier G. <xav...@gm...> - 2011年04月25日 21:25:36
On 04/23/2011 03:19 AM, Paul Ivanov wrote:
> Hi Xavier,
>
> Xavier Gnata, on 2011年04月23日 02:33, wrote:
>> Imagine you have this code:
>>
>> import numpy as np
>> import matplotlib.cm as cm
>> import matplotlib.mlab as mlab
>> import matplotlib.pyplot as plt
>>
>> delta = 0.25
>> x = y = np.arange(-3.0, 3.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)
>> Z = Z2-Z1 # difference of Gaussians
>>
>> plt.imshow(Z, interpolation='nearest', cmap=cm.gray, origin='lower', extent=[-3,3,-3,3])
>> Then you want to change the color of a few pixels to red.
>> You have a list of coordinates (i,j) and each pixel in this list should
>> now be red.
>>
>> I could play with masked arrays like in:
>> http://matplotlib.sourceforge.net/examples/pylab_examples/image_masked.html
>> but I would prefer a simple "display this pixel (i,j) in red whatever
>> his value is" function.
> Since you're using a gray color map for that image, you won't be
> able to set a particular pixel to red. You'll have to either
> overlay a new image that would be masked out everywhere except
> for the pixels you want to change, as you mentioned, or create
> new image patches at the corresponding positions like this:
>
> idx2im = lambda i,j: (x[i],x[j+1],y[i],y[j+1] )
> plt.imshow([[.9]], extent=idx2im(12,12), cmap =cm.jet, origin='lower',vmin=0,vmax=1)
>
> or something like this:
>
> plt.Rectangle((x[10],y[10]),width=delta,height=delta,color='red')
> ax = plt.gca()
> ax.add_artist(r)
> plt.draw()
>
>
> best,
Thanks. The code using "Rectangle" works very well.
Using masks is more efficient but overshoot if I want to change only a 
few pixels.
Xavier
From: T J <tj...@gm...> - 2011年04月25日 20:21:41
On Mon, Apr 25, 2011 at 1:15 PM, T J <tj...@gm...> wrote:
> I am using the PDF backend and specifying a hatch for a fill_between()
> call. The resultant PDF looks okay, but the hatch lines are too
> light.
>
> Is there a way to darken them? Also, is it possible to change the
> color of the hatch lines? I'm okay solutions that are low-level hacks.
> I just need the PDF to have proper hatches.
>
I can change their color by specifying 'edgecolor' to PathPatch, but
their intensity is still too low. :(
From: T J <tj...@gm...> - 2011年04月25日 20:15:26
I am using the PDF backend and specifying a hatch for a fill_between()
call. The resultant PDF looks okay, but the hatch lines are too
light.
Is there a way to darken them? Also, is it possible to change the
color of the hatch lines? I'm okay solutions that are low-level hacks.
 I just need the PDF to have proper hatches.
From: Goyo <goy...@gm...> - 2011年04月23日 23:01:15
2011年4月23日 _olivier_ <ol...@gm...>:
> [...]
> I have got a matrix 6x500 (so one size is much biggger than the other one)
> and I try to expand the shorter axe so that the labels on it are well
> displayed (not overlapped.
Use the aspect kwarg in matshow.
Goyo
From: _olivier_ <ol...@gm...> - 2011年04月23日 21:07:22
Not sure this message was sent successfully. So I send it again. Sorry if you
receive it twice...
Hello,
This question has certainly been answered in a previous thread but after
searching around I did not find any solution...
I have got a matrix 6x500 (so one size is much biggger than the other one)
and I try to expand the shorter axe so that the labels on it are well
displayed (not overlapped.
I am googling/searching on the documentation about subplots_adjust, ... but
did not find any solution.
Here is the code that present the problem I have.
Thanks in advance for any help. Olivier
import numpy as np
from matplotlib.pylab import *
import matplotlib.pyplot as plt
sizeX = 6
sizeY = 500
xlabels = []
ylabels = []
for i in range ( 0, sizeX ):
 xlabels.append( str( i ) )
for i in range ( 0, sizeY ):
 ylabels.append( str( i ) )
dims = ( sizeX, sizeY )
data = zeros( dims )
for i in range( 0, sizeX ):
 for j in range( 0, sizeY ):
 data[ i, j ] = np.random.rand()
figure = plt.figure()
axes = figure.add_subplot( 111 )
cax = axes.matshow( data, interpolation = 'nearest' )
col = figure.colorbar( cax )
plt.show()
-- 
View this message in context: http://old.nabble.com/Try-to-have-none-overlapping-labels-in-one-axe-using-matshow-tp31456159p31456159.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Goyo <goy...@gm...> - 2011年04月23日 12:42:13
Attachments: sample.py sample.png
2011年4月23日 jfortiv <jf...@gm...>:
>
> Hi,
>
> This actually did not work for me. Can you show me the full code that you
> used to successfully produce the time-format x-axis labels?
See attached files.
Goyo
From: jfortiv <jf...@gm...> - 2011年04月23日 08:48:24
Hi,
This actually did not work for me. Can you show me the full code that you
used to successfully produce the time-format x-axis labels?
Thanks,
James
Sebastian Berg wrote:
> 
> Hello,
> 
> don't know the foo behind it, but using
> ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d %H:%M:%S'))
> works.
> 
> Regards,
> 
> Sebastian
> 
> On Sun, 2011年04月17日 at 19:52 -0700, jfortiv wrote:
> 
>> Hello, 
>> 
>> I'm trying to create a bar chart that looks something like a gannt
>> chart...
>> 
>> See the simple example here:
>> 
>> http://www.promana.net/making-use-of-gantt-charts/
>> 
>> I'm trying to utilize barh() and fmt_xdata to accomplish this with the
>> following:
>> 
>> #~~~~~~~~~~~~~~~~~~~~~~~
>> 
>> date1 = datetime.datetime( 2000, 3, 2)
>> date2 = datetime.datetime( 2000, 3, 6)
>> delta = datetime.timedelta(hours=6)
>> dates = mdates.drange(date1, date2, delta)
>> 
>> val = mdates.drange(date1,date2,delta) # the bar lengths
>> pos = range(len(val)) # the bar centers on the y axis
>> height=0.5 # the bar height
>> left=mdates.drange(date1,date2,delta) # the bar starting position
>> 
>> fig = plt.figure()
>> ax = fig.add_subplot(111)
>> ax.barh(pos,val,height=height,left=left,align='center',alpha=0.3)
>> ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d %H:%M:%S')
>> 
>> #~~~~~~~~~~~~~~~~~~~~~~~
>> 
>> 
>> Even with ax.fmt_xdata, I'm simply getting numbers on the x-axis instead
>> of
>> dates. Can anyone offer some pointers?
>> 
>> Thanks,
>> James
> 
> 
> 
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload 
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve 
> application availability and disaster protection. Learn more about
> boosting 
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Date-format-the-x-axis-of-a-barh%28%29-plot--tp31420395p31460691.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Paul I. <piv...@gm...> - 2011年04月23日 01:19:17
Hi Xavier,
Xavier Gnata, on 2011年04月23日 02:33, wrote:
> Imagine you have this code:
> 
> import numpy as np
> import matplotlib.cm as cm
> import matplotlib.mlab as mlab
> import matplotlib.pyplot as plt
> 
> delta = 0.25
> x = y = np.arange(-3.0, 3.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)
> Z = Z2-Z1 # difference of Gaussians
> 
> plt.imshow(Z, interpolation='nearest', cmap=cm.gray, origin='lower', extent=[-3,3,-3,3])
> Then you want to change the color of a few pixels to red.
> You have a list of coordinates (i,j) and each pixel in this list should 
> now be red.
> 
> I could play with masked arrays like in:
> http://matplotlib.sourceforge.net/examples/pylab_examples/image_masked.html
> but I would prefer a simple "display this pixel (i,j) in red whatever 
> his value is" function.
Since you're using a gray color map for that image, you won't be
able to set a particular pixel to red. You'll have to either
overlay a new image that would be masked out everywhere except
for the pixels you want to change, as you mentioned, or create
new image patches at the corresponding positions like this:
 idx2im = lambda i,j: (x[i],x[j+1],y[i],y[j+1] )
 plt.imshow([[.9]], extent=idx2im(12,12), cmap =cm.jet, origin='lower',vmin=0,vmax=1)
or something like this:
 plt.Rectangle((x[10],y[10]),width=delta,height=delta,color='red')
 ax = plt.gca()
 ax.add_artist(r)
 plt.draw()
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Xavier G. <xav...@gm...> - 2011年04月23日 00:33:29
Hi,
Imagine you have this code:
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
delta = 0.25
x = y = np.arange(-3.0, 3.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)
Z = Z2-Z1 # difference of Gaussians
plt.imshow(Z, interpolation='nearest', cmap=cm.gray, origin='lower', extent=[-3,3,-3,3])
Then you want to change the color of a few pixels to red.
You have a list of coordinates (i,j) and each pixel in this list should 
now be red.
I could play with masked arrays like in:
http://matplotlib.sourceforge.net/examples/pylab_examples/image_masked.html
but I would prefer a simple "display this pixel (i,j) in red whatever 
his value is" function.
Xavier
From: Michael S. <elm...@gm...> - 2011年04月22日 20:00:17
Great, thanks for the fix, works great now!
--Michael
On Fri, Apr 22, 2011 at 2:17 PM, Goyo <goy...@gm...> wrote:
> 2011年4月22日 Michael Schmidt <elm...@gm...>:
>> Hi Everyone,
>>
>> I'm running into a problem with updating a plot that I've embedded into a Tk
>> application. [...] I'd like the plot to
>> refresh when the button is clicked
>
> pyplot.draw() does not work here (I don't know if this is intended
> behavoir of pyplot, but it makes some sense). Using canvas.draw()
> fixes your program in my mpl setup.
>
> Goyo
>
From: Goyo <goy...@gm...> - 2011年04月22日 19:17:22
2011年4月22日 Michael Schmidt <elm...@gm...>:
> Hi Everyone,
>
> I'm running into a problem with updating a plot that I've embedded into a Tk
> application. [...] I'd like the plot to
> refresh when the button is clicked
pyplot.draw() does not work here (I don't know if this is intended
behavoir of pyplot, but it makes some sense). Using canvas.draw()
fixes your program in my mpl setup.
Goyo
From: Eric F. <ef...@ha...> - 2011年04月22日 19:13:09
On 04/22/2011 06:47 AM, Paul Ivanov wrote:
> Jason Heeris, on 2011年04月23日 00:29, wrote:
>> On 22 April 2011 03:56, Paul Ivanov<piv...@gm...> wrote:
>>> Thanks for the report, Jason. It's a bug - could you please file
>>> a bug report, so we can keep track of it?
>>
>> Will do, thanks for the workarounds :)
>>
>>> or if it's an option, use gtkagg, which doesn't suffer from the crash.
>>>
>>> from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
>>> as FigureCanvasGTK
>>
>> Just out of interest, what's the difference between GTK and GTKAgg?
>
> The FAQ has a nice summary:
>
> The canonical renderer for user interfaces is Agg which uses the
> Anti-Grain Geometry C++ library to make a raster (pixel) image of
> the figure. All of the user interfaces can be used with agg
> rendering, eg WXAgg, GTKAgg, QTAgg, TkAgg, CocoaAgg. In addition,
> some of the user interfaces support other rendering engines. For
> example, with GTK, you can also select GDK rendering (backend
> GTK) or Cairo rendering (backend GTKCairo).
>
> http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend
>
> There are also two tables at the end of that answer which list
> the renderers, and the user interface + renderer combinations.
Note that the gtk and wx backends (that is, no Agg) are not recommended. 
 They are not well maintained and may have various limitations and 
bugs. Their only potential advantage, as far as I know, is that they 
involve less network traffic when working remotely via X.
Eric
>
> best,
From: Paul I. <piv...@gm...> - 2011年04月22日 16:47:22
Jason Heeris, on 2011年04月23日 00:29, wrote:
> On 22 April 2011 03:56, Paul Ivanov <piv...@gm...> wrote:
> > Thanks for the report, Jason. It's a bug - could you please file
> > a bug report, so we can keep track of it?
> 
> Will do, thanks for the workarounds :)
> 
> > or if it's an option, use gtkagg, which doesn't suffer from the crash.
> >
> > from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
> > as FigureCanvasGTK
> 
> Just out of interest, what's the difference between GTK and GTKAgg?
The FAQ has a nice summary:
 The canonical renderer for user interfaces is Agg which uses the
 Anti-Grain Geometry C++ library to make a raster (pixel) image of
 the figure. All of the user interfaces can be used with agg
 rendering, eg WXAgg, GTKAgg, QTAgg, TkAgg, CocoaAgg. In addition,
 some of the user interfaces support other rendering engines. For
 example, with GTK, you can also select GDK rendering (backend
 GTK) or Cairo rendering (backend GTKCairo).
http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend
There are also two tables at the end of that answer which list
the renderers, and the user interface + renderer combinations.
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2011年04月22日 16:29:41
On 22 April 2011 03:56, Paul Ivanov <piv...@gm...> wrote:
> Thanks for the report, Jason. It's a bug - could you please file
> a bug report, so we can keep track of it?
Will do, thanks for the workarounds :)
> or if it's an option, use gtkagg, which doesn't suffer from the crash.
>
> from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
> as FigureCanvasGTK
Just out of interest, what's the difference between GTK and GTKAgg?
— Jason
From: Michael S. <elm...@gm...> - 2011年04月22日 04:25:12
Attachments: embed_test.py
Hi Everyone,
I'm running into a problem with updating a plot that I've embedded
into a Tk application. I'm attaching the code with this email (and
pasting it at the end, in a hopefully un-gmail-formatted-form). This
is a very simple program, with one canvas embedded into a window, with
one menu and one button Tk widgets that I'm using to select what plot
type to display. The data are x, y, and t variables, with x and y
given by cos(2*pi*t) and sin(2*pi*t) respectively. I'd like to be
able to switch between a single scatter plot and two x(t) and y(t)
plots. The program "works" in that when you resize the window, the
plot updates, however, this really isn't workable. I'd like the plot
to refresh right when the button is clicked, and I can't seem to get
it to work, nor could I find support in previous email archives.
It seems like the trick used for animations, that is, only calling
'plot' once and simply changing the xdata and ydata values of the line
would speed things up significantly, so I've implemented that in the
code, but it doesn't help.
Any help would be much appreciated! Thanks in advance.
--Michael
#!/usr/bin/env python
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as P
import matplotlib.mlab as M
import matplotlib
import numpy as N
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg as FigureCanvas
from matplotlib.backends.backend_tkagg import NavigationToolbar2TkAgg
as NavigationToolbar
from matplotlib.figure import Figure
from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter
from matplotlib.widgets import Button as mButton
from matplotlib.widgets import CheckButtons
import os, sys, Tkinter
import tkFileDialog
import Tkconstants as Tkc
t = N.linspace(0, 10, 1e3)
x = N.cos(2*N.pi*t)
y = N.sin(2*N.pi*t)
class window(Tkinter.Tk):
 def __init__(self, parent):
 Tkinter.Tk.__init__(self, parent)
 self.protocol('WM_DELETE_WINDOW', self._kill)
 self._create_widgets()
 def _kill(self):
 self.destroy()
 sys.exit()
 def _create_widgets(self):
 self._create_canvas()
 self._create_toolbar()
 self._create_menu()
 return
 def _create_toolbar(self):
 self.toolbar = NavigationToolbar(self.canvas, self)
 self.toolbar.update()
 self.canvas._tkcanvas.pack()
 #self.toolbar.pack()
 return
 def _create_canvas(self):
 self.fig = P.figure()
 self.fig = P.figure(figsize=(7,7))
 self.axes = []
 self.axes.append( self.fig.add_subplot(111) )
 self.axes.append( self.fig.add_subplot(211) )
 self.axes.append( self.fig.add_subplot(212) )
 self.axes[0].set_visible(True)
 self.axes[1].set_visible(False)
 self.axes[2].set_visible(False)
 self.lines = []
 self.lines.append( self.axes[0].plot([0.],[0.], '.')[0] )
 self.lines.append( self.axes[1].plot([0.],[0.], '.')[0] )
 self.lines.append( self.axes[2].plot([0.],[0.], '.')[0] )
 self.fig.subplots_adjust(bottom=0.175)
 self.frame = Tkinter.Frame(self)
 self.frame.pack(padx=0, pady=0)
 self.canvas = FigureCanvas(self.fig, master=self.frame)
 self.canvas.show()
 self.canvas.get_tk_widget().pack(side='top', fill='both')
 #self.canvas._tkcanvas.pack(side='top', fill='both', expand=1)
 return
 def _plot_it(self):
 print "hello"
 print "which_one: ", self.menu_val.get()
 if self.menu_val.get() == self.items[0]:
 print "in one"
 self.axes[0].set_visible(True)
 self.axes[1].set_visible(False)
 self.axes[2].set_visible(False)
 self.lines[0].set_xdata(x)
 self.lines[0].set_ydata(y)
 self.axes[0].set_xlabel('x')
 self.axes[0].set_ylabel('y')
 self.axes[0].set_xlim([min(x), max(x)])
 self.axes[0].set_ylim([min(y), max(y)])
 print "x: ", N.min(x), N.max(x)
 print "y: ", N.min(y), N.max(y)
 P.draw()
 else:
 self.axes[0].set_visible(False)
 self.axes[1].set_visible(True)
 self.axes[2].set_visible(True)
 self.lines[1].set_xdata(t)
 self.lines[1].set_ydata(x)
 self.lines[2].set_xdata(t)
 self.lines[2].set_ydata(x)
 self.axes[1].set_ylabel('x(t)')
 self.axes[1].set_xlim([N.min(t), N.max(t)])
 self.axes[1].set_ylim([N.min(x), N.max(x)])
 self.axes[2].set_ylabel('y(t)')
 self.axes[2].set_xlim([N.min(t), N.max(t)])
 self.axes[2].set_ylim([N.min(y), N.max(y)])
 self.axes[2].set_xlabel('t')
 P.draw()
 def _create_menu(self):
 self.items = ['scatter', 'strip']
 self.menu_val = Tkinter.StringVar()
 self.menu_val.set(self.items[0])
 self.button_menu_frame = Tkinter.Frame(self)
 def click(): print "click!"
 self.button = Tkinter.Button(self.button_menu_frame,
text='plot', command=self._plot_it)
 self.button.pack(side='top', ipadx=63, fill='both')
 self.menu_frame = Tkinter.Frame(self.button_menu_frame)
 #self.menu_frame.pack(side='left', ipadx=20, expand=1, fill='both')
 self.menu = Tkinter.OptionMenu(self.menu_frame, self.menu_val,
*self.items)
 self.menu.pack(side='left', anchor=Tkc.SW, ipadx=20, expand=1,
fill='both')
 self.menu_frame.pack(side='top', fill='both')
 self.button_menu_frame.pack(side='left', fill='both')
 return
if __name__ == "__main__":
 app = window(None)
 app.title('Analysis')
 #app.pack_propegate(0)
 app.mainloop()
From: Paul I. <piv...@gm...> - 2011年04月21日 19:56:47
Jason Heeris, on 2011年04月21日 12:23, wrote:
> I'm playing around with using Matplotlib in my PyGTK app, and keep
> triggering a crash. I've narrowed it down to this bit of code:
... 
> Am I doing something obviously wrong? (Apart from the lack of plots, I
> mean... I removed them because they didn't change the behaviour.)
Thanks for the report, Jason. It's a bug - could you please file
a bug report, so we can keep track of it? 
It looks like this gets triggered by the fact that the ylabel is
being clipped. I don't have time to look into this further, but
here are two workaround for you. Either do:
 figure.subplotpars.right=.8 # make smaller if still crashes
or if it's an option, use gtkagg, which doesn't suffer from the crash.
 from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
as FigureCanvasGTK
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Daniel W. <dan...@gm...> - 2011年04月21日 19:56:30
While trying to recreate this outside of my work code, I found that I cannot
do it in a simple manner- that is, just creating a ton of points and
plotting them doesn't reproduce the problem. I'm going to revisit this and
make sure it isn't a problem in my working program versus what I thought it
was, e.g. some sort of drawing limitation.
FYI, I get this using the Qt4Agg backend and am using MPL 1.0.1
-dw
From: Michael D. <md...@st...> - 2011年04月21日 16:57:24
The repository is now on github, so if you want the very latest, you 
should get it from here:
https://github.com/matplotlib/matplotlib
(We haven't done a terribly good job of advertising that change).
I'm not seeing any leak myself with your script with matplotlib HEAD 
plus this pull request:
https://github.com/matplotlib/matplotlib/pull/89
so we may be getting to the bottom of this type of leak.
Mike
On 04/20/2011 05:18 PM, Oren Gampel wrote:
> I have now tested this with version 1.1.0svn from the trunk of the dev 
> repository. I believe this version contains Michael Droettboo's patch 
> for pyCXX. ( 
> https://sourceforge.net/tracker/index.php?func=detail&aid=3115633&group_id=3180&atid=103180 
> <https://sourceforge.net/tracker/index.php?func=detail&aid=3115633&group_id=3180&atid=103180> 
> )
>
> Unfortunately the leak is still evident in the small script I've 
> attached. Again, please note that this script has no axes, plots, or 
> drawn components, only an empty canvas that is being redrawn and 
> causes the memory growth.
>
> Any ideas how to resolve this or further debug this?
>
> Thanks for your help,
> Oren
>
> On Mon, Apr 11, 2011 at 6:37 PM, Oren Gampel <or...@fu... 
> <mailto:or...@fu...>> wrote:
>
> I'm having a memory leakage using matplotlib 1.0.1 with wx
> 2.8.11.0, on windows XP.
>
> To reproduce, I used the sample from here:
> http://matplotlib.sourceforge.net/examples/animation/dynamic_image_wxagg2.html
> and deleted most of the significant lines (see below). I only
> create a canvas but I don't create any axes, nor plot any data.
> The only thing I do is draw() on a timer event. This makes my
> process grow about 6Mbyte per minute.
>
> Is this reproduced in other environments? Any ideas on how to
> resolve this?
>
> Thanks,
> Oren
>
>
> """
> Copyright (C) 2003-2005 Jeremy O'Donoghue and others
>
> License: This work is licensed under the PSF. A copy should be
> included
> with this source code, and is also available at
> http://www.python.org/psf/license.html
>
> """
> import sys, time, os, gc
>
> import matplotlib
> matplotlib.use('WXAgg')
>
> from matplotlib import rcParams
> import numpy as npy
>
> import matplotlib.cm <http://matplotlib.cm> as cm
>
> from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
> from matplotlib.backends.backend_wx import NavigationToolbar2Wx
>
> from matplotlib.figure import Figure
> from wx import *
>
>
> TIMER_ID = NewId()
>
> class PlotFigure(Frame):
>
> def __init__(self):
> Frame.__init__(self, None, -1, "Test embedded wxFigure")
>
> self.fig = Figure((1,1), 50, facecolor='.95')
> self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
> # Now put all into a sizer
> sizer = wx.BoxSizer(wx.VERTICAL)
> # This way of adding to sizer allows resizing
> sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW)
> self.SetSizer(sizer)
> self.Fit()
>
> self._price_ax = self.fig.add_subplot(111)
>
>
> wx.EVT_TIMER(self, TIMER_ID, self.onTimer)
> self.t = wx.Timer(self, TIMER_ID)
> self.t.Start(1000)
>
> def onTimer(self, evt):
> self.canvas.draw()
>
>
> if __name__ == '__main__':
> app = PySimpleApp()
> frame = PlotFigure()
> # Initialise the timer - wxPython requires this to be connected to
> # the receiving event handler
> t = Timer(frame, TIMER_ID)
> t.Start(100)
>
> frame.Show()
> app.MainLoop()
>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Junghun S. <jh...@ef...> - 2011年04月21日 16:50:39
Hi, everyone.
Let me explain what I wanted to do: First, I wanted to make a polar
plot with angles from 0 to 90. I could do it by adopting the
curvelinear grid demo ( http://goo.gl/kruXf ). And then I wanted to
present the radius in log10 scale. But setting the plot command to
semilogy or trying to set 'set_rscale('log')' all failed. Below I
pasted the code that works for radius in linear scale.
[Code]
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
#Modified from http://matplotlib.sourceforge.net/plot_directive/mpl_toolkits/axes_grid/examples/demo_floating_axis.py
#def curvelinear_test2(fig, lp_r, lp_t):
def curvelinear_test2(fig, lp_t, lp_r, rLower, rUpper):
 rmin = np.min(lp_r)
 rmax = np.max(lp_r)
 print 'rm: ', rmin, 'rM: ', rmax,'rL: ', rLower, 'rU: ', rUpper
 """
 polar projection, but in a rectangular box.
 """
 global ax1
 import mpl_toolkits.axisartist.angle_helper as angle_helper
 from matplotlib.projections import PolarAxes
 from matplotlib.transforms import Affine2D
 from mpl_toolkits.axisartist import SubplotHost, ParasiteAxesAuxTrans
 from mpl_toolkits.axisartist import GridHelperCurveLinear
 from mpl_toolkits.axisartist.grid_helper_curvelinear import
GridHelperCurveLinear
 # see demo_curvelinear_grid.py for details
 tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform()
 extreme_finder = angle_helper.ExtremeFinderCycle(20, 20,
 lon_cycle = 360,
 lat_cycle = None,
 lon_minmax = (0, 360),
 lat_minmax =
(-np.inf, np.inf),
 #lat_minmax =
(rmin, np.inf),
 )
 grid_locator1 = angle_helper.LocatorDMS(12)
 tick_formatter1 = angle_helper.FormatterDMS()
 grid_helper = GridHelperCurveLinear(tr,
 extreme_finder=extreme_finder,
 grid_locator1=grid_locator1,
 tick_formatter1=tick_formatter1
 )
 ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper)
 fig.add_subplot(ax1)
 # make ticklabels of all axis visible.
 ax1.axis[:].major_ticklabels.set_visible(True)
 #ax1.axis["top"].major_ticklabels.set_visible(True)
 #ax1.axis["left"].major_ticklabels.set_visible(True)
 #ax1.axis["bottom"].major_ticklabels.set_visible(True)
 # show angle (0) at right and top
 ax1.axis["right"].get_helper().nth_coord_ticks=0
 ax1.axis["top"].get_helper().nth_coord_ticks=0
 # show radius (1) at left and bottom
 ax1.axis["left"].get_helper().nth_coord_ticks=1
 ax1.axis["bottom"].get_helper().nth_coord_ticks=1
 # set labels
 ax1.axis["left"].label.set_text(r'ylabel')
 ax1.axis["bottom"].label.set_text(r'xlabel')
 ax1.axis["bottom"].major_ticklabels.set_rotation(-30)
 ax1.set_aspect(1.)
 ax1.set_xlim(rLower, rUpper)
 ax1.set_ylim(rLower, rUpper)
 #ax1.rscale('log')
 # A parasite axes with given transform
 ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal")
 # note that ax2.transData == tr + ax1.transData
 # Anthing you draw in ax2 will match the ticks and grids of ax1.
 ax1.parasites.append(ax2)
 ax2.plot(lp_t, lp_r, 'o-')
 #ax2.semilogy(lp_t, lp_r, 'o-')
 #ax2.set_rscale('log')
 #ax1.set_xscale('log')
 #ax1.set_yscale('log')
 ax1.grid(True)
if __name__ == "__main__":
 fig = plt.figure(1, figsize=(5, 5))
 fig.clf()
 rmin = 1e-1
 rmax = 1e2
 lp_t = np.linspace(0., 90., 5)
 lp_r = np.linspace(rmin, rmax/10, 5)*5
 print "lp_t: ", lp_t
 print "lp_r: ", lp_r
 print "log10(lp_r): ", np.log10(lp_r)
 curvelinear_test2(fig, lp_t, lp_r, rmin, rmax)
 #curvelinear_test2(fig, lp_t, np.log10(lp_r), np.log10(rmin), np.log(rmax))
 plt.show()
[/Code]
I'm using Enthought Python Distribution Version: 7.0-2 (32-bit) Python
2.7.1 on win32
and matplotlib.__version__ is '1.0.1'.
Thanks,
Junghun Shin
--
Division of Electrical, Electronic and Information Engineering,
Graduate School of Engineering, Osaka University,
2-6 Yamada-oka, Suita-shi, Osaka, 565-0871, JAPAN
Tel / Fax: +81-6-6879-8755
E-mail: jh...@ef...
Group Homepage: http://www.eie.eng.osaka-u.ac.jp/ef/
From: John H. <jd...@gm...> - 2011年04月21日 16:38:18
On Thu, Apr 21, 2011 at 11:22 AM, Michael Droettboom <md...@st...> wrote:
> There is no hard coded limit to the number of quads in a pcolormesh.
> (Unlike the limit of the number of points in a path in the Agg backend).
> Can you provide some code that reproduces the error?
>
> Also, which version of matplotlib, platform and backend are you using?
Is this potentially a path.simplify issue? If you set path.simplify
to False in your rc params, does the problem go away?
 import matplotlib
 matplotlib.rcParams['path.simplify'] = False
In older versions of matplotlib, there was a bug in path.simplify that
caused it to simplify paths to the point where it caused perceptual
problems. The current path.simplify is not supposed to produce
detectable changes, so as Michael said please include your mpl version
in your response.
JDH
From: Michael D. <md...@st...> - 2011年04月21日 16:37:25
Ok. I think I've found a leak in the way the spines' paths were being 
updated.
https://github.com/matplotlib/matplotlib/pull/89
Can you apply the patch there and let me know how it improves things for 
you?
Cheers,
Mike
On 04/21/2011 08:35 AM, Caleb Constantine wrote:
> On Wed, Apr 20, 2011 at 1:04 PM, Michael Droettboom<md...@st...> wrote:
> 
>> On 04/20/2011 11:27 AM, Caleb Constantine wrote:
>> 
>>> On Wed, Apr 20, 2011 at 9:29 AM, Michael Droettboom<md...@st...> wrote:
>>> 
>>>> On 04/20/2011 07:48 AM, Caleb Constantine wrote:
>>>> 
>>>>> On Tue, Apr 19, 2011 at 2:25 PM, Michael Droettboom<md...@st...> wrote:
>>>>> 
>>>>>> Ok. I have a RHEL5 Linux box with Python 2.7.1.
>>>>>>
>>>>>> With Numpy 1.4.1 and 1.5.1 I don't see any leaks. With Numpy git HEAD,
>>>>>> I did see a leak -- I submitted a pull request to Numpy here:
>>>>>>
>>>>>> https://github.com/numpy/numpy/pull/76
>>>>>>
>>>>>> I get the same results (no leaks) running your wx, tk and agg scripts
>>>>>> (with the Windows-specific stuff removed).
>>>>>>
>>>>>> FWIW, I have wxPython 2.8.11.0 and Tkinter rev 81008.
>>>>>>
>>>>>> So the variables are the platform and the version of Python. Perhaps
>>>>>> it's one of those two things?
>>>>>>
>>>>>> Mike
>>>>>> 
>>>>> Consider the following:
>>>>>
>>>>> matplotlib 1.0.1, numpy 1.5.1, python 2.7.1, wxPython 2.8.11.0,
>>>>> Windows XP SP3
>>>>>
>>>>> - 1 hour
>>>>> - Plotted 3601 times, about 1Hz
>>>>> - Memory usage increased by about 1.16MB (41.39 - 40.23), or
>>>>> about 0.33K per redraw
>>>>>
>>>>> It seems the same memory leak exists. Given you don't have this issue
>>>>> on Linux with the same Python configuration, I can only assume it is
>>>>> related to some Windows specific code somewhere. I'll run for a longer
>>>>> period of time just in case, but I don't expect the results to be
>>>>> different.
>>>>> 
>>>> One way to rule out Windows-specific code may be to run with the Agg
>>>> backend only (without wx). Have you plotted the memory growth? This
>>>> amount of memory growth is well within the pool allocation sizes that
>>>> Python routinely uses. Does the value of len(gc.get_objects()) grow
>>>> over time?
>>>>
>>>> 
>>> New results follows.
>>>
>>> matplotlib 1.0.1, numpy 1.5.1, python 2.7.1, wxPython 2.8.11.0, Windows XP SP3
>>>
>>> agg
>>> - 3601 redraws (1 hour), about 1Hz
>>> - Memory usage: 28.79 - 27.57 = 1.22 MB
>>> - len(gc.get_objects()): 23424 at beginning and end
>>> - Plot of memory growth: roughly linear, increasing with slope of 0.26KB
>>>
>>> tkagg
>>> - 3601 redraws (1 hour), about 1Hz
>>> - Memory usage: 33.22 - 33.32 = -0.1 MB
>>> - len(gc.get_objects()): 24182 at beginning and end
>>> - Plot of memory growth: very irregular (up and down), but a line fit
>>> has a slope of about 0.025KB (I could run longer and see if slope
>>> approaches 0)
>>>
>>> wxagg
>>> - 3601 redraws (1 hour), about 1Hz
>>> - Memory usage: 43.28 - 41.80 = 1.5 MB
>>> - len(gc.get_objects()): 41473 at beginning and end
>>> - Plot of memory growth: roughly linear, increasing with slope of 0.32KB
>>> 
>> Thanks. These are very useful results.
>>
>> The fact that gc.get_objects() remains constant suggests to me that this
>> is not a simple case of holding on to a Python reference longer than we
>> intend to. Instead, this is either a C-side reference counting bug, or
>> a genuine C malloc-and-never-free bug. Puzzlingly, valgrind usually
>> does a very good job of finding such bugs, but is turning up nothing for
>> me. Will have to scratch my head a little bit longer and see if I can
>> come up with a proper experiment that will help me get to the bottom of
>> this.
>>
>> 
> For completeness, I ran more tests over a 10 hour period at an
> increased redraw rate. Details follows. Note tkagg memory usage is
> flat, agg and wxagg are not.
>
> matplotlib 1.0.1, numpy 1.5.1, python 2.7.1, wxPython 2.8.11.0, Windows XP SP3
>
> agg
> - 52214 redraws
> - Memory usage: 27.55 - 43.46 = 15.22 MB
> - len(gc.get_objects()): 23424 at beginning and end
> - Plot of memory growth: linear, increasing with slope of 0.31KB
>
> tkagg
> - 71379 redraws
> - Memory usage: 30.47 - 30.25 = 0.22 MB
> - len(gc.get_objects()): 24171 at beginning, 24182 at end, but mostly
> constant at 24182
> - Plot of memory growth: very irregular (up and down), but a line fit
> has a slope of about 0.0002KB.
>
> wxagg
> - 72001 redraws
> - Memory usage: 62.08 - 40.10 = 21.98 MB
> - len(gc.get_objects()): 41473 at beginning and end
> - Plot of memory growth: linear, increasing with slope of 0.31KB
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Michael D. <md...@st...> - 2011年04月21日 16:24:14
There is no hard coded limit to the number of quads in a pcolormesh. 
(Unlike the limit of the number of points in a path in the Agg 
backend). Can you provide some code that reproduces the error?
Also, which version of matplotlib, platform and backend are you using?
Mike
On 04/21/2011 12:20 PM, Daniel Welling wrote:
> Greetings, MPL Users.
>
> I have a very detailed array that I am visualizing using pcolor mesh. 
> When the size of the array surpasses some threshold (I don't know the 
> value), pcolormesh stops drawing polygons/patches. Thus, I only see 
> some percentage of my array. Is there a way to increase the number of 
> polygons/patches MPL will draw to screen?
>
> Thanks.
> -dw
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Daniel W. <dan...@gm...> - 2011年04月21日 16:20:07
Greetings, MPL Users.
I have a very detailed array that I am visualizing using pcolor mesh. When
the size of the array surpasses some threshold (I don't know the value),
pcolormesh stops drawing polygons/patches. Thus, I only see some percentage
of my array. Is there a way to increase the number of polygons/patches MPL
will draw to screen?
Thanks.
-dw
7 messages has been excluded from this view by a project administrator.

Showing results of 208

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