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





Showing 10 results of 10

From: James B. <bo...@ll...> - 2007年04月17日 22:40:04
I wish to make a color filled plot with the colors defined for 
discrete, non-uniform intervals. Something like:
0.0 -0.001 0.001-0.05 0.05-0.2 0.2-0.4 0.4-0.8 0.8-1.0
 red blue green magenta 
yellow cyan
with the colorbar labeled appropriately.
I have seen discussions and solutions for discrete colors but not for 
non-uniform intervals + discrete.
The last post I saw regarding this type of issue was august 2005 - 
and a solution was not resolved at that time.
However, Eric has done a huge amount of work in the intervening time 
and a smarter person than myself might have a solution now.
Note that I do not wish just to make contours - although that would 
be good - but to have a general mapping code that joins allows the 
color rmapping to be passed to colorbar.
maybe some sub-class of scalarMappable that could work.
Thanks for any help.
--Jim
 
From: Christopher B. <Chr...@no...> - 2007年04月17日 22:01:25
ednspace wrote:
> I'm using WXpython and the OO api of matplotlib. 
Have you tried wxAgg? if nothing else, it should look better. It would 
be interesting to see if it behaves differently as far as memory is 
concerned.
Also, be sure to post your versions and platform.
-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: Gary S. <st...@nm...> - 2007年04月17日 19:24:38
Hi,
I'm using a very large font size for my tick labels (for 
publication-quality figures). When I do so, the tick labels bump into the 
axis bounding box. Resizing the window does not change the spacing between 
tick labels and the bounding box, only the spacing around the outer edge 
of the plot. I did a search in the archives but couldn't find the answer 
(though I bet it's in there).
Is there a property, command, or command-combo that can be used to specify 
the spacing between (e.g.) the rightmost edge of the y tick labels and the 
adjacent y-axis?
Thanks!
Gary
From: ednspace <dai...@me...> - 2007年04月17日 13:42:19
I am trying to make a dynamic plot to monitor sensor data, slowly over time.
It will be updated about once a second.
When I leave my app running it slowly fills up memory. I am new to OO
programming, python and Matplotlib so the chances of me doing something
wrong are huge!
I'm using WXpython and the OO api of matplotlib. My code is below, however
I have the same problem running dynamic_demo_wx.py from the examples(I used
this as my base). I am guessing that every so often I need to clear the
plot data, but am unsure how to do this. If I remove, the 3 lines that
actually set the data, draw the plot and repaint the GUI then the program
has no memory issues. 
Any help on this would be greatly appreciated, as everything else works.
This monitor program will be running for days, right now it last only a few
hours before it has claimed most of the system memory.
#!/usr/bin/env python
import time, sys, os
import numpy
import matplotlib
matplotlib.use('WX')
from matplotlib.backends.backend_wx import
FigureCanvasWx,FigureManagerWx,NavigationToolbar2Wx
from matplotlib.figure import Figure
from matplotlib.axes import Subplot
import wx
TIMER_ID = wx.NewId()
class PlotFigure(wx.Frame):
 def __init__(self):
 wx.Frame.__init__(self, None, -1, "Pyro Logger")
 self.fig = Figure((12,3), 75)
 self.canvas = FigureCanvasWx(self, -1, self.fig)
 self.toolbar = NavigationToolbar2Wx(self.canvas)
 self.toolbar.Realize()
 self.figmgr = FigureManagerWx(self.canvas, 1, self)
 sizer = wx.BoxSizer(wx.VERTICAL)
 sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW)
 sizer.Add(self.toolbar, 0, wx.GROW)
 self.SetSizer(sizer)
 self.Fit()
 wx.EVT_TIMER(self, TIMER_ID, self.onTimer)
 def GetToolBar(self):
 return self.toolbar
 def init_plot_data(self):
 self.xlim = 100
 self.ylim = 100 
 a =
self.fig.add_subplot(111,xlim=(0,self.xlim),ylim=(0,self.ylim),autoscale_on=False)
 self.x = numpy.array([0])
 self.y = numpy.array([0])
 self.lines = a.plot(self.x,self.y,'-')
 self.count = 0
 def onTimer(self, evt):
 if self.count <= self.xlim:
 self.count = self.count + 1
 if self.count <= self.xlim:
 self.x = numpy.append(self.x,self.count)
 if self.count > self.xlim:
 self.y = self.y[1:self.xlim + 1]
 #Simulating with random Data for now
 self.y=numpy.append(self.y,((numpy.random.random()*50)+25))
 #Problem seems to come in here 
 self.lines[0].set_data(self.x,self.y) 
 self.canvas.draw()
 self.canvas.gui_repaint()
if __name__ == '__main__':
 app = wx.PySimpleApp()
 frame = PlotFigure()
 frame.init_plot_data()
 t = wx.Timer(frame, TIMER_ID)
 t.Start(100)
 frame.Show()
 app.MainLoop()
-- 
View this message in context: http://www.nabble.com/WX-dynamic-plot-slowly-fills-memory-tf3590828.html#a10035537
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: John H. <jd...@gm...> - 2007年04月17日 13:35:33
On 4/17/07, John Morgan <mo...@gm...> wrote:
> If you still want to try and squash this bug I'm happy to do some more
> testing but as far as I'm concerned the problem is solved.
Since we still don't know if it is even in matplotlib (it could be in
numarray) I don't think we can pursue this until we have a minimal
script which reproduces the error. If it rears up again, try and
isolate it and send us a script.
Thanks,
JDH
From: John M. <mo...@gm...> - 2007年04月17日 12:13:39
Try as I might I couldn't get your script to crash, so I modified my
code so it was more like yours (see below - I've also made some
cosmetic changes as well). It now runs without crashing :)
If you still want to try and squash this bug I'm happy to do some more
testing but as far as I'm concerned the problem is solved.
Many thanks for the help.
Cheers,
John
PS just in case it's at all relevant, I forgot to mention that for
unrelated reasons I'm using matplotlib with numarray rather than numpy
 for ani in range(an1, an2):
 if ba1 <= ani: ba1 = ani + 1
 for bli in range(ba1, ba2):
 if v.blank[ani, bli]:
 continue
 fig = pylab.figure()
 ax = fig.add_subplot(111)
 for chi in range(v.nch):
 ax.plot(v.iat, v.amp[:,ani,bli,0,chi,0], ',')
 ax.plot(v.iat, v.amp[:,ani,bli,0,chi,1], ',')
 ax.plot(v.iat, v.amp[:,ani,bli,1,chi,0], ',')
 ax.plot(v.iat, v.amp[:,ani,bli,1,chi,1], ',')
 baseline = '%02d-%02d' % (ani, bli)
 ax.set_title('Baseline ' + baseline)
 fig.savefig('TimeSeries' + baseline)
 pylab.close()
 print 'printing baseline ' + baseline
On 16/04/07, John Hunter <jd...@gm...> wrote:
> On 4/13/07, John Morgan <mo...@gm...> wrote:
> > I'm using matplotlib with Python 2.4.4 to make scatter plots of a
> > reasonably large dataset. Specifically about 200 plots with around
> > 3224 points each. Unfortunately after about 30-40 plots, python
> > invariably crashes with the error:
> >
>
> Could you produce a piece of freestanding code that we can run that
> reproduces the error so we can try and debug it. Unfortunately, there
> is nothing obviously wrong with your code, which means it is likely to
> be a bug on our side.
>
> Also, please report your versions of matplotlib and numpy, etc. One
> good way to do this is to create a simple test script and run it with
>
> > python test.py --verbose-helpful
>
> and paste the output here.
>
> To kickstart the process, here is a script that makes 500 figures with
> a similar number of points that *does not crash* on my system. If you
> are generating figures in batch, make sure you are running in a image
> backend like Agg (for PNG) or PS (for postscript) ....
>
> import matplotlib
> matplotlib.use('Agg')
> import numpy
> import pylab
> N = 3224
> ind = numpy.arange(float(N))
> for i in range(500):
> fig = pylab.figure()
> ax = fig.add_subplot(111)
> ax.plot(ind, numpy.random.rand(N), ',')
> ax.plot(ind, numpy.random.rand(N), ',')
> ax.plot(ind, numpy.random.rand(N), ',')
> ax.plot(ind, numpy.random.rand(N), ',')
> ax.set_title('Baseline %d'%i)
> fig.savefig('TimeSeries %d'%i)
> pylab.close()
> print 'printing baseline ', i
>
>
>
> Thanks,
> JDH
>
> JDH
>
From: Cohen-Tanugi, J. <co...@sl...> - 2007年04月17日 06:47:59
hello,
I have built matplotlib from the head of SVN, just a few minutes ago, =
and the incorrect parsing of 'A\tilde{B}' is still there for me......
Johann
From: <jk...@ik...> - 2007年04月17日 03:47:47
"Bill Baxter" <wb...@gm...> writes:
> Documentation issue/question: I figured there was probably some way
> to set attributes individually using the return value from contour
> since contour's docstring helpfully tells me that countour returns a
> ContourSet object. However, 'ContourSet?' in ipython gives me
> nothing. Similarly with plot(), it says it returns a 'list of lines'
> but that is not so useful since I can't look up the docstring for
> 'list of lines'.
Call setp on the returned object:
In [8]:y = plot(sin(arange(10)))
In [9]:setp(y)
 alpha: float
 animated: [True | False]
 antialiased or aa: [True | False]
 axes: unknown
...
 xdata: array
 ydata: array
 zorder: any number
And similarly:
In [11]:z = contour(outerproduct(arange(10), arange(10)))
In [12]:setp(z)
 alpha: unknown
 array: unknown
 clim: a length 2 sequence of floats
 cmap: a colormap
 colorbar: unknown
 label_props: unknown
 norm: unknown
Or, in ipython you can type z.set_<TAB> to see the completions. With
the list returned from plot you cannot simply type y[0].set_<TAB> but
have to assign the value of y[0] to a variable first.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Bill B. <wb...@gm...> - 2007年04月17日 00:23:56
Ok. Thanks. I'll give the setp on the ContourSet thing a try.
Documentation issue/question: I figured there was probably some way
to set attributes individually using the return value from contour
since contour's docstring helpfully tells me that countour returns a
ContourSet object. However, 'ContourSet?' in ipython gives me
nothing. Similarly with plot(), it says it returns a 'list of lines'
but that is not so useful since I can't look up the docstring for
'list of lines'.
--bb
On 4/17/07, Eric Firing <ef...@ha...> wrote:
> Maybe I should make _nolegend_ the default for contour and contourf
> collections?
>
> Eric
>
> John Hunter wrote:
> > On 4/13/07, Bill Baxter <wb...@gm...> wrote:
> >> There are a couple things about legend that I'm finding a little
> >> irksome. Is there some better way to do this?
> >>
> >> 1) if you have a contour, legend() wants to add all the contours to
> >> the list. calling contour(...,label='_nolegend_') doesn't seem to
> >> help.
> >
> > You should be able to set the "_nolegend_" label property on the
> > contour set line collections like so:
> >
> > >>> cs = contour(...blah...)
> >
> > >>> for coll in cs.collections:
> > coll.set_label('_nolegend_')
> >
> > of use "setp" for the same purpose.
> >
> > >>> setp(cs.collections, label='_nolegend_')
> >
> > contour doesn't use the kwargs to set the line collection properties,
> > which is why it is not working in the contour commands. some plot
> > commands use the kwargs to update the artist properties that the plot
> > command creates, some do not, and the only way to know is the read the
> > individual docstrings of the commands.
> >
> > Let me know if this works because it is untested.
>
From: Eric F. <ef...@ha...> - 2007年04月17日 00:11:27
Maybe I should make _nolegend_ the default for contour and contourf 
collections?
Eric
John Hunter wrote:
> On 4/13/07, Bill Baxter <wb...@gm...> wrote:
>> There are a couple things about legend that I'm finding a little
>> irksome. Is there some better way to do this?
>>
>> 1) if you have a contour, legend() wants to add all the contours to
>> the list. calling contour(...,label='_nolegend_') doesn't seem to
>> help.
> 
> You should be able to set the "_nolegend_" label property on the
> contour set line collections like so:
> 
> >>> cs = contour(...blah...)
> 
> >>> for coll in cs.collections:
> coll.set_label('_nolegend_')
> 
> of use "setp" for the same purpose.
> 
> >>> setp(cs.collections, label='_nolegend_')
> 
> contour doesn't use the kwargs to set the line collection properties,
> which is why it is not working in the contour commands. some plot
> commands use the kwargs to update the artist properties that the plot
> command creates, some do not, and the only way to know is the read the
> individual docstrings of the commands.
> 
> Let me know if this works because it is untested.

Showing 10 results of 10

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





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

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

More information about our ad policies

Ad destination/click URL:

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