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: Kosta G. <gai...@te...> - 2005-03-29 18:13:59
|
Hi, I'm trying to embed matplotlib on WX (which seems to work well for the=20 moment). I'd like to avoid the wx mainloop() by making it run in a=20 different thread than that of my main program. The classical way of doing (using show() ) doesn't work. The first time,=20 the figure becomes the main thread and my program stops running until I=20 close the window. The second time I call it though, my program remains=20 the main thread... Check the following code import threading import matplotlib matplotlib.use('WX') from matplotlib.pylab import * def f(): fig =3D Figure(figsize=3D(8,6)) data =3D range(10) plot(data) show() f() print 'here' f() print 'here' f() The screen prints 'here' only after closing the figure with the mouse.=20 Then second figure appears, but the screen prints 'end' without me=20 having to close the figure like the first one. The third figure though=20 does not appear at all! What am I doing wrong? I know I can use the show command only once, but=20 my program runs sequently and I need to plot data while it runs. I also=20 tried to run this function in a different thread but the results are=20 similar : t =3D threading.Thread(target =3D f) t.start() print 'here' tt =3D threading.Thread(target =3D f) tt.start() print 'end' If the last three lines are neglected (plot only once), then it works=20 perfectly! My main program terminates its execution and the figure stays=20 alive until I close it. When f() is called two times though, both=20 windows close when my program terminates... Does anyone have an idea of how I should do this? Thanks in advance, Kosta PS: I also ttried the example embedding-in-wx-2.py which seems to be=20 exactly my case for embedding my program in a GUI. The best would be=20 running that example in a different thread or something like that in=20 order to avoid the mainloop(). Any ideas? --=20 Kosta Gaitanis Laboratoire de T=E9l=E9communications et T=E9l=E9d=E9tection - TELE Universit=E9 catholique de Louvain UCL - FSA / ELEC B=E2timent Stevin, a.156 Place du Levant, 2 B-1348 Louvain-La-Neuve, Belgium Tel: +32 10/47.80.75 e-mail: gai...@te...=20 |
From: Jan R. G. <jr...@gm...> - 2005-03-29 18:11:24
|
any help will be very much appreciated... or could you suggest a better implementation of this graphing part On Tue, 29 Mar 2005 08:54:06 -0800, Jan Rienyer Gadil <jr...@gm...> wrote: > could anyone show me how to incorporate this example on my GUI? > > what i want to do is to implement this in a wxPanel that is part of my > wxFrame, but i am getting errors that says wxPanel instance has no > attribute GetToolBar... > > how am i going to get around with this??? > > actually, i am doing this because i'm making a graph based on some > data stored on a list. what i am thinking is to just replace t,s,and c > part of this example with my group of list : > > def plot_data(self): > # Use ths line if using a toolbar > a = self.fig.add_subplot(111) > > # Or this one if there is no toolbar > #a = Subplot(self.fig, 111) > > t = numpy.arange(0.0,3.0,0.01) > s = numpy.sin(2*numpy.pi*t) > c = numpy.cos(2*numpy.pi*t) > a.plot(t,s) > a.plot(t,c) > self.toolbar.update() > > please, i need help asap... > |
From: John H. <jdh...@ac...> - 2005-03-29 17:37:12
|
>>>>> "Humufr" == Humufr <hu...@ya...> writes: Humufr> I obtain an error message when I tried to use the quiver Humufr> sample: Traceback (most recent call last): File Humufr> "quiver_demo.py", line 8, in ? quiver( X, Y, U, V, 0.2, Humufr> color=True ) File Humufr> "/usr/local/lib/python2.4/site-packages/matplotlib/pylab.py", Humufr> line 2105, in quiver ret = gca().quiver(*args, **kwargs) Humufr> File Humufr> "/usr/local/lib/python2.4/site-packages/matplotlib/axes.py", Humufr> line 894, in quiver if C: File Humufr> "/usr/local/lib/python2.4/site-packages/numarray/generic.py", Humufr> line 490, in __nonzero__ raise RuntimeError("An array Humufr> doesn't make sense as a truth value. Use any(a) or Humufr> all(a).") RuntimeError: An array doesn't make sense as a Humufr> truth value. Use any(a) or all(a). Thanks for the report. Replace line 894 in axes.py OLD: if C: NEW if C is not None: JDH |
From: Humufr <hu...@ya...> - 2005-03-29 17:33:33
|
I obtain an error message when I tried to use the quiver sample: Traceback (most recent call last): File "quiver_demo.py", line 8, in ? quiver( X, Y, U, V, 0.2, color=True ) File "/usr/local/lib/python2.4/site-packages/matplotlib/pylab.py", line 2105, in quiver ret = gca().quiver(*args, **kwargs) File "/usr/local/lib/python2.4/site-packages/matplotlib/axes.py", line 894, in quiver if C: File "/usr/local/lib/python2.4/site-packages/numarray/generic.py", line 490, in __nonzero__ raise RuntimeError("An array doesn't make sense as a truth value. Use any(a) or all(a).") RuntimeError: An array doesn't make sense as a truth value. Use any(a) or all(a). with: cvs status lib/matplotlib/axes.py =================================================================== File: axes.py Status: Up-to-date Working revision: 1.86 Repository revision: 1.86 /cvsroot/matplotlib/matplotlib/lib/matplotlib/axes.py,v and numarray 1.2.3 N. |
From: Jeff W. <js...@fa...> - 2005-03-29 17:27:08
|
Michael Brady wrote: > When using Basemap with a Mercator projection, is there a simple way > to tell the Axes to label the y-axis ticks in latitude degrees instead > of native map coord meters? > > Here's the way I did it. I created my own Formatter: > > > class MercYAxisFormatter( matplotlib.ticker.Formatter ): > """The format function for Mercator projection Y-axis. > Translates plot y in meters to latitude. > """ > > def __init__( self, baseMap ): > self.baseMap = baseMap > > def __call__( self, y, pos=1 ): > """Return the label for tick value y at position pos. > """ > > lon, lat = self.baseMap( 0.0, y, inverse=True ) > return "%.0f" % lat > > > and added it like so: > > baseMap = Basemap( ... ) > ax.yaxis.set_major_formatter( MercYAxisFormatter( baseMap ) ) > > > This works just fine, but is there a simple one-liner in Basemap that > I'm missing that does this? > > Thanks, > > Michael > Michael: No, you're not missing anything - the functionality of basemap is rather basic at this point. Thanks for the tip though! -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/CDC R/CDC1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
From: Jessika C. <eli...@ya...> - 2005-03-29 17:18:02
|
I've been trying in vain to get the correct format for the y-axis. I am doing an intraday financial chart and would like to label the ticks every 5 minutes. I am following the example located @ http://matplotlib.sourceforge.net/screenshots/finance_work2.py Data gets loaded from the CSV file just like in the example. I have something along these lines: hours = HourLocator() minutes = MinuteLocator() timeFmt = DateFormatter('%H:%M') ax.xaxis.set_major_locator(hours) ax.xaxis.set_minor_locator(minutes) ax.xaxis.set_minor_formatter(timeFmt) ax.autoscale_view() Am I too far off target here? Because I can't get it to work. I've also looked at the user's manual (5.4 example 2: date ticking). Could someone please point me in the right direction or provide an example of how it _should_ be done? Thank you in advance. __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ |
From: Michael B. <mb...@jp...> - 2005-03-29 17:17:37
|
When using Basemap with a Mercator projection, is there a simple way to tell the Axes to label the y-axis ticks in latitude degrees instead of native map coord meters? Here's the way I did it. I created my own Formatter: class MercYAxisFormatter( matplotlib.ticker.Formatter ): """The format function for Mercator projection Y-axis. Translates plot y in meters to latitude. """ def __init__( self, baseMap ): self.baseMap = baseMap def __call__( self, y, pos=1 ): """Return the label for tick value y at position pos. """ lon, lat = self.baseMap( 0.0, y, inverse=True ) return "%.0f" % lat and added it like so: baseMap = Basemap( ... ) ax.yaxis.set_major_formatter( MercYAxisFormatter( baseMap ) ) This works just fine, but is there a simple one-liner in Basemap that I'm missing that does this? Thanks, Michael -- ======================================================================== Michael Brady Jet Propulsion Laboratory (M/S 301-140L) 4800 Oak Grove Drive Pasadena, CA 91109 E-mail: Michael.Brady@... ======================================================================== |
From: Jan R. G. <jr...@gm...> - 2005-03-29 16:54:27
|
could anyone show me how to incorporate this example on my GUI? what i want to do is to implement this in a wxPanel that is part of my wxFrame, but i am getting errors that says wxPanel instance has no attribute GetToolBar... how am i going to get around with this??? actually, i am doing this because i'm making a graph based on some data stored on a list. what i am thinking is to just replace t,s,and c part of this example with my group of list : def plot_data(self): # Use ths line if using a toolbar a = self.fig.add_subplot(111) # Or this one if there is no toolbar #a = Subplot(self.fig, 111) t = numpy.arange(0.0,3.0,0.01) s = numpy.sin(2*numpy.pi*t) c = numpy.cos(2*numpy.pi*t) a.plot(t,s) a.plot(t,c) self.toolbar.update() please, i need help asap... |
From: Jean-Michel P. <jea...@ar...> - 2005-03-29 09:28:40
|
jdh...@ac... a écrit : > We are in favor of unicode support in agg, we just haven't had the > time, knowledge or man-power to do it. fonts are hard, as you > probably know, and we have to figure out the right handling in > freetype and the ft2font wrapper, in the pycxx extension generating > code, and in the font manager. All manageable, but tough. It sounds good and I know this is a hard job even if I have no idea of how things get work in matplotlib! Having unicode without Agg is already great to me. > > Have you seen the accented character demo? > > http://matplotlib.sf.net/examples/accented_text.py Yes I have but was a little bit disappointed since this nested expression fails (matplotlib 0.72): \rm{\acute{e}} > Hopefully, someone (maybe you <wink>) will find the time to tackle > unicode support for ft2font, font_manager, and backend_agg in the > not-too-distant-future. > > JDH Believe me I would really be glad to participate to the matplotlib source code. Unfortunately I don't think I have the required skills (unless you know some introducing pages that could change my opinion?) and my company - a research centre - isn't mature enough to let us participate to open source :-(. It is even hard to make people accept open source software for everyday use... They don't feel secure if do not pay for! JM. Philippe |
From: Russell E. O. <ro...@ce...> - 2005-03-28 17:18:27
|
In article <m3r...@pe...>, John Hunter <jdh...@ac...> wrote: > >>>>> "Russell" == Russell E Owen > >>>>> <ro...@ce...> writes: > > Russell> We'd like to set up a set of plots that look something > Russell> like: PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP > Russell> PPPP PPPP > > Russell> hhh s... hhhhh s... hhh s... hhhhhh s..... > > Russell> where - each set of Ps is a 4x4 pcolor plot representing > Russell> signal on a 4x4 detector at a particular time. I.e. a 4x4 > Russell> array of solid blocks of gray. - h is a histogram - s is > Russell> the left edge of a scatter plot/strip chart > > Russell> We have the basic layout, but are missing a few > Russell> subtleties... > > Russell> If possible, when the window is resized we'd like to: - > Russell> Resize the histogram and scatterplots but not the pcolor > Russell> plots. (After all, there's no detail to zoom into in a > Russell> 4x4 pcolor plot!) - Keep the pcolor plots (Ps) square. > > Perry and I have been actively discussing the need for a physical size > Axes, rather than a relative size. This doesn't exist currently, but > might help enable something like what you want -- some axes that > resize dynamically with the figure window and some that don't.... It certainly would be very useful in our case, and for many users I'm sure. Another useful thing for wx API, Tk API, etc. users would be a simple and time-efficient way to say "update all these FigureCanvas objects now". Then one could use all the power of wx, Tk, etc.'s built in layout support, more easily mix standard GUI controls with graphs, and the whole bit. (By "time-efficient" I mean: not much worse than if all those same graphs were on one FigureCanvas object. I have no idea if a reasonable thing to attempt.) > Russell> P.S. when using the TkAgg API, is this the usual idiom > Russell> for turning off axis labels?: yls = > Russell> self.axScatter.get_yticklabels() for yl in yls: > Russell> yl.set_visible(False)... > > I just moved the set/get stuff into the Artist class so you can use it > at the API level. This is not yet in CVS, but will be soon. For now, > the way you do it will work fine, even though it may not be as pithy. Thanks! I suspect pylab users will benefit as well! Thank you very much for the improvements and the helpful answer. Regards, -- Russell |
From: John H. <jdh...@ac...> - 2005-03-27 22:01:59
|
>>>>> "Jean-Michel" == Jean-Michel Philippe <jea...@ar...> writes: Jean-Michel> Hi, Does anyone know why Agg backend does not support Jean-Michel> non-ASCII chars? I think many non-English speaking Jean-Michel> users would really appreciate to be able to use their Jean-Michel> full alphabet in graphics ;-) while taking advantage Jean-Michel> of the great Agg technique. We are in favor of unicode support in agg, we just haven't had the time, knowledge or man-power to do it. fonts are hard, as you probably know, and we have to figure out the right handling in freetype and the ft2font wrapper, in the pycxx extension generating code, and in the font manager. All manageable, but tough. Have you seen the accented character demo? http://matplotlib.sf.net/examples/accented_text.py Hopefully, someone (maybe you <wink>) will find the time to tackle unicode support for ft2font, font_manager, and backend_agg in the not-too-distant-future. JDH |
From: John H. <jdh...@ac...> - 2005-03-27 21:57:11
|
>>>>> "Russell" == Russell E Owen <ro...@ce...> writes: Russell> We'd like to set up a set of plots that look something Russell> like: PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP PPPP Russell> PPPP PPPP Russell> hhh s... hhhhh s... hhh s... hhhhhh s..... Russell> where - each set of Ps is a 4x4 pcolor plot representing Russell> signal on a 4x4 detector at a particular time. I.e. a 4x4 Russell> array of solid blocks of gray. - h is a histogram - s is Russell> the left edge of a scatter plot/strip chart Russell> We have the basic layout, but are missing a few Russell> subtleties... Russell> If possible, when the window is resized we'd like to: - Russell> Resize the histogram and scatterplots but not the pcolor Russell> plots. (After all, there's no detail to zoom into in a Russell> 4x4 pcolor plot!) - Keep the pcolor plots (Ps) square. Perry and I have been actively discussing the need for a physical size Axes, rather than a relative size. This doesn't exist currently, but might help enable something like what you want -- some axes that resize dynamically with the figure window and some that don't. The problem of creating axes where the aspect ratio is preserved even under figure resizes is important to many people, so hopefully we can get a working implementation sooner rather than later. Russell> My first thought was to set up multiple FigureCanvas Russell> objects and use tk's layout options. But the updating Russell> then looked funny (and seemed to go slower, though that Russell> may be my imagination). We're updating the displays at 2 Russell> Hz (for data coming in at 20Hz) and all the plots are Russell> related, so it's important to update them all at the same Russell> time. Russell> Any hints would be appreciated. If you wanted to turn your 4x4 pcolors into images using one means or another, you could hack something out. The matplotlib.figure.Figure.figimage command does a raw pixel dump to the Figure window, which is not resized. You would have to use it carefully but it should be doable. Eg, create Numerix arrays that were right pixel dimensions you wanted and set the scalar values of the various regions using array indexing. Not very elegant, but might be usable. The tk canvas solution you tried is another good idea, but I'm not sure how to best handle the synchronous updates problem. Russell> P.S. when using the TkAgg API, is this the usual idiom Russell> for turning off axis labels?: yls = Russell> self.axScatter.get_yticklabels() for yl in yls: Russell> yl.set_visible(False) I did not find any equivalent to Russell> the pylab.set command that automatically iterates over Russell> collections of ticks or labels. No big deal, but I'd Russell> simplify the code if I could. I just moved the set/get stuff into the Artist class so you can use it at the API level. This is not yet in CVS, but will be soon. For now, the way you do it will work fine, even though it may not be as pithy. JDH |
From: John H. <jdh...@ac...> - 2005-03-27 21:48:47
|
>>>>> "Simon" == Simon Hook <sim...@jp...> writes: Simon> I get the error: Simon> CGI ErrorThe specified CGI application misbehaved by not Simon> returning a complete set of HTTP headers. The headers it Simon> did return are: It looks like it is dying when it tries to rebuild the font cache. Did you get my response to your last message when I explained the importance of setting the MATPLOTLIBDATA and/or the HOME environment variables, especially when running in a non-standard environment such as a web app server? Have you set these variables, do the directories exist and are they writable in the environment in which the app server is running? Does the MATPLOTLIBDATA dir contain your rc file and the various default font files, eg the stuff that normally resides in share/matplotlib? http://sourceforge.net/mailarchive/message.php?msg_id=11209033 My guess is that mpl is not finding a writable directory in which to store it's cache information. Hope this helps, JDH |
From: John H. <jdh...@ac...> - 2005-03-27 21:40:22
|
>>>>> "Ben" == Ben Wilhelm <zo...@pa...> writes: Ben> I have the need to make a pcolor loglog plot. Unfortunately I Ben> can't figure out how - as near as I can tell it's impossible, Ben> pcolor loglog just plain isn't supported. It seems like the The log transformation is a property of the x and y axes, not of the plot type. Ben> ability to logify arbitrary axes would be a good idea Ben> (there's got to be *somebody* out there who wants a semilog Ben> polar projection) but I can't find it anywhere. Suggestions? Ben> Right now my best idea is to do the log transformation myself Ben> (eww) and then modify the axis legend (eww). Ben> The following code was a vague attempt to force pcolor to use Ben> loglog scale, but it crashes with the message "Aborted" - Ben> seems like a suboptimal error message. I should point out When posting code to expose a bug, it is most helpful to post a script that actually does something -- eg the "main" function in your script is never called -- as well as the contextual information like which backend you are running, platform information and so on. Most of this contextual information is provided by running a script with --verbose-helpful and reporting the output. Ben> that I'm currently using 0.72.1 since updating the corporate Ben> version would take a little work, but I haven't seen anything Ben> in the 0.73.1 docs that imply that's changed. So if it has, Ben> lemme know and I'll go get someone to update. :) Getting log transformations in the presence of non-positive data now works better than it used to -- most of the fixes in this area were in 0.72 so your version should be OK. For technical reasons, some plot types work better than others (eg plot is more robust than pcolor) in handling illegal data. But all that aside, there is no reason you can't do loglog pcolor plots, provided you make the right calls and take care to pass in legal data. The example script below illustrates how, with comments. It's tested on matplotlib-cvs on linux using GTKAgg, but I am pretty confident that it will run on 0.72.x on windows with other backends as well. Let me know. JDH import matplotlib from matplotlib import pylab # WRONG: import Numeric as Numeric # Importing Numeric or numarray manually with pylab is not # recommended. pylab includes it's own Numeric/numarray switcher in # matplotlib.numerix as controlled by the numerix rc setting. If you # import your own, you can get into trouble with array # incompatibility. Something like the following is recommended import matplotlib.numerix as nx def main(argv): # WRONG: pylab.loglog([1,100],[1,100]) # You don't really want to plot the log of this line do you? What # you want to do is set the xscale and yscale to be 'log'; see below ax = pylab.subplot(111) x = y = nx.arange(1.,100.) X,Y = matplotlib.mlab.meshgrid(x,y) # Now pass in X and Y explicitly to pcolor. The default X and Y if you # don't pass them in will be index arrays starting at 0, which can # lead to a log problem since they contain non-positive data pylab.pcolor( X, Y, X*Y, shading = "flat" ) # make sure the axis limits are positive before setting the log # scale since the transformations also apply to the axis tick locations pylab.axis([1., 100., 1., 100.]) # Now set the xaxis and yaxis to a log scale pylab.set(ax, xscale='log', yscale='log') #pylab.savefig("/home/zorba/stats/color.png") main([]) pylab.show() |
From: Leighton P. <lp...@sc...> - 2005-03-25 14:24:20
|
Hi Matt,=0D=0A=0D=0AOn Thu, 2005-03-24 at 22:48 -0600, Matt Newville wrote:=0D= =0A> I'm no expert in wxPython or matplotlib, but there are a few=0D=0A> po= ssible problems with your script:=0D=0A> - For the timing method, I think = the issue is simply how fast=20=0D=0A> you can send Timer events. You'r= e doing them every 20ms,=20=0D=0A> which is pretty fast (I'm willing to = take the blame for=20=0D=0A> sending you an example that goes that fast!= ). If you change =20=0D=0A> that to 200ms, I'll bet you will see more u= pdates.=20=0D=0A=0D=0AThe timer was working pretty well on all three system= s at 20ms intervals=0D=0A- no blame to apportion there! ;)=0D=0A=0D=0A> - = The Loop method [...]=0D=0A> - The Custom Event [...]=0D=0A> For all these= , I would think that adding=0D=0A> self.Update()=0D=0A> should help. =0D= =0A=0D=0AI added self.Update() to each frame on the update event, and that = fixed=0D=0Amy problem on OS X. I'm guessing that the wx.Timer events force = an=0D=0Aupdate=3F=0D=0A=0D=0A> I think you want to avoid the Loop method, a= s it can block other=0D=0A> widget events. I believe that what you want is = to replot the=0D=0A> figure when (a) the data has changed and (b) some mini= mum time=0D=0A> has elapsed since the last drawing. One approach is to use= a=0D=0A> timer to periodically check (this sets the minimun time) for new=0D= =0A> data, and redraw the plot when there's new data.=0D=0A=0D=0AI'm less b= othered about the minimum time, though I do like the idea of=0D=0Asetting u= p a timer in the monitor frame, and polling for a changed state=0D=0Ain the= object it's monitoring, and might change part of my design to=0D=0Aimpleme= nt that in the 'real' code.=0D=0A=0D=0A> Another approach is to trigger on = changes in the data, possibly=0D=0A> saving the timestamp when a redraw is = done so as to not draw too=0D=0A> often. Which method to use probably depe= nds on how easily it is=0D=0A> to detect and act upon changes to the data. = =20=0D=0A=0D=0AThis is what I'm doing in the full application (bar the time= stamp) at=0D=0Athe moment - it's under a 'data-push' model at the moment.=0D= =0A=0D=0A> Finally, you may also consider putting the data-intensive code i= n a separate=0D=0A> thread from the GUI.=0D=0A=0D=0AAh, threads... I'll st= ick to the self.Update() for now ;)=0D=0A=0D=0A> But I think the main issue= is to not try to redraw the plot 50=0D=0A> times per second. ;).=0D=0A=0D=0A= <grin> My algorithm coding isn't good enough for that to be an issue,=0D=0A= anyway. But I think the root of the cross-platform problem might lie=0D=0A= elsewhere, and the different steps I had to take on each OSs are=0D=0Apuzzl= ing me. On Windows I didn't need to add self.Update() calls, as=0D=0Aevery= thing worked first time. On Linux, the plot updated without resort=0D=0Ato= self.Update(), but the buttons didn't - and adding the self.Update()=0D=0A= calls only caused the buttons to appear blank, rather than not=0D=0Achange.= =2E.=20=0D=0A=0D=0AOn OS X, however, adding the self.Update() calls made it= run exactly how=0D=0AI wanted (and expected). I'm guessing that the wx.Ti= mer events are=0D=0Apropagating Update() calls to both frames within wx, wh= ile the other two=0D=0Amethods aren't. Except in Windows. Hmm... more re= ading ahead for me.=0D=0A=0D=0AStill, most importantly (for me) my problem = is solved, and I've learnt=0D=0Athings about wx events, and cross-platform = issues. Many thanks again=0D=0Afor your help, Matt - I'd have been flounde= ring much longer without it.=0D=0ANow I'll try to solve some of the non-mat= plotlib-related issues ;)=0D=0A=0D=0ACheers,=0D=0A=0D=0A--=20=0D=0ADr Leigh= ton Pritchard AMRSC=0D=0AD131, Plant-Pathogen Interactions, Scottish Crop R= esearch Institute=0D=0AInvergowrie, Dundee, Scotland, DD2 5DA, UK=0D=0AT: += 44 (0)1382 562731 x2405 F: +44 (0)1382 568578=0D=0AE: lp...@sc....u= k W: http://bioinf.scri.sari.ac.uk/lp=0D=0AGPG/PGP: FEFC205C E58BA41B ht= tp://www.keyserver.net =20=0D=0A(If the signature does not verif= y, please remove the SCRI disclaimer)=0D=0A_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _=0D=0A=0D=0ADISCLAIMER:=0D=0A=0D= =0AThis email is from the Scottish Crop Research Institute, but the views =0D= =0Aexpressed by the sender are not necessarily the views of SCRI and its =0D= =0Asubsidiaries. This email and any files transmitted with it are confiden= tial=20=0D=0Ato the intended recipient at the e-mail address to which it ha= s been=20=0D=0Aaddressed. It may not be disclosed or used by any other tha= n that addressee.=0D=0AIf you are not the intended recipient you are reques= ted to preserve this=20=0D=0Aconfidentiality and you must not use, disclose= , copy, print or rely on this=20=0D=0Ae-mail in any way. Please notify post= ma...@sc... quoting the=20=0D=0Aname of the sender and delete th= e email from your system.=0D=0A=0D=0AAlthough SCRI has taken reasonable pre= cautions to ensure no viruses are=20=0D=0Apresent in this email, neither th= e Institute nor the sender accepts any=20=0D=0Aresponsibility for any virus= es, and it is your responsibility to scan the email=20=0D=0Aand the attachm= ents (if any).=0D=0A |
From: Matt N. <new...@ca...> - 2005-03-25 04:50:21
|
Hi Leighton, > The Loop method and custom event methods work fine on Windows. > On Linux, they dynamically update the plot, but not the button > label. On OS X, they do nothing, and only appear to update > the plot after the loops end. I'm no expert in wxPython or matplotlib, but there are a few possible problems with your script: - For the timing method, I think the issue is simply how fast you can send Timer events. You're doing them every 20ms, which is pretty fast (I'm willing to take the blame for sending you an example that goes that fast!). If you change that to 200ms, I'll bet you will see more updates. - The Loop method runs a for-loop which may not allow other wx events to be processed, such as changing a Button label. - The Custom Event uses a python for-loop, so I think it's not very different from the Loop method in that it's liable to drop events. For all these, I would think that adding self.Update() should help. This is supposed to repaint the whole wxWidget. That will take time, but should really update all widgets. But it seems that this is not foolproof, and that it can lose events: I don't know why this is. > Matt's solution works on OS X, but I'm afraid I didn't specify > what my goal was particularly well. I'm aiming to dynamically > update a matplotlib plot embedded within a wx.Panel (or > wx.Frame) from another object, whose internal state is > changing so that the calling object's internal state is > reflected in the matplotlib plot. The wx.Timer solution > doesn't seem appropriate for that (though if I'm wrong, I'm > happy to take advice). > > After some reading around, I worked up two alternatives for > updating the plot from another object. > > 1) wx.Timer, as per Matt > 2) Loop, and pass the value of the loop counter > 3) A custom wx event, bound to the update method I think you want to avoid the Loop method, as it can block other widget events. I believe that what you want is to replot the figure when (a) the data has changed and (b) some minimum time has elapsed since the last drawing. One approach is to use a timer to periodically check (this sets the minimun time) for new data, and redraw the plot when there's new data. Another approach is to trigger on changes in the data, possibly saving the timestamp when a redraw is done so as to not draw too often. Which method to use probably depends on how easily it is to detect and act upon changes to the data. Finally, you may also consider putting the data-intensive code in a separate thread from the GUI. But I think the main issue is to not try to redraw the plot 50 times per second. ;). Hope that helps, --Matt |
From: Scott H. <sc...@cs...> - 2005-03-24 19:45:29
|
On Thu, 2005-03-24 at 01:19 -0800, Andrew Straw wrote: > How long are you waiting and how beefy is your processor? Compiling=20 > C++ is pretty compiler intensive... Yeah, I figured that out late last night after digging through distutils and most of matplotlib's extensions. Then I noticed the one it was "hanging" on was a 1000+ line c++ file and I banged my head on my desk. Sorry for the noise. Cool program. Oh, and on another note. For those using debian/ubuntu. Be sure to install python-{numarray,numerics}-ext. Otherwise matplotlib breaks. =20 --=20 Scott Henson <sc...@cs...> |
From: Simon H. <sim...@jp...> - 2005-03-24 15:30:11
|
Hi, I have active python pages and regular cgi-python working with iis. However, when I try and call the script: #!d:\apps\python23\python.exe from pylab import * plot([1,2,3,4]) savefig('tmp.png') print "Content-type: text/html\n" print "<html><B>Hello world2!</B></html>" I get the error: CGI ErrorThe specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: Traceback (most recent call last): File "D:\Inetpub\pyscripts\plot.py", line 3, in ? from pylab import * File "D:\apps\Python23\Lib\site-packages\pylab.py", line 1, in ? from matplotlib.pylab import * File "D:\apps\Python23\Lib\site-packages\matplotlib\pylab.py", line 193, in ? from axes import Axes, PolarAxes File "D:\apps\Python23\Lib\site-packages\matplotlib\axes.py", line 12, in ? from axis import XAxis, YAxis File "D:\apps\Python23\Lib\site-packages\matplotlib\axis.py", line 20, in ? from font_manager import FontProperties File "D:\apps\Python23\Lib\site-packages\matplotlib\font_manager.py", line 957, in ? fontManager = FontManager() File "D:\apps\Python23\Lib\site-packages\matplotlib\font_manager.py", line 801, in __init__ rebuild() File "D Part of the problem seems related to accessing the default font? Many thanks, Simon |
From: Leighton P. <lp...@sc...> - 2005-03-24 14:37:07
|
Hi,=0D=0A=0D=0AMany thanks (again) to Matt for his suggestions - I had a "D= 'oh" moment=0D=0Awhen it was pointed out where I was calling the update fro= m.=0D=0A=0D=0AMatt's solution works on OS X, but I'm afraid I didn't specif= y what my=0D=0Agoal was particularly well. I'm aiming to dynamically updat= e a=0D=0Amatplotlib plot embedded within a wx.Panel (or wx.Frame) from anot= her=0D=0Aobject, whose internal state is changing so that the calling objec= t's=0D=0Ainternal state is reflected in the matplotlib plot. The wx.Timer=0D= =0Asolution doesn't seem appropriate for that (though if I'm wrong, I'm=0D=0A= happy to take advice).=0D=0A=0D=0AAfter some reading around, I worked up tw= o alternatives for updating the=0D=0Aplot from another object.=0D=0A=0D=0A1= ) wx.Timer, as per Matt=0D=0A2) Loop, and pass the value of the loop counte= r=0D=0A3) A custom wx event, bound to the update method=0D=0A=0D=0AThe code= at http://widdowquinn.pwp.blueyonder.co.uk/wxtest.py implements=0D=0Aall t= hree methods, and how effective they are appears to be OS-=0D=0Adependent:=0D= =0A=0D=0AThe wx.Timer method works on Windows (XP SP2), Linux (FC3) and OS = X=0D=0A(10.3)=0D=0A=0D=0AThe Loop method and custom event methods work fine= on Windows. On=0D=0ALinux, they dynamically update the plot, but not the = button label. On=0D=0AOS X, they do nothing, and only appear to update the= plot after the=0D=0Aloops end.=0D=0A=0D=0ADoes anyone here have any ideas = on how I could progress further on=0D=0Agetting this to run, and update cor= rectly under OS X=3F Or should I go=0D=0Aand bug the wxPython-Users list a= bout it=3F ;)=0D=0A=0D=0AFor info, all three systems are using Python 2.3.5= =2E, matplotlib 0.73.1,=0D=0Aand wxPython 2.5.3.1.=0D=0A=0D=0ACheers,=0D=0A=0D= =0A--=20=0D=0ADr Leighton Pritchard AMRSC=0D=0AD131, Plant-Pathogen Interac= tions, Scottish Crop Research Institute=0D=0AInvergowrie, Dundee, Scotland,= DD2 5DA, UK=0D=0AT: +44 (0)1382 562731 x2405 F: +44 (0)1382 568578=0D=0AE:= lp...@sc... W: http://bioinf.scri.sari.ac.uk/lp=0D=0AGPG/PGP:= FEFC205C E58BA41B http://www.keyserver.net =20=0D=0A(If the si= gnature does not verify, please remove the SCRI disclaimer)=0D=0A_ _ _ _ _ = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _=0D=0A=0D=0A= DISCLAIMER:=0D=0A=0D=0AThis email is from the Scottish Crop Research Instit= ute, but the views=20=0D=0Aexpressed by the sender are not necessarily the = views of SCRI and its=20=0D=0Asubsidiaries. This email and any files trans= mitted with it are confidential=20=0D=0Ato the intended recipient at the e-= mail address to which it has been=20=0D=0Aaddressed. It may not be disclos= ed or used by any other than that addressee.=0D=0AIf you are not the intend= ed recipient you are requested to preserve this=20=0D=0Aconfidentiality and= you must not use, disclose, copy, print or rely on this=20=0D=0Ae-mail in = any way. Please notify pos...@sc... quoting the=20=0D=0Aname = of the sender and delete the email from your system.=0D=0A=0D=0AAlthough SC= RI has taken reasonable precautions to ensure no viruses are=20=0D=0Apresen= t in this email, neither the Institute nor the sender accepts any=20=0D=0Ar= esponsibility for any viruses, and it is your responsibility to scan the em= ail=20=0D=0Aand the attachments (if any).=0D=0A |
From: Andrew S. <str...@as...> - 2005-03-24 09:19:26
|
How long are you waiting and how beefy is your processor? Compiling C++ is pretty compiler intensive... On Mar 23, 2005, at 5:21 PM, Scott Henson wrote: > Hi, I'm trying to build matplotlib on an ubuntu hoary powerpc system > using python2.4, and I'm running into what seems to be some kind of > infinite loop? Basically the compiler just sits there and eats up all > my processor with no further output to the screen. I am compiling an > ubuntu package that I found, but it is matplotlib 0.73.1. I reproduced > the bug with a simple python2.4 setup.py build and it still failed in > the same way. Here is the output of that command. > > scotth@archangel:~/Hacking/python-matplotlib/matplotlib-0.73.1$ > python2.4 setup.py build > running build > running build_py > running build_ext > building 'matplotlib._na_transforms' extension > gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall > -Wstrict-prototypes -fPIC -Isrc -I. -I/usr/local/include -I/usr/include > -I/usr/include/python2.4 -c src/_na_transforms.cpp -o > build/temp.linux-ppc-2.4/src/_na_transforms.o -DNUMARRAY=1 > In file included from /usr/include/python2.4/Python.h:8, > from CXX/Objects.hxx:9, > from CXX/Extensions.hxx:18, > from src/_transforms.h:12, > from src/_na_transforms.cpp:2: > /usr/include/python2.4/pyconfig.h:832:1: warning: "_POSIX_C_SOURCE" > redefined > In file included from /usr/include/c > ++/3.3/powerpc-linux/bits/os_defines.h:39, > from /usr/include/c++/3.3/powerpc-linux/bits/c > ++config.h:35, > from /usr/include/c++/3.3/functional:53, > from src/_na_transforms.cpp:1: > /usr/include/features.h:131:1: warning: this is the location of the > previous definition > > > > After this it just hangs and my cpu is pegged at 100%. Any thoughts? > Thanks. > > -- > Scott Henson <sc...@cs...> |
From: Ben W. <zo...@pa...> - 2005-03-24 04:53:22
|
I have the need to make a pcolor loglog plot. Unfortunately I can't figure out how - as near as I can tell it's impossible, pcolor loglog just plain isn't supported. It seems like the ability to logify arbitrary axes would be a good idea (there's got to be *somebody* out there who wants a semilog polar projection) but I can't find it anywhere. Suggestions? Right now my best idea is to do the log transformation myself (eww) and then modify the axis legend (eww). The following code was a vague attempt to force pcolor to use loglog scale, but it crashes with the message "Aborted" - seems like a suboptimal error message. I should point out that I'm currently using 0.72.1 since updating the corporate version would take a little work, but I haven't seen anything in the 0.73.1 docs that imply that's changed. So if it has, lemme know and I'll go get someone to update. :) #!/usr/bin/python from matplotlib import pylab import Numeric as Numeric import math as math def main(argv): pylab.loglog([1,100],[1,100]) pylab.pcolor( Numeric.array( [ [ x + y for x in range(100) ] for y in range(100) ] ), shading = "flat" ) pylab.savefig("/home/zorba/stats/color.png") return -Ben |
From: Scott H. <sc...@cs...> - 2005-03-24 01:21:20
|
Hi, I'm trying to build matplotlib on an ubuntu hoary powerpc system using python2.4, and I'm running into what seems to be some kind of infinite loop? Basically the compiler just sits there and eats up all my processor with no further output to the screen. I am compiling an ubuntu package that I found, but it is matplotlib 0.73.1. I reproduced the bug with a simple python2.4 setup.py build and it still failed in the same way. Here is the output of that command. scotth@archangel:~/Hacking/python-matplotlib/matplotlib-0.73.1$ python2.4 setup.py build running build running build_py running build_ext building 'matplotlib._na_transforms' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -Isrc -I. -I/usr/local/include -I/usr/include -I/usr/include/python2.4 -c src/_na_transforms.cpp -o build/temp.linux-ppc-2.4/src/_na_transforms.o -DNUMARRAY=3D1 In file included from /usr/include/python2.4/Python.h:8, from CXX/Objects.hxx:9, from CXX/Extensions.hxx:18, from src/_transforms.h:12, from src/_na_transforms.cpp:2: /usr/include/python2.4/pyconfig.h:832:1: warning: "_POSIX_C_SOURCE" redefined In file included from /usr/include/c ++/3.3/powerpc-linux/bits/os_defines.h:39, from /usr/include/c++/3.3/powerpc-linux/bits/c ++config.h:35, from /usr/include/c++/3.3/functional:53, from src/_na_transforms.cpp:1: /usr/include/features.h:131:1: warning: this is the location of the previous definition After this it just hangs and my cpu is pegged at 100%. Any thoughts? Thanks. --=20 Scott Henson <sc...@cs...> |
From: James B. <bo...@ll...> - 2005-03-23 20:54:15
|
Greg, Thanks for the help. Sometimes it just takes a bit of hand holding to get things right. I was trying the sequence of steps you indicated, but I was making a stupid mistake in the data specification dictionary and mis-interpreted the subsequent error. Your comment made me look harder at the details and all worked fine. FWIW I have enclosed code to make a matplotlib color map data dictionary from a GMT .cpt file. As I indicated previously these colormaps are found at: http://craik.shef.ac.uk/cpt-city/ there are well over a hundred from which to choose. The code is only lightly used and not very elegant. So if you download, for example, the 'spectrum-light.cpt' file from http://craik.shef.ac.uk/cpt-city/views/hueshift.html then run; cdict = gmtcolormapPylab.gmtcolormapPylab('spectrum-light') colormap = pylab.cm.colors.LinearSegmentedColormap('spectrum- light'',cdict,pylab.rcParams['image.lut']) pylab.contourf(XX,YY,ZZ,cmap=colormap) you will get filled contours with the indicated colorTable. Thanks again. --Jim def gmtcolormapPylab(fileName,GMTPath = None): import colorsys import Numeric N = Numeric if type(GMTPath) == type(None): filePath = '/Volumes/IBM1/gmt4/GMT4.0b/share/cpt/'+ fileName +'.cpt' else: filePath = GMTPath+'/'+ fileName +'.cpt' try: f = open(filePath) except: print 'file ',filePath, 'not found' return None lines = f.readlines() f.close() x = [] r = [] g = [] b = [] colorModel = 'RGB' for l in lines: ls = l.split() if l[0] == '#': if ls[-1] == 'HSV': colorModel = 'HSV' continue else: continue if ls[0] == 'B' or ls[0] == 'F' or ls[0] == 'N': pass else: x.append(float(ls[0])) r.append(float(ls[1])) g.append(float(ls[2])) b.append(float(ls[3])) xtemp = float(ls[4]) rtemp = float(ls[5]) gtemp = float(ls[6]) btemp = float(ls[7]) x.append(xtemp) r.append(rtemp) g.append(gtemp) b.append(btemp) nTable = len(r) x = N.array( x , N.Float) r = N.array( r , N.Float) g = N.array( g , N.Float) b = N.array( b , N.Float) if colorModel == 'HSV': for i in range(r.shape[0]): rr,gg,bb = colorsys.hsv_to_rgb(r[i]/360.,g[i],b[i]) r[i] = rr ; g[i] = gg ; b[i] = bb if colorModel == 'HSV': for i in range(r.shape[0]): rr,gg,bb = colorsys.hsv_to_rgb(r[i]/360.,g[i],b[i]) r[i] = rr ; g[i] = gg ; b[i] = bb if colorModel == 'RGB': r = r/255. g = g/255. b = b/255. xNorm = (x - x[0])/(x[-1] - x[0]) red = [] blue = [] green = [] for i in range(len(x)): red.append([xNorm[i],r[i],r[i]]) green.append([xNorm[i],g[i],g[i]]) blue.append([xNorm[i],b[i],b[i]]) colorDict = {'red':red, 'green':green, 'blue':blue} return (colorDict) On Mar 23, 2005, at 9:47 AM, Greg Novak wrote: > * James Boyle <bo...@ll...> wrote: >> I would like to be able to define a new colormap dynamically, that >> is without altering code in cm.py. It would not appear to be too >> difficult to some one who knew what they were doing. I have made >> some attempts following the code in cm.py and other places, but I do >> not seem to be able to get the normalization correct. > > Do you mean that you're having trouble with the > LinearSegmentedColormap function? I've had to do the same thing, and > I've included below my code to generate two colormaps, one is the same > as "hot" but reversed, and the other fades from read to blue. The > form seems to be: > > data = {'red': ((0,r0,r0), (i1, r1, r1), (i2, r2, r2), ... (1, rn, > rn)), > 'green': ... similar, 'blue': ... similar} > > colormap = pylab.cm.colors.LinearSegmentedColormap('colormap', > data, > > pylab.rcParams['image.lut']) > > where i1, i2... are independent variable values from zero to 1, and > r1, r2... are red values from zero to one associated with that > variable value. Each red value appears twice to allow for > discontinuous functions, but I haen't had to use that. > >> I know that I could just put the data into cm.py but I would rather >> not have to remember to alter this code for every release of >> matplotlib and I am sure most people do not want my colormaps. > > One of the things I like about python is that you can stuff things > into other namespaces without altering the original code. This is > probably not recommended and will break things, etc, but I use it to > add functionality that I consider to be missing from the software I > use. This allows me to forget whether the function is my own > extension to the package or a "native" function in the package. > > Ie, I'm sure that you don't want to be typing things like: > > subplot(211); pcolor(data_1,cmap=cm.hot) > subplot(212); pcolor(data_2,cmap=mycoolcolormaps.map) > > because then you'll have to remember which colormaps are in which > place. So you could do something similar to this: > > # Add some stuff to the scipy namespace > def lrange(l, h, dex): > """Log-spaced array""" > return 10**scipy.arange(scipy.log10(l), scipy.log10(h), dex) > scipy.lrange = lrange > >> I have used GMT (Generic Mapping Tools) extensively in the past and >> have code to translate the GMT color map into a form usable by >> matplotlib. > > I don't have anything to offer, but I'd like more colormaps, too, so > I'm interested in whatever comes out of this discussion... > > Greg > |
From: Travis B. <td...@fa...> - 2005-03-23 18:03:16
|
Thanks, the script I linked is actually a matplotlib screenshot script and does require some extra stuff. My extraneous labels problem was fixed when I applied a null format to the Upper axis, it was my mistake, I just hadn't done that. Best, Travis On Wed, 23 Mar 2005 11:05:11 -0500, "Darren Dale" <dd...@co...> said: > On Tuesday 22 March 2005 05:53 pm, Travis Brady wrote: > > Hi all, > > > > I'm making a plot with two axes (axUpper and axLower) that is a bit of a > > copy of John's financial plot in > > http://matplotlib.sourceforge.net/screenshots/finance_work2.py. > > axUpper has it's y axis on the left and axLower has it on the right and > > each of these sets of labels has an extraneous bit of a date label on > > it. > > axUpper has a chunk of 'February' at the point where axUpper and axLower > > meet and the axLower labels have an extra bit of '02' at the same spot. > > > > Anyone have an idea of why that might be? > > It might be related to a bug that I tried to correct last week. I cant > run the > script you posted: > > Traceback (most recent call last): > File "finance_work2.py", line 14, in ? > from helpers import load_quotes, movavg, fill_over, random_signal > ImportError: No module named helpers > > First, would you link an image of the plot? I could also use a barebones > script that duplicates the behavior. > > -- > > Darren > > > ------------------------------------------------------- > This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005 > Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows > Embedded(r) & Windows Mobile(tm) platforms, applications & content. > Register > by 3/29 & save $300 > http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op=click > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Travis Brady td...@fa... |
From: Greg N. <no...@uc...> - 2005-03-23 17:49:49
|
* James Boyle <bo...@ll...> wrote: > I would like to be able to define a new colormap dynamically, that > is without altering code in cm.py. It would not appear to be too > difficult to some one who knew what they were doing. I have made > some attempts following the code in cm.py and other places, but I do > not seem to be able to get the normalization correct. Do you mean that you're having trouble with the LinearSegmentedColormap function? I've had to do the same thing, and I've included below my code to generate two colormaps, one is the same as "hot" but reversed, and the other fades from read to blue. The form seems to be: data = {'red': ((0,r0,r0), (i1, r1, r1), (i2, r2, r2), ... (1, rn, rn)), 'green': ... similar, 'blue': ... similar} colormap = pylab.cm.colors.LinearSegmentedColormap('colormap', data, pylab.rcParams['image.lut']) where i1, i2... are independent variable values from zero to 1, and r1, r2... are red values from zero to one associated with that variable value. Each red value appears twice to allow for discontinuous functions, but I haen't had to use that. > I know that I could just put the data into cm.py but I would rather > not have to remember to alter this code for every release of > matplotlib and I am sure most people do not want my colormaps. One of the things I like about python is that you can stuff things into other namespaces without altering the original code. This is probably not recommended and will break things, etc, but I use it to add functionality that I consider to be missing from the software I use. This allows me to forget whether the function is my own extension to the package or a "native" function in the package. Ie, I'm sure that you don't want to be typing things like: subplot(211); pcolor(data_1,cmap=cm.hot) subplot(212); pcolor(data_2,cmap=mycoolcolormaps.map) because then you'll have to remember which colormaps are in which place. So you could do something similar to this: # Add some stuff to the scipy namespace def lrange(l, h, dex): """Log-spaced array""" return 10**scipy.arange(scipy.log10(l), scipy.log10(h), dex) scipy.lrange = lrange > I have used GMT (Generic Mapping Tools) extensively in the past and > have code to translate the GMT color map into a form usable by > matplotlib. I don't have anything to offer, but I'd like more colormaps, too, so I'm interested in whatever comes out of this discussion... Greg |