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
(11) |
2
(24) |
3
(24) |
4
(31) |
5
(30) |
6
(27) |
7
(25) |
8
(8) |
9
(2) |
10
(12) |
11
(16) |
12
(33) |
13
(18) |
14
(17) |
15
(3) |
16
(7) |
17
(8) |
18
(22) |
19
(20) |
20
(25) |
21
(10) |
22
(17) |
23
(18) |
24
(23) |
25
(15) |
26
(19) |
27
(6) |
28
(7) |
29
(6) |
30
(1) |
31
(12) |
|
|
|
|
|
Yes, using spines will be best in most situation. The problem with using axes_grid toolkit is that some mpl commands that changes the properties of the ticks and ticklabels do not work. I think you may consider to use axes_grid if you want to keep both of the bottom and top axis, which I guess would be very rare. -JJ On Sun, Aug 2, 2009 at 8:59 AM, John Hunter<jd...@gm...> wrote: > On Sun, Aug 2, 2009 at 2:14 AM, <jas...@cr...> wrote: >> I'm trying to understand some of the changes in 0.99, for example, the >> recommended way of getting a plot so that the axes cross at the origin >> (i.e., the axes are in the middle of the plot). I see two examples that >> seem to give this: >> >> http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html >> >> http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline2.html >> >> Is one or the other of these methods the recommended way to get a plot >> with axes in the middle that cross at the origin? Or are they both good >> and apply to different situations? > > I'll let Andrew and JJ fill in some color, since they wrote the spine > and axes_grid, respectively, but both are good. The spines are in the > mainline and JJ's solution is in a toolkit, so when in doubt go with > something in the mainline since that is more likely to be stable. > Both JJ and Andrew will be attending the scipy sprint this year (if > you're going to be there be sure to stop by), and one of the items on > our agenda is to incorporate their work into a unified API in the > mainline. So there may be some changes to one or both approaches, but > hopefully soon we will have most of the feature set of both in our > main axis code. > > JDH > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
On Sat, Aug 1, 2009 at 5:04 PM, Andres Luhamaa<and...@ut...> wrote: > Thank You, > > but now I have another little annoying issue. Besides clabel I add some > text manually to my plot with plt.text and sometimes the clabel and > plt.text overlap, and no matter in which order I plot them, the string > from clabel is always above the one from plt.text, but I would like, if > the manually added text would be more visible. > please define "more visible". Maybe adjusting the zorder is sufficient? http://matplotlib.sourceforge.net/api/artist_api.html?highlight=zorder#matplotlib.artist.Artist.set_zorder If not, I would adjust the clable position manually (of course, this is not a good choice if you need to do this for a lot of plots). I'm not sure if there are more elegant solutions. -JJ
On Sun, Aug 2, 2009 at 1:28 PM, Jae-Joon Lee<lee...@gm...> wrote: > A snippet of code does not help in general. > Please take your time to create a simple, standalone code that > reproduces your problem and post that code in this mailing list so > that we can easily test. > > Here is the code, based on yours, that works for me. The other approach is to use a figimage and use the ax.transData instance to convert data coords to fig coords for the offsets. JDH
Use pylab's yticks command. http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.yticks Or Axes.set_yticklabels together with Axes.set_yticks. http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set_yticklabels -JJ On Fri, Jul 31, 2009 at 4:07 PM, Lukas Hetzenecker<Lu...@gm...> wrote: > Hello, > > I have y values in the range of -100 to 100. > I want that the negative values are shown as positive (the minus gets removed > from the output). > > I tried a for loop over all self.ax.get_yticklabels() and call > label.set_text("...") on each item but it didn't work - nothing got changed. > > If I print the label in the loop they seem to be empty: > Text(0,0,'') > Text(0,0,'') > Text(0,0,'') > ...... > > Is there anything I do wrong? > > Thanks, > Lukas > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
A snippet of code does not help in general. Please take your time to create a simple, standalone code that reproduces your problem and post that code in this mailing list so that we can easily test. Here is the code, based on yours, that works for me. im = Image.open("icon.jpg") ax = gca() limx = ax.get_xlim() limy = ax.get_ylim() ax.set_autoscale_on(False) [x0, y0], [x1, y1] = ax.bbox.get_points() datawidth = limx[1] - limx[0] dataheight = limy[1] - limy[0] pixelwidth = x1 - x0 pixelheight = y1 - y0 adaptedwidth = im.size[0] * (datawidth/pixelwidth) adaptedheight = im.size[1] * (dataheight/pixelheight) ax.imshow(im, origin="lower", extent=(0.5, 0.5+adaptedwidth, 0.5, 0.5+adaptedheight)) plt.draw() -JJ On Fri, Jul 31, 2009 at 3:44 PM, Bas van Leeuwen<le...@gm...> wrote: > Hello, > > I tried to implement a solution for this issue. Basically I want to > give the x and y position in datacoords and the width + height in > pixels. > However, when using the following code: > > im = Image.open("../Icons/Program Icon.png") > > limx = self.mainAxes.get_xlim() > limy = self.mainAxes.get_ylim() > > [x0, y0], [x1, y1] = self.mainAxes.bbox.get_points() > > datawidth = limx[1] - limx[0] > dataheight = limy[1] - limy[0] > pixelwidth = x1 - x0 > pixelheight = y1 - y0 > adaptedwidth = im.size[0] * (datawidth/pixelwidth) > adaptedheight = im.size[1] * (dataheight/pixelheight) > > > for peak in Blocks.peaks(self.quote.Close, > self.peakSpanSlider.value()): > self.mainAxes.imshow(im, origin = 'lower', extent = > (date2num(peak.datetime), date2num(peak.datetime) + 100 , 400, 425)) # > left right bottom top > self.mainAxes.set_xlim(limx) > self.mainAxes.set_ylim(limy) > > There is no visible result. When zooming in to a place where an image > should be present I encounter the following error every time I move > the mouse. > > Traceback (most recent call last): > File "C:\Python25\lib\site-packages\matplotlib\backends\backend_qt4.py", > line 135, in mouseReleaseEvent > FigureCanvasBase.button_release_event( self, x, y, button ) > File "C:\Python25\lib\site-packages\matplotlib\backend_bases.py", > line 1198, in button_release_event > self.callbacks.process(s, event) > File "C:\Python25\lib\site-packages\matplotlib\cbook.py", line 155, in process > func(*args, **kwargs) > File "C:\Python25\lib\site-packages\matplotlib\backend_bases.py", > line 2048, in release_zoom > self.draw() > File "C:\Python25\lib\site-packages\matplotlib\backend_bases.py", > line 2070, in draw > self.canvas.draw() > File "C:\Python25\lib\site-packages\matplotlib\backends\backend_qt4agg.py", > line 133, in draw > FigureCanvasAgg.draw(self) > File "C:\Python25\lib\site-packages\matplotlib\backends\backend_agg.py", > line 279, in draw > self.figure.draw(self.renderer) > File "C:\Python25\lib\site-packages\matplotlib\figure.py", line 772, in draw > for a in self.axes: a.draw(renderer) > File "C:\Python25\lib\site-packages\matplotlib\axes.py", line 1545, in draw > im.draw(renderer) > File "C:\Python25\lib\site-packages\matplotlib\image.py", line 233, in draw > im = self.make_image(renderer.get_image_magnification()) > File "C:\Python25\lib\site-packages\matplotlib\image.py", line 220, > in make_image > rx = widthDisplay / numcols > ZeroDivisionError: float division > > Any idea what might cause this issue? Did I do something wrong? I know > it's not pretty, but it should work right? > > Cheers! > Bas > > > > 2009年7月30日 Bas van Leeuwen <le...@gm...>: >> Hi JJ, >> >> Thank you for your kind and speedy reply, I completely glanced over >> the extent parameter. >> Datacoords are actually what I need so this is perfect for me. >> >> To clarify what I want, I want to mark certain parts of a graph with >> an icon representing the reason it's interesting. Icons are for peaks, >> trends, correlation, etc. >> >> Thank you very much! >> >> Bas >> >> >> 2009年7月30日 Jae-Joon Lee <lee...@gm...>: >>> The location of the image can be set by specifying the "extent" >>> keyword, however, this is set in data coordinate. >>> figimage may be close to what you want. >>> >>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.figimage >>> >>> As far as I know, there is no direct support in matplotlib to place an >>> image with arbitrary transformation. But it may not be difficult to >>> implement. However, "annotate a plot with icons" is not enough to >>> figure out what you really want. >>> Maybe some screenshots from other plotting tool will be helpful. Or, >>> please elaborate how you want to position your image. >>> >>> -JJ >>> >>> >>> On Thu, Jul 30, 2009 at 12:11 PM, Bas van Leeuwen<le...@gm...> wrote: >>>> Hi all, >>>> >>>> Is there any way to annotate a plot with icons? >>>> The only way to include an image that I've found is using imshow, but >>>> imshow does not accept (x,y) coordinates. >>>> >>>> There probably is an easy solution, but I have not been able to find >>>> any. Please be patient :-) >>>> >>>> Thank you in advance for your reply, >>>> Bas van Leeuwen >>>> >>>> PS, I'm sorry if this mail arrives multiple times, I didn't see the >>>> previous one in the archive. >>>> >>>> ------------------------------------------------------------------------------ >>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day >>>> trial. Simplify your report design, integration and deployment - and focus on >>>> what you do best, core application coding. Discover what's new with >>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >>> >> > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
Hi, I am trying to plot netstat (network stats taken from /proc/net/netstat on linux), the parsed file looks like this: Tue Jul 28 17:11:39 2009 TcpExt: TcpExt: SyncookiesSent 35367 SyncookiesRecv 83175 SyncookiesFailed 626981 EmbryonicRsts 2683828 PruneCalled 0 RcvPruned 0 OfoPruned 0 OutOfWindowIcmps 0 LockDroppedIcmps 0 ArpFilter 0 TW 731933844 TWRecycled 2519 TWKilled 0 PAWSPassive 0 PAWSActive 0 PAWSEstab 0 DelayedACKs 260793151 DelayedACKLocked 39078 DelayedACKLost 8463534 ListenOverflows 5702696 ListenDrops 5702696 TCPPrequeued 757095 TCPDirectCopyFromBacklog 20396543 TCPDirectCopyFromPrequeue 41213784 TCPPrequeueDropped 0 TCPHPHits 1980793902 TCPHPHitsToUser 969080 TCPPureAcks 1329017292 TCPHPAcks 1527716572 TCPRenoRecovery 441952 TCPSackRecovery 158939 TCPSACKReneging 590 TCPFACKReorder 2354 TCPSACKReorder 12 TCPRenoReorder 77537 TCPTSReorder 3 TCPFullUndo 364 TCPPartialUndo 2267 TCPDSACKUndo 57659 TCPLossUndo 1377902 TCPLoss 83058 TCPLostRetransmit 65 TCPRenoFailures 597875 I am collecting this information every 3 minutes and want to plot every indivudal value (like for example TCPLoss) in separate date graph. Anyhow I have problems setting the date value This is the exception I get: Traceback (most recent call last): File "./graph_last.py", line 86, in <module> main() File "./graph_last.py", line 75, in main ax.plot(counter['date'],counter.__dict__[count]) File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 2654, in plot for line in self._get_lines(*args, **kwargs): File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 397, in _grab_next_args for seg in self._plot_2_args(remaining, **kwargs): File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 339, in _plot_2_args func(x[:,j], y[:,j]) File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 320, in makeline axes=self.axes, File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line 284, in __init__ self.set_data(xdata, ydata) File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line 405, in set_data self.recache() File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line 410, in recache x = ma.asarray(self.convert_xunits(self._xorig), float) File "/usr/lib/python2.5/site-packages/numpy/core/ma.py", line 2123, in asarray return array(data, dtype=dtype, copy=0) File "/usr/lib/python2.5/site-packages/numpy/core/ma.py", line 574, in __init__ self._data = c.astype(tc) ValueError: invalid literal for float(): Tue Jul 28 17:15:01 2009 This is the script based on the date example: #!/usr/bin/python import re import datetime import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.dates as mdates import matplotlib.mlab as mlab days = mdates.DayLocator() hours = mdates.HourLocator() daysFmt = mdates.DateFormatter('%c') class Mylist(list): def append(self,x): if not self.__contains__(x): return super(Mylist, self).append(x) else: raise AttributeError class Counter(): def __init__(self): self.names = Mylist() def __setitem__(self,key,value): ''' Now try to append the name to the list ''' try: self.names.append(key) except AttributeError: pass try: self.__dict__[key].append(value) except KeyError: self.__dict__[key] = list() def __getitem__(self,key): ''' Return the list ''' return list(self.__dict__[key]) def main(): try: file = open("netstat_output",) except IOError: print "There was a problem with the file\n" counter = Counter() lastline = re.compile('====================================') date = re.compile(r"\b\w{3} \w{3} \d{2} \d\d:\d\d:\d\d \d{4}\b") tcpext = re.compile('Tcpext:',re.IGNORECASE) lines = file.readlines() for line in lines: if (date.search(line)): counter['date'] = line elif (lastline.search(line)): pass elif (tcpext.search(line)): pass else: currlist = line.split() counter[currlist[0]] = currlist[1] for count in counter.names: fig = plt.figure() ax = fig.add_subplot(111) ax.plot(counter['date'],counter.__dict__[count]) ax.xaxis.set_major_locator(days) ax.xaxis.set_major_formatter(daysFmt) ax.xaxis.set_minor_locator(hours) ax.format_xdata = mdates.DateFormatter('%d-%H') ax.grid(True) fig.autofmt_xdate() plt.show() if __name__ == "__main__": main() Could someone please help me how to pass dates to plot() ? Thanks, Jorge
Thanks for the hint, I now have: #figure is a matplotlib Figure #bitmap is a wx.StaticBitmap w_figure, h_figure = figure.get_size_inches() w_bitmap, h_bitmap = bitmap.GetSize() dpi = int(min(w_bitmap/w_figure,h_bitmap/h_figure)) figure.set_dpi(dpi) figure.canvas.draw() w_canvas, h_canvas = figure.canvas.get_width_height() buffer = figure.canvas.tostring_rgb() bmp = wx.BitmapFromBuffer(w_canvas, h_canvas, buffer) bitmap.SetBitmap(bmp) The size and dpi lines are meant to get a proper sizing of the canvas before making a bitmap. This because I assume that the draw() converts vector graphics to raster graphics. I am not sure all this is the cleverest way but, when called from a wx.EVT_SIZE event it resizes nicely be it somewhat slow. Janwillem wrote: > > I have an application where I would like to use show in a loop but as > stated in 18.1 of the manual that does not work. > # WARNING : illustrating how NOT to use show > for i in range(10): > # make figure i > show() > So I made a workaround in a custom wxDialog with a wxStaticBitmap and a > few buttons and put the matplotlib figure in the bitmap with something > like: > wi,hi = figure.get_size_inches() > width,height = bitmap_plot.GetSize() > dpi = int(min(width/wi,height/hi)) > figure.savefig('/tmp/tmp.png',dpi = dpi) > image = wx.Image('/tmp/tmp.png',wx.BITMAP_TYPE_ANY) > bitmap = wx.BitmapFromImage(image) > bitmap_plot.SetBitmap(bitmap) > Thus scaling the figure using the dpi option of savefig and then loading > it into the wxStaticBitmap. > > To me it seems there might be a lot of unnecessary data handling. What is > the clever solution? > mant thanks > -- View this message in context: http://www.nabble.com/show-figures-in-a-loop-tp24776045p24779255.html Sent from the matplotlib - users mailing list archive at Nabble.com.
> On Sat, Aug 1, 2009 at 7:32 PM, Alan > G Isaac<ala...@gm...> wrote: >> Which reminds me, was there a decision on subplot2grid etc? >> <URL:http://sourceforge.net/mailarchive/message.php?msg_name=6e8d907b0905172009j21b5077fp242c7598ee9fb2c9%40mail.gmail.com> On 8/2/2009 1:00 AM John Hunter wrote: > There > are two pieces to this thread: the non-pythonic 1 based addressing of > the current subplot command ("don't blame me, talk to the mathworks"), > and the ability to easily specify column or row spans across the grid. > The former is a minor wart that is unlikely to change, the latter is > a significant feature that we should definitely support. I'm hoping you will "link" these two in the following way: introduce a *new* command (e.g., subplot2grid) that supports the spans *and* introduces Pythonic indexing. (Then subplot can just stick around as a less capable little brother with Matlab-style indexing for as long as you deem necessary.) Alan
On Sun, Aug 2, 2009 at 10:35 AM, John Hunter<jd...@gm...> wrote: > On Sun, Aug 2, 2009 at 9:39 AM, Mark Rubelmann<mru...@gm...> wrote: >> Thanks for the reply John. Not quite the answer I was looking for >> though.... ;) I tried your suggestion of returning True but it didn't solve >> the problem. Oh well, not the end of the world. Being a die-hard KDE user, >> I started trying to get things working with Qt. I got my animation working >> but thus far haven't been able to catch key press events. My guess is that >> I'm just missing something about how it's supposed to be done so I'll >> probably figure it out. > > You should be able to use mpl key press events even while embedding in qt oops posted in the wrong thing from my buffer. Meant to post this link http://matplotlib.sourceforge.net/search.html?q=codex+key_press_event
On Sun, Aug 2, 2009 at 9:39 AM, Mark Rubelmann<mru...@gm...> wrote: > Thanks for the reply John. Not quite the answer I was looking for > though.... ;) I tried your suggestion of returning True but it didn't solve > the problem. Oh well, not the end of the world. Being a die-hard KDE user, > I started trying to get things working with Qt. I got my animation working > but thus far haven't been able to catch key press events. My guess is that > I'm just missing something about how it's supposed to be done so I'll > probably figure it out. You should be able to use mpl key press events even while embedding in qt /Users/jdhunter/Library/Preferences/Aquamacs Emacs/customizations.el
Thanks for the reply John. Not quite the answer I was looking for though.... ;) I tried your suggestion of returning True but it didn't solve the problem. Oh well, not the end of the world. Being a die-hard KDE user, I started trying to get things working with Qt. I got my animation working but thus far haven't been able to catch key press events. My guess is that I'm just missing something about how it's supposed to be done so I'll probably figure it out. Thanks again, Mark On Sun, Aug 2, 2009 at 9:17 AM, John Hunter <jd...@gm...> wrote: > On Sun, Aug 2, 2009 at 8:08 AM, John Hunter<jd...@gm...> wrote: > > > Wriing a GUI neutal idle event handler is not easy -- I've spent some > > time on it but crashed and burned on tk -- but my guess is that the > > problem you are having in your code is that GTK expects you to return > > True is you want the func to be called again. As soon as you return > > False the event handler is terminated. You return nothing, which is > > None, which is False. A simple "return True" may cure what ails you > > vis-a-vis gtk. But pylab animation is not supported, so I suggest > > that you code to your GUI of choice for animation until we get a > > proper GUI neutral animation event API. > > I should phrase this last bit differently: I would like to support > this, and spent a fair amount of time trying to get this working > properly across backends. I think it *does* work on GTK and WX. I > encountered some problems in tkagg: since tk does not have a native > idle event loop that I could wrap, I tried to use python threading to > implement it, and ran into problems with cross thread signal handling > (including losing CTRL-C and some strange on-exit behavior) so > commented out the code, and have not attempted qt or macosx. I think > it would be great if we could abstract the idle handler and timeout > handler across the GUIs so that mpl animation would be easier, but to > date this has eluded me. So in the meantime, I would stick to the API > of the GUI of your choice until we can get proper support for this as > an mpl event. > > JDH >
On Sun, Aug 2, 2009 at 8:14 AM, Janwillem<jwe...@xs...> wrote: > > The problem: > I have files with time versus signal data of a large series of measurements. > The python application (using wxPython actually) scans the file, applies > some math (numpy/scipy) on each record of data and than must show the signal > as a plot. After clicking OK the next record of measurement data is > processed and shown. So I do need some construct that allows showing a > series of figure one after the other. My solution works ok but I would think > that there should be an elegant shortcut that directly scales the > mathplotlib figure to a bitmap that can be shown. > Does that better explain the purpose of my question? You are probably doing the best thing using wx for the event handling in this app, but you do not need to save to png. You can get access to the rendered figure in code as either a python buffer or string, using one of several *Agg backend methods, eg buffer_rgba, tostring_rgb, tostring_argb. See for example http://matplotlib.sourceforge.net/examples/pylab_examples/agg_buffer_to_array.html JDH
On Sun, Aug 2, 2009 at 8:08 AM, John Hunter<jd...@gm...> wrote: > Wriing a GUI neutal idle event handler is not easy -- I've spent some > time on it but crashed and burned on tk -- but my guess is that the > problem you are having in your code is that GTK expects you to return > True is you want the func to be called again. As soon as you return > False the event handler is terminated. You return nothing, which is > None, which is False. A simple "return True" may cure what ails you > vis-a-vis gtk. But pylab animation is not supported, so I suggest > that you code to your GUI of choice for animation until we get a > proper GUI neutral animation event API. I should phrase this last bit differently: I would like to support this, and spent a fair amount of time trying to get this working properly across backends. I think it *does* work on GTK and WX. I encountered some problems in tkagg: since tk does not have a native idle event loop that I could wrap, I tried to use python threading to implement it, and ran into problems with cross thread signal handling (including losing CTRL-C and some strange on-exit behavior) so commented out the code, and have not attempted qt or macosx. I think it would be great if we could abstract the idle handler and timeout handler across the GUIs so that mpl animation would be easier, but to date this has eluded me. So in the meantime, I would stick to the API of the GUI of your choice until we can get proper support for this as an mpl event. JDH
The problem: I have files with time versus signal data of a large series of measurements. The python application (using wxPython actually) scans the file, applies some math (numpy/scipy) on each record of data and than must show the signal as a plot. After clicking OK the next record of measurement data is processed and shown. So I do need some construct that allows showing a series of figure one after the other. My solution works ok but I would think that there should be an elegant shortcut that directly scales the mathplotlib figure to a bitmap that can be shown. Does that better explain the purpose of my question? Cheers,Janwillem Janwillem wrote: > > I have an application where I would like to use show in a loop but as > stated in 18.1 of the manual that does not work. > # WARNING : illustrating how NOT to use show > for i in range(10): > # make figure i > show() > So I made a workaround in a custom wxDialog with a wxStaticBitmap and a > few buttons and put the matplotlib figure in the bitmap with something > like: > wi,hi = figure.get_size_inches() > width,height = bitmap_plot.GetSize() > dpi = int(min(width/wi,height/hi)) > figure.savefig('/tmp/tmp.png',dpi = dpi) > image = wx.Image('/tmp/tmp.png',wx.BITMAP_TYPE_ANY) > bitmap = wx.BitmapFromImage(image) > bitmap_plot.SetBitmap(bitmap) > Thus scaling the figure using the dpi option of savefig and then loading > it into the wxStaticBitmap. > > To me it seems there might be a lot of unnecessary data handling. What is > the clever solution? > mant thanks > -- View this message in context: http://www.nabble.com/show-figures-in-a-loop-tp24776045p24777765.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Sat, Aug 1, 2009 at 12:05 PM, Mark Rubelmann<mru...@gm...> wrote: > Hi, > > I'm writing a script to plot data being read from a serial connection in > real time. I'm trying to use an idle_event callback to continually read the > incoming data and plot it. The problem is that the callback is only getting > invoked once. I found this page: > http://www.scipy.org/Cookbook/Matplotlib/Animations, which suggests using > backend-specific stuff. This is intended to be a quick-and-dirty thing > though so I was really hoping to avoid that. Here's my code: Wriing a GUI neutal idle event handler is not easy -- I've spent some time on it but crashed and burned on tk -- but my guess is that the problem you are having in your code is that GTK expects you to return True is you want the func to be called again. As soon as you return False the event handler is terminated. You return nothing, which is None, which is False. A simple "return True" may cure what ails you vis-a-vis gtk. But pylab animation is not supported, so I suggest that you code to your GUI of choice for animation until we get a proper GUI neutral animation event API. JDH
On Sun, Aug 2, 2009 at 2:14 AM, <jas...@cr...> wrote: > I'm trying to understand some of the changes in 0.99, for example, the > recommended way of getting a plot so that the axes cross at the origin > (i.e., the axes are in the middle of the plot). I see two examples that > seem to give this: > > http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html > > http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline2.html > > Is one or the other of these methods the recommended way to get a plot > with axes in the middle that cross at the origin? Or are they both good > and apply to different situations? I'll let Andrew and JJ fill in some color, since they wrote the spine and axes_grid, respectively, but both are good. The spines are in the mainline and JJ's solution is in a toolkit, so when in doubt go with something in the mainline since that is more likely to be stable. Both JJ and Andrew will be attending the scipy sprint this year (if you're going to be there be sure to stop by), and one of the items on our agenda is to incorporate their work into a unified API in the mainline. So there may be some changes to one or both approaches, but hopefully soon we will have most of the feature set of both in our main axis code. JDH
Hello Janwillem, On Sun, Aug 2, 2009 at 14:11, Janwillem<jwe...@xs...> wrote: > > I have an application where I would like to use show in a loop but as stated > in 18.1 of the manual that does not work. > # WARNING : illustrating how NOT to use show > for i in range(10): > # make figure i > show() call show() outside teh loop: for i in <list>: <make the figure> plt.show() and that would show all the figure generated up to there. > So I made a workaround in a custom wxDialog with a wxStaticBitmap and a few so, you want to embed in a WxWidgets application? > To me it seems there might be a lot of unnecessary data handling. What is > the clever solution? Is the solution above fine for you? Probably if you explain us better what you want to achieve, we can help you in a better way. Regards, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi
Dear all, I need some help :) I have been trying to plot several subplots, with the y axis being in linear and the x axis in log. I need both axis to be tight to the data. Here's what I have: import wx import scipy.io.matlab as matlab import numpy import matplotlib matplotlib.use('WXAgg') from matplotlib.pyplot import * from matplotlib.figure import Figure from matplotlib.backends.backend_wxagg import \ FigureCanvasWxAgg as FigCanvas, \ NavigationToolbar2WxAgg as NavigationToolbar from pylab import * fig = Figure((6.5, 5.0), dpi=100) axes = fig.add_subplot(xlen,ylen,pos, polar=False, autoscale_on=False) axes.errorbar(data1[0,0][0], mean(data2[n],1), (var(data2[n],1)/sqrt(len(data2[n]))), (var(data2[n],1)/sqrt(len(data2[n])))) axes.set_xscale('log') axes.axis('tight') axes.set_ylim([0,max(mean(tuning[n],1))*1.2+0.1]) I also used to have error (AttributeError: 'MaskedArray' object has no attribute 'putmask') with this code. I have been looking for solution in forum archive, and someone suggested using set_autoscale_on(False) but I tried and this didn't work. Any help would be much much appreciated! Thanks! -- View this message in context: http://www.nabble.com/Set-tight-axis-for-log----axis%28%27tight%27%29-doesn%27t-work-tp24777527p24777527.html Sent from the matplotlib - users mailing list archive at Nabble.com.
I have an application where I would like to use show in a loop but as stated in 18.1 of the manual that does not work. # WARNING : illustrating how NOT to use show for i in range(10): # make figure i show() So I made a workaround in a custom wxDialog with a wxStaticBitmap and a few buttons and put the matplotlib figure in the bitmap with something like: wi,hi = figure.get_size_inches() width,height = bitmap_plot.GetSize() dpi = int(min(width/wi,height/hi)) figure.savefig('/tmp/tmp.png',dpi = dpi) image = wx.Image('/tmp/tmp.png',wx.BITMAP_TYPE_ANY) bitmap = wx.BitmapFromImage(image) bitmap_plot.SetBitmap(bitmap) Thus scaling the figure using the dpi option of savefig and then loading it into the wxStaticBitmap. To me it seems there might be a lot of unnecessary data handling. What is the clever solution? mant thanks -- View this message in context: http://www.nabble.com/show-figures-in-a-loop-tp24776045p24776045.html Sent from the matplotlib - users mailing list archive at Nabble.com.
I'm trying to understand some of the changes in 0.99, for example, the recommended way of getting a plot so that the axes cross at the origin (i.e., the axes are in the middle of the plot). I see two examples that seem to give this: http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline2.html Is one or the other of these methods the recommended way to get a plot with axes in the middle that cross at the origin? Or are they both good and apply to different situations? Thanks, Jason -- Jason Grout
Originally, the Mac OS X backend was much faster than the other backends because of how the event loop was organized. Currently, most (I'm not sure about the wx backends) backends use the event loop in the same way as the Mac OS X backend, and are about equally fast (provided that you are using one of the Agg-based backends). There may be some minor difference in drawing quality. There may also be some difference in robustness compared to a more generic backend (not due to the backend itself, but the underlying GUI code). Last but not least, the Mac OS X backend does not need an external GUI library (like wx or pygtk); only Python itself and NumPy are needed. --Michiel --- On Sat, 8/1/09, Kaushik Ghose <Kau...@hm...> wrote: > From: Kaushik Ghose <Kau...@hm...> > Subject: [Matplotlib-users] Thanks! > To: "mat...@li..." <mat...@li...> > Date: Saturday, August 1, 2009, 9:33 AM > Hi! > > I would like to thank the matplotlib team for the new > release. I haven't had the > courage to deploy it on my main number crunching computer > it but I have it on my > regular computer and it's been fine. > > I'm especially excited to see renewed work on the 3D > plotting. > > I have a quick question: what kind of improvements should I > expect to see with > the macos backend? I ran the 3D example with and without > the backend, and things > seemed qualitatively similar. > > Best > -Kaushik > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal > Reports 2008 30-Day > trial. Simplify your report design, integration and > deployment - and focus on > what you do best, core application coding. Discover what's > new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
On Sat, Aug 1, 2009 at 7:32 PM, Alan G Isaac<ala...@gm...> wrote: > On 8/1/2009 4:07 PM Thomas Robitaille apparently wrote: >> Since matplotlib is about to hit 0.99, > > > Which reminds me, was there a decision on subplot2grid etc? > <URL:http://sourceforge.net/mailarchive/message.php?msg_name=6e8d907b0905172009j21b5077fp242c7598ee9fb2c9%40mail.gmail.com> There are lots of good suggestions in that thread -- on this issue, all the best people will be at scipy and/or participating in the sprint (Andrew who wrote the mpl sizer toolkit, JJ who does more strange and wonderful things than anyone, Ryan May who has thought through the issues and has done a lot of great work). So we'll definitely bring it up and see if we can do something about it. There are two pieces to this thread: the non-pythonic 1 based addressing of the current subplot command ("don't blame me, talk to the mathworks"), and the ability to easily specify column or row spans across the grid. The former is a minor wart that is unlikely to change, the latter is a significant feature that we should definitely support. Maybe you can join us via skype if not in person in Pasadena, and we can try an improve the current implementation. I don't imagine adding support for spans would be too hard, JDH
Hi, I've developed a GTK application under linux (debian etch) which plots my simulation data really nicely. I'm now trying to implement some caching to avoid a) loading datafiles which are 'recent' and b) replotting and redrawing data which is 'recent' (assuming this would be quicker!). I have managed the former rather easily using a fifo type structure, and the latter could be easy if I had some idea how to cache the buffer, pixels or whatever is most convenient of the canvas. For example, could I have multiple canvases, and switch which one is displayed in the gtk container? or would it be better to save the 'data' (pixels? vector graphics?) of the canvas somewhere, and copy that backwards and forwards? Any ideas? Thanks, -- Neil Pilgrim
On 8/1/2009 4:07 PM Thomas Robitaille apparently wrote: > Since matplotlib is about to hit 0.99, Which reminds me, was there a decision on subplot2grid etc? <URL:http://sourceforge.net/mailarchive/message.php?msg_name=6e8d907b0905172009j21b5077fp242c7598ee9fb2c9%40mail.gmail.com> Alan Isaac