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
(4) |
3
|
4
(9) |
5
(4) |
6
(9) |
7
(13) |
8
(11) |
9
(7) |
10
(7) |
11
(22) |
12
(19) |
13
(11) |
14
(20) |
15
(21) |
16
(1) |
17
(1) |
18
(8) |
19
(3) |
20
(5) |
21
(5) |
22
(9) |
23
(3) |
24
(3) |
25
(14) |
26
(12) |
27
(29) |
28
(18) |
29
(11) |
30
(2) |
John Hunter wrote: >See examples/shared_axis_demo.py, >examples/two_scales.py and examples/ganged_plots.py. > Speaking of which: I just put a ganged plot made with matplotlib into a grant proposal. It worked really well with one exception: the top value of the y axis on each graph was printed on top of the bottom value of the graph above. If you look carefully, you'll see that examples/ganged_plots.py does the same thing. Any good way to avoid this?
On 2005年4月15日 00:34:15 -0500, John Hunter <jdh...@ac...> wrote : > Olive> Hello, I've juste downloaded the last version (0.8) of > Olive> matplotlib and successfully built it on SunOS 5.8 with GTK > Olive> backend (gcc 3.2.2). "import matplolib" is OK but typing > Olive> "from matplotlib.pylab import *" result in a core dumped ! > Olive> without any error message or exception... "import gtk", > Olive> "import pygtk", and "import wx" works OK. > > Olive> I've tried with version 0.72, same error : > > I don't have a lot of good advice for you, but here is how I would go > about debugging the problem. You can recompile mpl in verbose mode. > rm -rf "site-packages/matplotlib" and your "build" subdir and edit > setup.py and set VERBOSE=True and recompile/reinstall. Ah ! that was what I was looking for ! So I've managed to isolate the culprit : >>> from font_manager import FontProperties Glyph::init_type FT2Font::init_type ft2font_module::new_ft2font FT2Font::FT2Font FT2Font::clear Illegal Instruction (core dumped) It appears that the problem was in file ft2font.cpp at line 354 : const char* ps_name = FT_Get_Postscript_Name( face ); I don't know what is wrong here but I managed to get matplotlib working by replacing it by : const char* ps_name = NULL; I forgot to take the version number of the freetype library before leaving work, I will get it on monday. I haven't understand what is really in the argument 'face', can you give me a code which print the fields of 'face' ? (I don't know C++...) Thank you anyway for your help !
>>>>> "Werner" == Werner F Bruhin <wer...@fr...> writes: Werner> Note that all of the above still have problems if I do: Werner> self.figure = Figure(frameon=False) The first thing to be drawn to the figure is the figure frame , a matplotlib.patches.Rectangle instance. This is what "clears" the background. If you want to clear the background to a certain color, set the facecolor of the figure frame to that color and it will be done. If you don't like the thin edge around the frame, set the rectangle edgecolor to be the same as the facecolor. If you want the figure to be transparent to overlay some other image, set the rectangle alpha to be 0. It will still clear the pixel buffer, but will be transparent. In other words, you should be able to get any desired effect by leaving the frame on and setting its properties. See http://matplotlib.sf.net/matplotlib.patches.html for more information on Patch/Rectangle properties. JDH
> >Take a look at the release notes at >http://matplotlib.sf.net/whats_new.html for release 0.72. We improved >the way we do multiscale axes and shared axis axes, and the interface >changed somewhat. See examples/shared_axis_demo.py, >examples/two_scales.py and examples/ganged_plots.py. The examples are >available in a zip file on the website. Thanks for the information. I haven't been keeping up with matplotlib improvements very well. Looking back at the release notes, its amazing how fast the progress has been. The ylim() and twinx() functions greatly improved the readibility, and restored the functionality. > > Wendell> Is there another way of doing this that gets back to the > Wendell> original output? >Yes > > > Wendell> Also, is it just my imagination, or does 0.8 take longer > Wendell> to display graphs than previous versions. I haven't done > Wendell> any formal timing, but the delay seems longer. > >I hope it's your imagination :-) Apparently just my imagination, rebooting the computer speeded things up noticibly. Wendell Cropper > >JDH > > University of Florida School of Forest Resources and Conservation 214 Newins-Ziegler PO Box 110410 Gainesville, FL 32611-0410 352-846-0859 phone 352-392-1707 fax wcr...@uf...
Hi Matt, Matt Newville wrote: > Hi Werner, > > I think what you may want is something like this: > > def OnButton1Button(self, event): > print 'done it' > ### self.figure.clear() > ### self.axes = self.figure.add_subplot(111) > self.axes.cla() # <-- clear the axes > t = arange(0.0,4.0,0.01) > s = sin(2*pi*t) > > self.axes.plot(t,s) > self.axes.set_xlabel('Time 2 (s)') > self.axes.set_ylabel('Price 2 ($)') > self.canvas.draw() # <-- force a redraw > > Is that OK? It works for me on Windows and Linux. I do the > same thing for 'make a fresh plot' in my own codes that I know > work OK on Mac OS X as well. Yes, that works too. So, I can do: self.figure.clear() ... self.canvas.Refresh() or: self.axes.cla() ... self.canvas.draw() or: self.figure.clear() ... self.canvas.draw() Note that all of the above still have problems if I do: self.figure = Figure(frameon=False) i.e. the "frameon=False" bit causes the figure/axes not to get totally cleared. > > Cheers, > > --Matt > > See you Werner
>>>>> "Wendell" == Wendell Cropper <wcr...@uf...> writes: Wendell> '''Hi, I use the following program in a simulation class Wendell> to demonstrate the niftyness of matplotlib. The Wendell> combination of Python, Numeric, and matplotlib really Wendell> makes a great set of tools for biologists who are largely Wendell> non-programmers these days. Thanks. Great -- do you have class notes? I will be using the same combination in a class I am teaching to biologists this fall and am working on a manuscript with Fernando Perez, basically an introduction to scientific computing in python. Wendell> I just did a big upgrade from 0.6-before pylab to Wendell> 0.80. This is the only tested program that didn't produce Wendell> the same results before and after: Wendell> Attached are matlab and pylab png files. Take a look at the release notes at http://matplotlib.sf.net/whats_new.html for release 0.72. We improved the way we do multiscale axes and shared axis axes, and the interface changed somewhat. See examples/shared_axis_demo.py, examples/two_scales.py and examples/ganged_plots.py. The examples are available in a zip file on the website. Wendell> Is there another way of doing this that gets back to the Wendell> original output? Yes ax1 = subplot(111) t = arange(0.01, 10.0, 0.01) s1 = exp(t) plot(t, s1, 'b-') xlabel('time (s)') ylabel('exp') ax2 = twinx() ### <- this is the new way s2 = sin(2*pi*t) plot(t, s2, 'r.') ylabel('sin') Wendell> Also, is it just my imagination, or does 0.8 take longer Wendell> to display graphs than previous versions. I haven't done Wendell> any formal timing, but the delay seems longer. I hope it's your imagination :-) JDH
Hi, I would like to produce histograms in N dimensions, the minimum being in 2D. Here is an example of what I wish to do: I have a set of P particles with x and y positions. I have a rectangular grid, defined by e.g. a sampling in x and a sampling in y, (e.g. samp_x=arange(-15,31,1) ..), and I wish to know how many particles are in each "pixel". I can do that in many different ways (using searchsorted from numarray, or abruptly using loops, etc) but I am now looking for a simple (fewer lines) and efficient way (as I am treating large sets of particles) to do this so that I would be able to use a function like: histogram_2D(x,y, samp_x, samp_y) would return a matrix with the number of particles in each corresponding pixel. and showhistogram_2D(x,y, samp_x, samp_y) would display it [using e.g. imshow or matshow] Any hint there (I realize this is more a numarray question but I thought of first asking your community first since someone may have done it already)? And maybe also of how to generalize this in N dimensions? (for 1D matplotlib has the hist function..) Thanks! Eric -- =============================================================== Observatoire de Lyon ems...@ob... 9 av. Charles-Andre tel: +33 4 78 86 83 84 69561 Saint-Genis Laval Cedex fax: +33 4 78 86 83 86 France http://www-obs.univ-lyon1.fr/eric.emsellem ===============================================================
Jochen Voss wrote: >Last I checked the PostScript backend used only PostScript level 2. > > What I really meant was that the PostScript file produced by MPL starts with '%!PS-Adobe-3.0', which I thought meant Postscript level 3. Changing the 3.0 to 2.0 by hand still doesn't allow it to print. dvips output files print fine on this printer, and they start with '%!PS-Adobe-2.0'. >You could try to produce a standalone .ps file instead of an >.eps file. Maybe this works better? > > Thanks for the suggestion, but I'm afraid this didn't help. The workaround I found was to do a dvipdf on the LaTeX file which included the MPL doc, read it with Acrobat Reader, and tell acroread to print it at Postscript level 1. Normally acroread can print at level 2 to this printer, but asking acroread to print at level 3 gets an error page from the printer telling you to use level 2. Best, Steve
'''Hi, I use the following program in a simulation class to demonstrate the niftyness of matplotlib. The combination of Python, Numeric, and matplotlib really makes a great set of tools for biologists who are largely non-programmers these days. Thanks. I just did a big upgrade from 0.6-before pylab to 0.80. This is the only tested program that didn't produce the same results before and after: Attached are matlab and pylab png files. Is there another way of doing this that gets back to the original output? Also, is it just my imagination, or does 0.8 take longer to display graphs than previous versions. I haven't done any formal timing, but the delay seems longer. Thanks, Wendell Cropper ''' from pylab import * r = 0.1 g = 0.002 h = 0.0002 m = 0.2 def derivs(x, t): d1dt = r* x[0] - g * x[0] * x[1] # host d2dt = h * x[0] * x[1] - m * x[1] #parasite return (d1dt, d2dt) dt = 0.01 #delta t tim = arange(0.0, 125.0, dt) x0 = (1500.0, 50.0) #initial numbers of host, parasite xint = rk4(derivs, x0, tim) #Runge-Kutta 4th order numerical integration #print xint[0] #print xint[1] host, parasite = [[x[0] for x in xint], [x[1] for x in xint]] #extract variables figure(1, [11.0, 11.0]) #size of window ax1 = subplot(211) title('Host-Parasite using MatPlotLib') L1 = plot(tim, host, 'b', linewidth=2) plot ([0.0, 0.1], [500.0, 510.0], 'w') ax1.yaxis.tick_left() ylabel('Host Numbers') ax2 = subplot(211, frameon = False) ax2.yaxis.tick_right() text (145.0, 47.0, 'Parasite Numbers', rotation = 'vertical') xlabel('time') L2 = plot(tim, parasite, 'r--', linewidth=2) plot ([0.0, 0.1], [90.0, 100.0], 'w') legend((L1, L2), ('H', 'P')) subplot(212) plot(parasite, host, 'g') axis([20.0, 100.0, 500.0, 1600.0]) #min x, max x, min y, max y xlabel('Parasite Numbers') ylabel('Host Numbers') text (45.0, 1200.0, 'Phase Plane Plot', fontsize = 16) show()
Hi Werner, I think what you may want is something like this: def OnButton1Button(self, event): print 'done it' ### self.figure.clear() ### self.axes = self.figure.add_subplot(111) self.axes.cla() # <-- clear the axes t = arange(0.0,4.0,0.01) s = sin(2*pi*t) self.axes.plot(t,s) self.axes.set_xlabel('Time 2 (s)') self.axes.set_ylabel('Price 2 ($)') self.canvas.draw() # <-- force a redraw Is that OK? It works for me on Windows and Linux. I do the same thing for 'make a fresh plot' in my own codes that I know work OK on Mac OS X as well. Cheers, --Matt
#!/usr/bin/env python """ Show how to have wx draw a cursor over an axes that moves with the mouse and reports the data coords """ from matplotlib.numerix import arange, sin, pi import matplotlib matplotlib.use('WXAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure 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(frameon=False) self.axes = self.figure.add_subplot(111) t = arange(0.0,3.0,0.01) s = sin(2*pi*t) self.axes.plot(t,s) self.axes.set_xlabel('Time (s)') self.axes.set_ylabel('Price ($)') self.canvas = FigureCanvas(self, -1, self.figure) self.canvas.mpl_connect('motion_notify_event', self.mouse_move) self.sizer =wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) buttonId = wx.NewId() self.button1 = wx.Button(id=buttonId, label='Clear and do figure again', parent=self) self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button, id=buttonId) self.sizer.Add(self.button1, 0, wx.LEFT | wx.TOP) self.SetSizer(self.sizer) self.Fit() self.statusBar =wx.StatusBar(self, -1) self.statusBar.SetFieldsCount(1) self.SetStatusBar(self.statusBar) self.add_toolbar() # comment this out for no toolbar if wx.VERSION_STRING >= '2.5': self.Bind(wx.EVT_PAINT, self.OnPaint) else: wx.EVT_PAINT(self, self.OnPaint) self.cnt = 0 def OnButton1Button(self, event): if self.cnt == 0: self.figure.clear() self.axes = self.figure.add_subplot(111) t = arange(0.0,4.0,0.01) s = sin(2*pi*t*(self.cnt+1)) self.axes.plot(t,s) self.axes.set_xlabel('Time 2 (s)') self.axes.set_ylabel('Price 2 ($)') if self.cnt == 2: self.figure.clear() self.axes = self.figure.add_subplot(111) t = arange(0.0,3.0,0.01) s = sin(2*pi*t*(self.cnt+1)) self.axes.plot(t,s) self.axes.set_xlabel('Time 3 (s)') self.axes.set_ylabel('Price 3 ($)') if self.cnt > 2: self.figure.clear() self.axes = self.figure.add_subplot(111) t = arange(0.0,2.0,0.01) s = sin(2*pi*t*(self.cnt+1)) self.axes.plot(t,s) self.axes.set_xlabel('Time 4 (s)') self.axes.set_ylabel('Price 4 ($)') self.cnt+=1 self.canvas.Refresh() def mouse_move(self, event): self.draw_cursor(event) def add_toolbar(self): self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() 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.erase_cursor() try: del self.lastInfo except AttributeError: pass self.canvas.draw() event.Skip() def draw_cursor(self, event): 'event is a MplEvent. Draw a cursor over the axes' if event.inaxes is None: self.erase_cursor() try: del self.lastInfo except AttributeError: pass return canvas = self.canvas figheight = canvas.figure.bbox.height() ax = event.inaxes left,bottom,width,height = ax.bbox.get_bounds() bottom = figheight-bottom top = bottom - height right = left + width x, y = event.x, event.y y = figheight-y dc =wx.ClientDC(canvas) dc.SetLogicalFunction(wx.XOR) wbrush =wx.Brush(wx.Colour(255,255,255), wx.TRANSPARENT) wpen =wx.Pen(wx.Colour(200, 200, 200), 1, wx.SOLID) dc.SetBrush(wbrush) dc.SetPen(wpen) dc.ResetBoundingBox() dc.BeginDrawing() x, y, left, right, bottom, top = [int(val) for val in x, y, left, right, bottom, top] self.erase_cursor() line1 = (x, bottom, x, top) line2 = (left, y, right, y) self.lastInfo = line1, line2, ax, dc dc.DrawLine(*line1) # draw new dc.DrawLine(*line2) # draw new dc.EndDrawing() time, price = event.xdata, event.ydata self.statusBar.SetStatusText("Time=%f Price=%f"% (time, price), 0) def erase_cursor(self): try: lastline1, lastline2, lastax, lastdc = self.lastInfo except AttributeError: pass else: lastdc.DrawLine(*lastline1) # erase old lastdc.DrawLine(*lastline2) # erase old 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()
>>>>> "John" == John Hunter <jdh...@ac...> writes: John> matplotlib does cache some information, mainly text and font John> stuff) between draws which can cause memory to grow, but John> usually this is a small amount. I'll explore further. I wrote a little GUI neutral script to expose the same functionality. This helps test whether the problem is backend specific or not. If you click anywhere in the axes, the sine wave updates. I see the same effect: changing the sine wave frequency causes memory usage to increase with each draw, but only for the first 50 or so draws. This appears to be an agg thing, since I see it on GTKAgg, TkAgg, WXAgg but not GTK or WX. However, I don't believe it is a memory leak. Agg may be caching some path or stroke information, because as I say the memory only seems to increase when the path is changed. However, after 50 or so draws, the increase stops, so it does not appear to be a memory leak. I often see these kinds of effects when debugging memory leaks, and typically discard the first 30-50 draws before assessing whether there is a leak or not. Here's the backend neutral script I am using, you can run it with -dWXAgg, -dWX, -dGTKAgg etc to test various backends. Note that I also explicitly clear the text cache with Text.cached = {} JDH #!/usr/bin/env python import os, sys, time, gc from matplotlib.text import Text from pylab import * def report_memory(i): pid = os.getpid() a2 = os.popen('ps -p %d -o rss,sz' % pid).readlines() print i, ' ', a2[1], return int(a2[1].split()[1]) fig = figure() ax = fig.add_subplot(111) t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t) ax.plot(t,s) def click(event): fig.clear() s = sin(2*pi*t*(click.cnt+1)) ax = fig.add_subplot(111) ax.plot(t,s) gc.collect() Text.cached = {} report_memory(click.cnt) fig.canvas.draw() click.cnt += 1 click.cnt = 1 #connect('motion_notify_event', report) connect('button_press_event', click) show()
>>>>> "Werner" == Werner F Bruhin <wer...@fr...> writes: Werner> Hi All, I put a small test case together based on Werner> wxcursor_demo. When clicking the button1 it should show a Werner> new plot, but it does not. It does for me... Do you mean a new plot window, or just redraw in the current figure? You may not see that it has redrawn the figure unless you somehow change the plot (ed pan/zoom). I modified your example so that each time you redraw the frequency of the sine wave changes to make it more apparent. Werner> I think my memory issue has to do with this as I created a Werner> new self.canvas each time, instead of doing a clear, but Werner> the big question is what do I need to call to show the new Werner> plot. For one thing, add a gc.collect after you call clear to trigger the garbage collector. I added a memory report function and noticed something surprising. If I just plotted the same sine wave over and over, memory usage was flat. If I changed the sine wave frequency (still creating arrays of the same size though) memory usage increased with each plot. matplotlib does cache some information, mainly text and font stuff) between draws which can cause memory to grow, but usually this is a small amount. I'll explore further. Here is my lightly modified version of your test script. The report_memory function only works on unix like systems. JDH #!/usr/bin/env python """ Show how to have wx draw a cursor over an axes that moves with the mouse and reports the data coords """ from matplotlib.numerix import arange, sin, pi import matplotlib matplotlib.use('WXAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure import wx import os, sys, time, gc def report_memory(i): pid = os.getpid() a2 = os.popen('ps -p %d -o rss,sz' % pid).readlines() print i, ' ', a2[1], return int(a2[1].split()[1]) 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 = self.figure.add_subplot(111) t = arange(0.0,3.0,0.01) s = sin(2*pi*t) self.axes.plot(t,s) self.axes.set_xlabel('Time (s)') self.axes.set_ylabel('Price ($)') self.canvas = FigureCanvas(self, -1, self.figure) self.canvas.mpl_connect('motion_notify_event', self.mouse_move) self.sizer =wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) buttonId = wx.NewId() self.button1 = wx.Button(id=buttonId, label='Clear and do figure again', parent=self) self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button, id=buttonId) self.sizer.Add(self.button1, 0, wx.LEFT | wx.TOP) self.SetSizer(self.sizer) self.Fit() self.statusBar =wx.StatusBar(self, -1) self.statusBar.SetFieldsCount(1) self.SetStatusBar(self.statusBar) self.add_toolbar() # comment this out for no toolbar if wx.VERSION_STRING >= '2.5': self.Bind(wx.EVT_PAINT, self.OnPaint) else: wx.EVT_PAINT(self, self.OnPaint) self.cnt = 0 def OnButton1Button(self, event): print 'done it' self.figure.clear() self.axes = self.figure.add_subplot(111) t = arange(0.0,4.0,0.01) s = sin(2*pi*t*(self.cnt+1)) #s = sin(2*pi*t) self.axes.plot(t,s) self.axes.set_xlabel('Time 2 (s)') self.axes.set_ylabel('Price 2 ($)') report_memory(self.cnt) self.cnt+=1 gc.collect() def mouse_move(self, event): self.draw_cursor(event) def add_toolbar(self): self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() 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.erase_cursor() try: del self.lastInfo except AttributeError: pass self.canvas.draw() event.Skip() def draw_cursor(self, event): 'event is a MplEvent. Draw a cursor over the axes' if event.inaxes is None: self.erase_cursor() try: del self.lastInfo except AttributeError: pass return canvas = self.canvas figheight = canvas.figure.bbox.height() ax = event.inaxes left,bottom,width,height = ax.bbox.get_bounds() bottom = figheight-bottom top = bottom - height right = left + width x, y = event.x, event.y y = figheight-y dc =wx.ClientDC(canvas) dc.SetLogicalFunction(wx.XOR) wbrush =wx.Brush(wx.Colour(255,255,255), wx.TRANSPARENT) wpen =wx.Pen(wx.Colour(200, 200, 200), 1, wx.SOLID) dc.SetBrush(wbrush) dc.SetPen(wpen) dc.ResetBoundingBox() dc.BeginDrawing() x, y, left, right, bottom, top = [int(val) for val in x, y, left, right, bottom, top] self.erase_cursor() line1 = (x, bottom, x, top) line2 = (left, y, right, y) self.lastInfo = line1, line2, ax, dc dc.DrawLine(*line1) # draw new dc.DrawLine(*line2) # draw new dc.EndDrawing() time, price = event.xdata, event.ydata self.statusBar.SetStatusText("Time=%f Price=%f"% (time, price), 0) def erase_cursor(self): try: lastline1, lastline2, lastax, lastdc = self.lastInfo except AttributeError: pass else: lastdc.DrawLine(*lastline1) # erase old lastdc.DrawLine(*lastline2) # erase old 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()
O.k., so I have to decode all the texts, so that they get passed as "u'text' to matplotlib, i.e. something along these lines: textp = (_('Purchase - %s') % y).decode('iso-8859-1') Note that in this example the word 'Purchase' gets translated using gettext and would return "Einkäufe". See you Werner Werner F. Bruhin wrote: > Hi All, > > The legend lables etc I pass to matplotlib contain things like "äü" > (i.e. European character set) but they don't get displayed in the plots. > > Is there something special one needs to do to support this? > > Using wxPython 2.5.5.1 ANSI build (can't switch to Unicode just yet) on > Windows (XP, 2000). > > See you > Werner > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >
Hi All, I put a small test case together based on wxcursor_demo. When clicking the button1 it should show a new plot, but it does not. I think my memory issue has to do with this as I created a new self.canvas each time, instead of doing a clear, but the big question is what do I need to call to show the new plot. So, I am obviously missing something. Any hints are appreciated. See you Werner Werner F. Bruhin wrote: > Hi All, > > Doing multiple plots I see that memory usage grows and grows. > > Before doing a new plot I do "self.figure.clear()", or > "self.figure.clf()", is there some other call I should use? > > See you > Werner > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Hello Stephen, On Thu, Apr 14, 2005 at 04:16:49PM -0700, Stephen Walton wrote: > I can't seem to print EPS files generated from matplotlib on my printer,= =20 > a Minolta Magicolor 2200. I think this is very specific to my setup but= =20 > would be happy for suggestions. My initial guess is that MPL is=20 > generating Postscript Level 3 and my printer only supports Level 2, but= =20 > I'm open to other ideas. Last I checked the PostScript backend used only PostScript level 2. You could try to produce a standalone .ps file instead of an =2Eeps file. Maybe this works better? All the best, Jochen --=20 http://seehuhn.de/
Hi Sascha, I can't think of anything that has changed that would cause this. But if you could be a little more specific about the conditions causing the behavior, I'll look into it. Posting a short script that reproduces the problem would be helpful. Thanks, Darren On Friday 15 April 2005 5:32 am, Sascha Schnepp wrote: > Hi, > > I realized a change in the behavior of the eps export with the release 0.8. > Sometimes (not always!) the bounding box on the left side is very close to > the ylabel. When converting this to a pdf and printing it, this results in > a (partially or even totally) cutted ylabel on your printout... > > Greetings, > Sascha > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_ide95&alloc_id396&op=Click > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Darren S. Dale Bard Hall Department of Materials Science and Engineering Cornell University Ithaca, NY. 14850 dd...@co...
Hi, I realized a change in the behavior of the eps export with the release 0.= 8. Sometimes (not always!) the bounding box on the left side is very clos= e to the ylabel. When converting this to a pdf and printing it, this resu= lts in a (partially or even totally) cutted ylabel on your printout... Greetings, Sascha
Hello all, > Yes, this is Numeric/numarray slicing, not list slicing. When you get > some time, you should read the pdf Numeric or numarray documentation. > It's comprehensive and very good. Thanks for all the answers. I'm now looking at the numarray/numeric documentation as suggested. Good day, and thanks again. Olivier --=20 . __ . ___ __. | Olivier Bornet Oli...@id... / / ` / / / / / | IDIAP http://www.idiap.ch/~bornet/ / / / / /--/ /--' | CP 592 http://www.idiap.ch/~bornet/pgp/ / /__.' / / / / | CH-1920 Martigny PGP-key: 0xC53D9218
>>>>> "Olive" == Olive <enc...@ya...> writes: Olive> Hello, I've juste downloaded the last version (0.8) of Olive> matplotlib and successfully built it on SunOS 5.8 with GTK Olive> backend (gcc 3.2.2). "import matplolib" is OK but typing Olive> "from matplotlib.pylab import *" result in a core dumped ! Olive> without any error message or exception... "import gtk", Olive> "import pygtk", and "import wx" works OK. Olive> I've tried with version 0.72, same error : I don't have a lot of good advice for you, but here is how I would go about debugging the problem. You can recompile mpl in verbose mode. rm -rf "site-packages/matplotlib" and your "build" subdir and edit setup.py and set VERBOSE=True and recompile/reinstall. This can sometimes provide information about which extension code function is failing. You also want to create a test script that replicates the problem (in your case it's a one-liner that simply imports matplotlib.pylab) and run it with the --verbose-debug flag > python myscript.py --verbose-debug This prints maximal debug info which can provide helpful information to narrow down the possible culprits. Olive> Python 2.4.1 (#3, Apr 14 2005, 10:58:02) [GCC 3.2.2] on Olive> sunos5 Type "help", "copyright", "credits" or "license" for Olive> more information. >>>> from matplotlib.pylab import * Olive> Bus Error (core dumped) The old-fashioned but effective way to triangulate this kind of segfault is to put a lot of print statements into the module that is segfaulting (in this case site-packages/matplotlib/pylab.py). Space these print statements every 50 lines or so print 'debug 1' ...50 lines of pylab... print 'debug 2' ...50 lines of pylab... print 'debug 3' When you have narrowed the segfault to be between two numbers, say 2 and 3, add more statements between them, maybe with a delimiter such as TAB '\t' print '\t debug 2a' ...5 lines of pylab... print '\t debug 2b' ...5 lines of pylab... print '\t debug 2c' ...5 lines of pylab... and repeat as necessary with a finer grain until you find the actual line causing the segfault. Posting this info will go a long way to actually discovering the bug. I call this "poor man's debugging" or "manual binary search" and it's primitive, ugly, and highly effective. Olive> One more thing is that after importing matplotlib, I got an Olive> error when using help : Don't know if this is related or not... JDH
>>>>> "Joe" == Joe Wu <jw...@sd...> writes: Joe> Sorry if this question has been asked before: Has anyone Joe> written a locator class which acts like the AutoLocator but Joe> picks the best DateLocator based on current time span? Joe> For date plots, zooming in/out can yield no tick marks or too Joe> many tick marks, and I think using such a class can solve Joe> this problem. Any suggestion for other approach? Take a look at Axes.plot_date. It inspects the date range and tries to pick a good locator and formatter. You could wrap this functionality into an AutoDateLocator, following the model of AutoLocator. There is a slight wrinkle here in that you want an AutoDateFormatter as well, but this shouldn't be any harder. Again you can reuse the logic of plot_date to pick the right format string dynamically. If you succeed, please send it my way and I'll use it in plot_date. JDH