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
|
From: Steve C. <ste...@ya...> - 2005-03-15 10:55:05
|
> > I am unable to get matplotlib animations to work properly. Some of the data from > > the previous frame is getting included. I've just fixed it in CVS, it should appear in the next matplotlib version. Or try installing from CVS if you need the fix now, and would like to test it. Steve |
From: Jean-Michel P. <jea...@ar...> - 2005-03-15 10:32:24
|
Hi, I'm having some troubles while fitting data with high order polynomials (typically order 6). I looked at the polyfit function in 'matplotlib/mlab.py' and I must say I don't understand why the least-square problem isn't solved using the matrix multiplication instead of the * multiplication. Unless I misunderstood something, shouldn't the following line: c = array(linear_algebra.inverse(Xt*X)*Xt*y) # convert back to array be rewritten like this? c = array(matrixmultiply(matrixmultiply( linear_algebra.inverse(matrixmultiply(Xt,X)), Xt), y) ) # convert back to array Thanks. JM. Philippe |
From: Joachim B H. <cj...@st...> - 2005-03-15 10:31:35
|
Steve Chaplin <ste...@ya...> writes: > > > I am unable to get matplotlib animations to work properly. Some > > > of the data from the previous frame is getting included. > > > > > > This is with version 0.72. Any ideas about what is happening? > > I ran the script with GTKCairo and it looks fine to me. > > Perhaps you are using GTKAgg which looks like it has the problem. My > guess is that its caused by using gtk.idle_add() which results in > asynchronous expose_event updates. You may have something there. I tested different backends: These show the problem: While these work fine: GtkAgg WX QtAgg WXAgg CairoAgg GTK GtkCairo (yes, really) TkAgg So for now I'll just switch to WXAgg. It's not as fast but it does the job. Thanks! (I'll assist, of course, in further testing if anyone wants to look into it) -j. |
From: Steve C. <ste...@ya...> - 2005-03-15 09:18:08
|
On Mon, 2005-03-14 at 22:38 -0800, matplotlib-users- re...@li... wrote: > > I am unable to get matplotlib animations to work properly. Some of the data from > > the previous frame is getting included. > > > > I have included some example code that shows this. When draw() is called in the > > loop, it draws the data from the previous frame for y<0.15 (ca), and from the > > current frame for larger y. The final show() does *not* lag even if set_ydata > > has not been called since the last draw(). > > > > This is with version 0.72. Any ideas about what is happening? I ran the script with GTKCairo and it looks fine to me. Perhaps you are using GTKAgg which looks like it has the problem. My guess is that its caused by using gtk.idle_add() which results in asynchronous expose_event updates. Steve |
From: Nils W. <nw...@me...> - 2005-03-15 07:54:58
|
cvs access is broken cvs -z3 -d:pserver:ano...@cv...:/cvsroot/numpy co -P Numerical cvs [checkout aborted]: unrecognized auth response from cvs.sourceforge.net: M PserverBackend::PserverBackend() Connect (Connection refused) |
From: Eliot R. S. <es...@in...> - 2005-03-14 18:36:16
|
The following test program dies with an error when used with the arguments shown -- but cutting back the argument lists by even one element allows it to work OK. So does taking out the hold(False). This is with Mac OS X, Apple Python 2.3, Matplotlib version 0.71, __revision__ '$Revision: 1.30 $' --Eliot Smith, Indiana University #------begin test program-------- from pylab import * a =[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] at=[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21] b =[0.04, 0.06, 0.05, 0.07, 0.03, 0.07, 0.08, 0.05, 0.02, 0.07, 0.07, 0.04, 0.06, 0.03, 0.01, 0.03, 0.01, 0.04, 0.03, 0.04, 0.04] bt=[0.04, 0.06, 0.05, 0.07, 0.03, 0.07, 0.08, 0.05, 0.02, 0.07, 0.07, 0.04, 0.06, 0.03, 0.01, 0.03, 0.01, 0.04, 0.03, 0.04] print len(a), len(b) hold(False) figure(1) loglog(a, b, 'bo') show() # this fails with #File "/platlib/matplotlib/axes.py", line 1169, in draw #ValueError: Cannot take log of nonpositive value #replacing a, b in the loglog call with at, bt (lists just one #item shorter) it no longer fails # Mac OS X, Apple Python 2.3 # Matplotlib version 0.71 # __revision__ '$Revision: 1.30 $' #----------end test program-------------------- |
From: Joachim B. H. <cj...@fy...> - 2005-03-14 11:41:21
|
I am unable to get matplotlib animations to work properly. Some of the data from the previous frame is getting included. I have included some example code that shows this. When draw() is called in the loop, it draws the data from the previous frame for y<0.15 (ca), and from the current frame for larger y. The final show() does *not* lag even if set_ydata has not been called since the last draw(). This is with version 0.72. Any ideas about what is happening? -- code follows # animate increasing terms in fourier expansion of y=x from pylab import * from time import sleep samples = 1000 max_k = 3 x = arange(0.0, 1.0, 1.0/samples) s = zeros((max_k,samples), Float) for k in range(1,max_k): s[k] = s[k-1]+(-1)**(k+1)*sin(pi*x*k)/k ion() # to force window creation line, = plot(x, x*1.3, linewidth=1.0) grid(True) ioff() for k in range(1,max_k): line.set_ydata(2/pi*s[k]) title('k = '+str(k)) draw() sleep(1) show() -- j |
From: <and...@ti...> - 2005-03-12 00:03:01
|
Hello NG, I have received a lot of good suggestions from you, so I would like to thank everyone for previous posts. Anyway, I'm still having troubles with Grid() (also with Matplotlib/Pylab version 0.73 RC2). If you run the= following examples: - wxcursor_demo.py - embedding_in_wx2.py There is no way to make the "g" key show the grid. It seems that this key= is not responding, or the grid is deleted immediately after its creation,= or it is never created. If you run this example: - embedding_in_wx.py The "g" key works fine, the grid is shown/hidden when you hit this key. I'm having the same problem in my application, I can not show the grid fo= r some reason, and it seems to me that these 2 problems are related. Do you have any suggestion/pointer? Thank you a lot. Andrea. |
From: Ted D. <ted...@jp...> - 2005-03-11 23:33:04
|
Jeez John if you're going to do this much work for a simple information request I may start sending you "questions" about my normal job. (thank you very much!) Thanks for the code - it's going to save us a ton of time. We're going to take the track2 demo and extend/refine/document it to be a function similar to barh. We'll have to think about the x data input for this function a little bit since it really needs to be something like x= [ [ (start1,stop1), (start2,stop2), ... ], [ (start1,stop1), (start2,stop2), ... ], ... ] which might be a little complicated for someone to set up correctly. Thanks, Ted At 02:33 PM 3/11/2005, John Hunter wrote: > >>>>> "Ted" == Ted Drain <ted...@jp...> writes: > > Ted> We have some data that we'd like to plot and I'd like to know > Ted> if matplotlib (MPL) supports this directly (I don't think it > Ted> does) or where we should start looking to implement this > Ted> capability. > >All the core functionality is there already -- you just have to plug >the pieces together. > > Ted> We want to plot time intervals in a similar way to a > Ted> horizontal bar graph. In this case, the data is when a > Ted> spacecraft is in view of a ground station. So for a list of > Ted> ground stations (the y axis), we have lists of start and stop > Ted> times that represent the view periods. So we need to: > > Ted> - show the list of ground stations (i.e. arbitrary labels) > Ted> along the Y axis like you would on a bar chart. > > Ted> - draw sets of rectangles at the right y location with the > Ted> length determined by the x data (in user controllable line > Ted> styles, colors, and fills). > >This is mostly available in barh, which by default has the left side >of the bar at 0 but optionally allows you to specify the left as an >array. So you can use barh to plot intervals with the left side >specfied by the 'left' arg and the bar width specified by the 'x' arg. >The return value is a list of Rectangles, which you can customize (set >the facecolor, edgecolor, edgewidth, transparency, etc). See >track1.py, attached below for an example. > >Note that you can use any mpl function with dates, as long as you set >the tick formatters and locators correctly; this is also illustrated >in the example code. > > Ted> - optionally label the start and stop points of each interval > Ted> with the X value for that point (in this case a date/time). > Ted> Ideally, the user would have the option of specifying a > Ted> location relative to the bar for each end point like this > Ted> (none, high, mid, low): > > Ted> High High |-----------| Mid | BAR | Mid |-----------| Low Low > >This requires you to compute the bar locations for the x, y, width, >height coords of the rectangles. You can then add text with >text(x,y,s) if you have computed y to be the bottom, center or top of >the bar. track1.py also illustrates this; but see track2.py for >examples of setting the horizontal and vertical alignment of the text, >which should vary with High, Low or Mid for the best looking graphs. > > Ted> I don't think I can currently do this in MPL so I'd like to > Ted> here ideas from John and anyone else on which classes I > Ted> should start looking at any suggestions on how this should > Ted> work. > >For real work, it helps to create custom classes to manage some of >these layout details. I did this in track2.py, which creates a custom >class derived from Rectangle that contains two Text instances >labelstart and labelstop. This design makes more sense, since the >View object knows it's left, bottom, width, height etc so it makes it >easier to do layout. The example shows how to use mpl connections to >toggle labels on and off. > >In any case, the two mpl classes you want to study are >matplotlib.patches.Rectangle and matplotlib.text.Text, and you may >want to take a close look at matplotlib.axes.Axes.barh method. > >Sometimes it's easier to write an example than it is to explain how to >use everything together. If you can think of a nice way to wrap some >of the functionality into reusable pieces, that would be great. > >JDH > > >#################### ># Begin track1.py # >#################### > >from matplotlib.dates import date2num >from matplotlib.dates import HourLocator, DateFormatter >from matplotlib.mlab import rand >from matplotlib.numerix import arange >from datetime import datetime >from pylab import figure, show > >N = 7 >labels = ['S%d'%i for i in range(N)] >colors = ('red', 'green', 'purple', 'brown', 'yellow', 'black', 'blue') > >t0 = date2num(datetime.now()) >start = t0 + rand(N) # add random days in seconds >locator = HourLocator(arange(0,24,2)) # ticks every 2 hours >formatter = DateFormatter('%H') # hour > >ylocs = arange(N) # ylocs of the bar, arbitrary > >duration = rand(N)*0.2 # random durations in fraction of day > >fig = figure() >ax = fig.add_subplot(111) >ax.xaxis.set_major_formatter(formatter) >ax.xaxis.set_major_locator(locator) > >height = 0.5 # the height of the bar, arbitrary >bars = ax.barh(duration, ylocs, height=height, left=start) >ax.set_yticks(ylocs) >ax.set_yticklabels(labels) > >for bar, color in zip(bars, colors): > bar.set_facecolor(color) > ># define some location arrays for labeling >left = start >right = left + duration >top = ylocs + height/2. >bottom = ylocs - height/2. >center = ylocs > > > ># label the 4th bar on top right >ind = 3 >note = 'hi mom' >x = right[ind] >y = top[ind] >ax.text(x,y,note) >#ax.set_xlim((min(left), max(right)+2)) >ax.grid(True) >ax.set_title('Time windows when craft visible by station') >ax.set_xlabel('Time (h)') > >show() > >#################### ># End track1.py # >#################### > > >#################### ># Begin track2.py # >#################### > >from matplotlib.artist import Artist >from matplotlib.dates import date2num >from matplotlib.dates import HourLocator, DateFormatter >from matplotlib.patches import Rectangle >from matplotlib.mlab import rand >from matplotlib.numerix import arange >from datetime import datetime > >import pylab > >class View(Rectangle): > """ > A view of when a craft is visible defined by a start and stop time > (days as float) with labeling capability. > > A rectangle will be drawn > """ > def __init__(self, ax, ind, station, start, stop, timefmt='%H:%M', > timeloc='top', height=0.5, **kwargs): > """ > ax is an axes instance -- the class will add required Artists > to to axes > > ind is the station number for yaxis positions -- the rectangles > will be > drawn with vertical centers at ind with a height height. > > station is a string label > > start and stop will be the left and right side of the > rectangles > """ > # for rects, x,y is lower left but we want ind to be the > # center > Rectangle.__init__(self, (start, ind-height/2), stop-start, > height, **kwargs) > ax.add_patch(self) > self.ind = ind > self.station = station > > self.timefmt = timefmt > self.formatter = DateFormatter(timefmt) > > self.labelstart = ax.text(start, 0, self.formatter(start), > horizontalalignment='right') > self.labelstop = ax.text(stop, 0, self.formatter(stop), > horizontalalignment='left') > > self.labelstart.set_visible(False) > self.labelstop.set_visible(False) > if timeloc is not None: > if timeloc == 'top': > y = ind + height/2. > valign = 'bottom' > elif timeloc == 'bottom': > y = ind - height/2. > valign = 'top' > elif timeloc == 'center': > y = ind > valign = 'center' > > self.labelstart.set_visible(True) > self.labelstop.set_visible(True) > > self.labelstart.set_y(y) > self.labelstop.set_y(y) > > self.labelstart.set_verticalalignment(valign) > self.labelstop.set_verticalalignment(valign) > > > > >N = 8 >t0 = date2num(datetime.now()) >start = t0 + rand(N) # add random days in seconds >locator = HourLocator(arange(0,24,2)) # ticks every 2 hours >formatter = DateFormatter('%H') # hour > >duration = rand(N)*0.2 # random durations in fraction of day >stop = start + duration >fig = pylab.figure() >ax = fig.add_subplot(111) >ax.xaxis.set_major_formatter(formatter) >ax.xaxis.set_major_locator(locator) > >views = [] >for ind, x1, x2 in zip(range(1,N+1), start, stop): > view = View(ax, ind, 'S%d'%ind, x1, x2, timeloc='center') > # Now call any Rectangle function on view instance to customize rect, > # and any Text prop on view.labelstart and view.labelstop > views.append(view) > > >yticks = [view.ind for view in views] >ylabels = [view.station for view in views] > >ax.set_yticks(yticks) >ax.set_yticklabels(ylabels) > >def toggle_labels(event): > if event.key != 't': return > toggle_labels.on = not toggle_labels.on > for view in views: > view.labelstart.set_visible(toggle_labels.on) > view.labelstop.set_visible(toggle_labels.on) > pylab.draw() >toggle_labels.on = True > ># use canvas.mpl_connect in API >pylab.connect('key_press_event', toggle_labels) > >ax.autoscale_view() # this is normally called by a plot command > >ax.set_xlim((min(start)-.1, max(stop)+.1)) >ax.set_ylim((0,N+1)) >ax.set_title("Press 't' to toggle labels") >ax.set_xlabel('Time (hours)') >ax.grid(True) >pylab.show() > > >#################### ># End track2.py # >#################### > > > > >------------------------------------------------------- >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 >_______________________________________________ >Matplotlib-users mailing list >Mat...@li... >https://lists.sourceforge.net/lists/listinfo/matplotlib-users Ted Drain Jet Propulsion Laboratory ted...@jp... |
From: John H. <jdh...@ac...> - 2005-03-11 22:44:37
|
>>>>> "Ted" == Ted Drain <ted...@jp...> writes: Ted> We have some data that we'd like to plot and I'd like to know Ted> if matplotlib (MPL) supports this directly (I don't think it Ted> does) or where we should start looking to implement this Ted> capability. All the core functionality is there already -- you just have to plug the pieces together. Ted> We want to plot time intervals in a similar way to a Ted> horizontal bar graph. In this case, the data is when a Ted> spacecraft is in view of a ground station. So for a list of Ted> ground stations (the y axis), we have lists of start and stop Ted> times that represent the view periods. So we need to: Ted> - show the list of ground stations (i.e. arbitrary labels) Ted> along the Y axis like you would on a bar chart. Ted> - draw sets of rectangles at the right y location with the Ted> length determined by the x data (in user controllable line Ted> styles, colors, and fills). This is mostly available in barh, which by default has the left side of the bar at 0 but optionally allows you to specify the left as an array. So you can use barh to plot intervals with the left side specfied by the 'left' arg and the bar width specified by the 'x' arg. The return value is a list of Rectangles, which you can customize (set the facecolor, edgecolor, edgewidth, transparency, etc). See track1.py, attached below for an example. Note that you can use any mpl function with dates, as long as you set the tick formatters and locators correctly; this is also illustrated in the example code. Ted> - optionally label the start and stop points of each interval Ted> with the X value for that point (in this case a date/time). Ted> Ideally, the user would have the option of specifying a Ted> location relative to the bar for each end point like this Ted> (none, high, mid, low): Ted> High High |-----------| Mid | BAR | Mid |-----------| Low Low This requires you to compute the bar locations for the x, y, width, height coords of the rectangles. You can then add text with text(x,y,s) if you have computed y to be the bottom, center or top of the bar. track1.py also illustrates this; but see track2.py for examples of setting the horizontal and vertical alignment of the text, which should vary with High, Low or Mid for the best looking graphs. Ted> I don't think I can currently do this in MPL so I'd like to Ted> here ideas from John and anyone else on which classes I Ted> should start looking at any suggestions on how this should Ted> work. For real work, it helps to create custom classes to manage some of these layout details. I did this in track2.py, which creates a custom class derived from Rectangle that contains two Text instances labelstart and labelstop. This design makes more sense, since the View object knows it's left, bottom, width, height etc so it makes it easier to do layout. The example shows how to use mpl connections to toggle labels on and off. In any case, the two mpl classes you want to study are matplotlib.patches.Rectangle and matplotlib.text.Text, and you may want to take a close look at matplotlib.axes.Axes.barh method. Sometimes it's easier to write an example than it is to explain how to use everything together. If you can think of a nice way to wrap some of the functionality into reusable pieces, that would be great. JDH #################### # Begin track1.py # #################### from matplotlib.dates import date2num from matplotlib.dates import HourLocator, DateFormatter from matplotlib.mlab import rand from matplotlib.numerix import arange from datetime import datetime from pylab import figure, show N = 7 labels = ['S%d'%i for i in range(N)] colors = ('red', 'green', 'purple', 'brown', 'yellow', 'black', 'blue') t0 = date2num(datetime.now()) start = t0 + rand(N) # add random days in seconds locator = HourLocator(arange(0,24,2)) # ticks every 2 hours formatter = DateFormatter('%H') # hour ylocs = arange(N) # ylocs of the bar, arbitrary duration = rand(N)*0.2 # random durations in fraction of day fig = figure() ax = fig.add_subplot(111) ax.xaxis.set_major_formatter(formatter) ax.xaxis.set_major_locator(locator) height = 0.5 # the height of the bar, arbitrary bars = ax.barh(duration, ylocs, height=height, left=start) ax.set_yticks(ylocs) ax.set_yticklabels(labels) for bar, color in zip(bars, colors): bar.set_facecolor(color) # define some location arrays for labeling left = start right = left + duration top = ylocs + height/2. bottom = ylocs - height/2. center = ylocs # label the 4th bar on top right ind = 3 note = 'hi mom' x = right[ind] y = top[ind] ax.text(x,y,note) #ax.set_xlim((min(left), max(right)+2)) ax.grid(True) ax.set_title('Time windows when craft visible by station') ax.set_xlabel('Time (h)') show() #################### # End track1.py # #################### #################### # Begin track2.py # #################### from matplotlib.artist import Artist from matplotlib.dates import date2num from matplotlib.dates import HourLocator, DateFormatter from matplotlib.patches import Rectangle from matplotlib.mlab import rand from matplotlib.numerix import arange from datetime import datetime import pylab class View(Rectangle): """ A view of when a craft is visible defined by a start and stop time (days as float) with labeling capability. A rectangle will be drawn """ def __init__(self, ax, ind, station, start, stop, timefmt='%H:%M', timeloc='top', height=0.5, **kwargs): """ ax is an axes instance -- the class will add required Artists to to axes ind is the station number for yaxis positions -- the rectangles will be drawn with vertical centers at ind with a height height. station is a string label start and stop will be the left and right side of the rectangles """ # for rects, x,y is lower left but we want ind to be the # center Rectangle.__init__(self, (start, ind-height/2), stop-start, height, **kwargs) ax.add_patch(self) self.ind = ind self.station = station self.timefmt = timefmt self.formatter = DateFormatter(timefmt) self.labelstart = ax.text(start, 0, self.formatter(start), horizontalalignment='right') self.labelstop = ax.text(stop, 0, self.formatter(stop), horizontalalignment='left') self.labelstart.set_visible(False) self.labelstop.set_visible(False) if timeloc is not None: if timeloc == 'top': y = ind + height/2. valign = 'bottom' elif timeloc == 'bottom': y = ind - height/2. valign = 'top' elif timeloc == 'center': y = ind valign = 'center' self.labelstart.set_visible(True) self.labelstop.set_visible(True) self.labelstart.set_y(y) self.labelstop.set_y(y) self.labelstart.set_verticalalignment(valign) self.labelstop.set_verticalalignment(valign) N = 8 t0 = date2num(datetime.now()) start = t0 + rand(N) # add random days in seconds locator = HourLocator(arange(0,24,2)) # ticks every 2 hours formatter = DateFormatter('%H') # hour duration = rand(N)*0.2 # random durations in fraction of day stop = start + duration fig = pylab.figure() ax = fig.add_subplot(111) ax.xaxis.set_major_formatter(formatter) ax.xaxis.set_major_locator(locator) views = [] for ind, x1, x2 in zip(range(1,N+1), start, stop): view = View(ax, ind, 'S%d'%ind, x1, x2, timeloc='center') # Now call any Rectangle function on view instance to customize rect, # and any Text prop on view.labelstart and view.labelstop views.append(view) yticks = [view.ind for view in views] ylabels = [view.station for view in views] ax.set_yticks(yticks) ax.set_yticklabels(ylabels) def toggle_labels(event): if event.key != 't': return toggle_labels.on = not toggle_labels.on for view in views: view.labelstart.set_visible(toggle_labels.on) view.labelstop.set_visible(toggle_labels.on) pylab.draw() toggle_labels.on = True # use canvas.mpl_connect in API pylab.connect('key_press_event', toggle_labels) ax.autoscale_view() # this is normally called by a plot command ax.set_xlim((min(start)-.1, max(stop)+.1)) ax.set_ylim((0,N+1)) ax.set_title("Press 't' to toggle labels") ax.set_xlabel('Time (hours)') ax.grid(True) pylab.show() #################### # End track2.py # #################### |
From: Shidai L. <shi...@gm...> - 2005-03-11 22:16:27
|
On Fri, 11 Mar 2005 14:29:19 -0500, Haibao Tang <ba...@ug...> wrote: > > Greetings all, trivial problem, don't know if it's my machine problem. > > <<< plot([1,2,3],'gx') > > fails to plot the canvas. > > Py2.3 + Pylab .70 > > Thanks. To back you up, it failed in version 7.2.1 as well. -- With best wishes! Shidai |
From: Ted D. <ted...@jp...> - 2005-03-11 21:21:42
|
We have some data that we'd like to plot and I'd like to know if matplotlib (MPL) supports this directly (I don't think it does) or where we should start looking to implement this capability. We want to plot time intervals in a similar way to a horizontal bar graph. In this case, the data is when a spacecraft is in view of a ground station. So for a list of ground stations (the y axis), we have lists of start and stop times that represent the view periods. So we need to: - show the list of ground stations (i.e. arbitrary labels) along the Y axis like you would on a bar chart. - draw sets of rectangles at the right y location with the length determined by the x data (in user controllable line styles, colors, and fills). - optionally label the start and stop points of each interval with the X value for that point (in this case a date/time). Ideally, the user would have the option of specifying a location relative to the bar for each end point like this (none, high, mid, low): High High |-----------| Mid | BAR | Mid |-----------| Low Low I don't think I can currently do this in MPL so I'd like to here ideas from John and anyone else on which classes I should start looking at any suggestions on how this should work. Thanks, Ted Ted Drain Jet Propulsion Laboratory ted...@jp... |
From: Haibao T. <ba...@ug...> - 2005-03-11 19:29:29
|
Greetings all, trivial problem, don't know if it's my machine problem. <<< plot([1,2,3],'gx') fails to plot the canvas. Py2.3 + Pylab .70 Thanks. |
From: John H. <jdh...@ac...> - 2005-03-11 17:33:27
|
>>>>> "Philippe" == Philippe COLLET <kal...@ho...> writes: Philippe> Hi, Is it normal we can't use the zoom mode on a polar? Philippe> regards, Philippe Philippe> I'm using on Windows :/: - Pyhon 2.3 - Matplotlib 0.72 - Philippe> numarray 1.2.3 - pygtk 2.4.1 - GTk re 2.6.2 rc1 - GTKagg Philippe> as backend This is a bug -- it shouldn't crash. I've fixed my local tree so that it doesn't crash (eg for the next release), but it still doesn't do anything smart. We haven't figured out yet how polar axes should respond to navigation. Last time I checked with matlab, I don't think the mathworks has either. If you have an informed opinion on this, please advise. Eg, what does it mean to zoom into a polar axes? JDH |
From: John H. <jdh...@ac...> - 2005-03-11 17:20:20
|
>>>>> "Humufr" == Humufr <hu...@ya...> writes: Humufr> Hi, I was trying to use colorbar and to place it Humufr> horizontal or vertical. I saw that I can't use the Humufr> horizontal bar because the scale is not taken in Humufr> count. Instead to have a scale between 3 and 9 (for Humufr> example) like I have with a vertical colorbar, I obtain a Humufr> scale between 0 and 1. While I can figure these problems out on my own, it always helps if you provide small examples that I can run on my machine that expose the problem. Remember the maxim: a code snippet is worth a thousand words... JDH |
From: John H. <jdh...@ac...> - 2005-03-11 17:19:03
|
>>>>> "Wendell" == Wendell Cropper <wcr...@uf...> writes: Wendell> Hi, Following the examples I have embedded a matplotlib Wendell> plot in a Tk canvas. I can't get the plot title and Wendell> xlabel to be added. I can use Tk to create text on the Wendell> canvas, but that isn't a very good solution. Could Wendell> someone show me a simple example? If you post your code, we can show you the problem Hint: where ax is an Axes or Subplot instance returned from fig.add_axes or fig.add_subplot use one of ax.set_title ax.set_xlabel ax.set_ylabel ax.text See http://matplotlib.sf.net/matplotlib.axes.html JDH |
From: Wendell C. <wcr...@uf...> - 2005-03-11 15:29:24
|
Hi, Following the examples I have embedded a matplotlib plot in a Tk canvas. I can't get the plot title and xlabel to be added. I can use Tk to create text on the canvas, but that isn't a very good solution. Could someone show me a simple example? Thanks, Wendell Cropper 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... |
From: Humufr <hu...@ya...> - 2005-03-11 15:16:57
|
Hi, I was trying to use colorbar and to place it horizontal or vertical. I saw that I can't use the horizontal bar because the scale is not taken in count. Instead to have a scale between 3 and 9 (for example) like I have with a vertical colorbar, I obtain a scale between 0 and 1. Thanks, N. |
From: John H. <jdh...@ac...> - 2005-03-11 15:03:23
|
>>>>> "Humufr" == Humufr <hu...@ya...> writes: Humufr> Hi, There are probably a bug (or I miss Humufr> another thing) in the ylabel, the fonts definitions is not Humufr> use like it is for the xlabel. The y label still small but Humufr> the x label is how I want it. Yes this is a bug -- take the line in axes.Axes.set_ylabel that reads if fontdict is not None: self.title.update(fontdict) and replace it with if fontdict is not None: label.update(fontdict) (oops) Humufr> ps: I'm using the last CVS. This is not too informative. Unfortunately, non-developer CVS lags can be so long that "latest" can be any of many different versions. Most helpful would be a revision number of the file you think is involved in the bug peds-pc311:~/python/projects/matplotlib> cvs status lib/matplotlib/axes.py Enter passphrase for key '/home/jdhunter/.ssh/id_dsa': =================================================================== File: axes.py Status: Up-to-date Working revision: 1.81 Repository revision: 1.81 /cvsroot/matplotlib/matplotlib/lib/matplotlib/axes.py,v Thanks for the report! |
From: leonardo <le...@ya...> - 2005-03-11 12:45:58
|
I'd like to draw lots of (2-point) segments (and then lots of dots/cirles) in a Tk window (probably using LineCollection), can you show me a tiny example? I've found very useful the "Screenshots" page on the site. I've tried to do for myself, but so far I've failed. In the tutorial there is: from matplotlib.backends.backend_agg import RendererAgg from matplotlib.transforms import Value dpi = Value(72.0) o = RendererAgg(400, 400, dpi) gc = o.new_gc() o.draw_lines(gc, (50, 100, 150, 200, 250), (400, 100, 300, 200, 250) ) o._renderer.write_png('saved.png') (But it's for lines composed of many segments, and it doesn't show the result in a window). Using LineCollection, but this is still wrong: from pylab import * import matplotlib.collections as col line1 = ((1,3),(4,6)) line2 = ((3,6),(2,1)) linest = (line1, line2) lc = col.LineCollection(linest) lc.show() #show() Thank you, leonardo __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ |
From: Philippe C. <kal...@ho...> - 2005-03-11 10:45:55
|
Hi, Is it normal we can't use the zoom mode on a polar? regards, Philippe I'm using on Windows :/: - Pyhon 2.3 - Matplotlib 0.72 - numarray 1.2.3 - pygtk 2.4.1 - GTk re 2.6.2 rc1 - GTKagg as backend >>>Traceback (most recent call last): File "C:\Python23\Lib\site-packages\matplotlib\backends\backend_gtk.py", line 158, in button_release_event FigureCanvasBase.button_release_event(self, x, y, event.button) File "C:\Python23\Lib\site-packages\matplotlib\backend_bases.py", line 723, in button_release_event func(event) File "C:\Python23\Lib\site-packages\matplotlib\backend_bases.py", line 1219, in release_zoom a.set_xlim((xmin, xmax)) File "C:\Python23\Lib\site-packages\matplotlib\axes.py", line 2815, in set_xlim if self.transData.get_funcx().get_type()==LOG10 and min(vmin, vmax)<=0: RuntimeError: This transformation does not support get_funcx |
From: Simon H. <sim...@jp...> - 2005-03-11 08:50:42
|
Hi, The code below when run from a file in the cgi-bin directory should generate a plot but it does not work: #!d:/apps/Python23/python import sys import matplotlib matplotlib.use('Agg') from pylab import * plot([1,2,3,4]) #print "Content-type: text/html\n\n" #print "<html>Hello world!</html>" print "Content-type: image/png\n\n" print savefig(sys.stdout) However, it does not work and I am really struggling to get matplotlib to generate a plot dynamically in a cgi-script. If anyone has done this successfully I would really appreciate some help or a simple example. I am using Windows XP and Apache 2.0.53. Many thanks, Simon |
From: Humufr <hu...@ya...> - 2005-03-10 20:41:22
|
Hi, There are probably a bug (or I miss another thing) in the ylabel, the fonts definitions is not use like it is for the xlabel. The y label still small but the x label is how I want it. ps: I'm using the last CVS. from pylab import * fonts = { 'color' : 'k', 'fontname' : 'Courier', 'fontsize' : 'xx-large' } xlabel(r'x',fonts) ylabel(r'y',fonts) show() |
From: John H. <jdh...@ac...> - 2005-03-10 15:23:49
|
>>>>> "Philippe" == Philippe COLLET <kal...@ho...> writes: Philippe> Hi, Sorry i have ever post this message in the support Philippe> section of matplotlib.sourceforge.net Maybe it was bad. Philippe> I try another time here :) Remove site-packages/matplotlib and reinstall. See, eg, http://matplotlib.sourceforge.net/faq.html#FAILURE Hope this helps! JDH |
From: Philippe C. <kal...@ho...> - 2005-03-10 14:49:55
|
Hi, Sorry i have ever post this message in the support section of matplotlib.sourceforge.net Maybe it was bad. I try another time here :) I have Python 2.3 Pygtk 2.4.1 gtk runtime environnement 2.6.2 rc1 I tryied with every version of Matplotlib since 0.63. Same error is happening: ImportError: cannot import name POLAR. I decided to edit files: - C:\Python23\Lib\site-packages\matplotlib\axes.py l.36 put , NonSeparableTransformation in comment l.37 put ,Polar in comment - C:\Python23\Lib\site-packages\matplotlib\transforms.py l.189 put ,Polar in comment l.190 put , NonSeparableTransformation in comment After that, it works well. But i have no idea why this problem happened. A colleague of mine hadn't to do it and it works perfectly. Does someone have any idea? Thanks, Philippe Here is the excecution of the python program with --verbose-helpful option C:\>python "C:\Documents and Settings\cyril_2\Bureau\simple_plot.py" --verbose-h elpful matplotlib data path C:\Python23\share\matplotlib loaded rc file C:\Python23\share\matplotlib\.matplotlibrc matplotlib version 0.72 verbose.level helpful interactive is True platform is win32 numerix numarray 1.0 Traceback (most recent call last): File "C:\Documents and Settings\cyril_2\Bureau\simple_plot.py", line 3, in ? from pylab import * File "C:\Python23\Lib\site-packages\pylab.py", line 1, in ? from matplotlib.pylab import * File "C:\Python23\Lib\site-packages\matplotlib\pylab.py", line 191, in ? from axes import Axes, PolarAxes File "C:\Python23\Lib\site-packages\matplotlib\axes.py", line 12, in ? |