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
(4) |
2
(3) |
3
(3) |
4
(5) |
5
(1) |
6
|
7
(5) |
8
(1) |
9
(3) |
10
(3) |
11
(15) |
12
(10) |
13
(2) |
14
|
15
|
16
(2) |
17
(3) |
18
|
19
|
20
(3) |
21
(1) |
22
(5) |
23
(5) |
24
|
25
(3) |
26
|
27
(1) |
28
|
29
|
|
|
|
|
|
|
I occasionally use the scatter() function to make light curves of astronomical targets. The scale of the x-axis is often given in days with a range of 0.54 - 0.68 days. The y-axis is in counts. This type of data produces unusual scatter plots with the blue symbols being very elongated ovals (in the x-direction). Are there plans to change this behavior - maybe by drawing the symbols in device space instead of data or user space? -- Paul -- Paul Barrett, PhD Space Telescope Science Institute Phone: 410-338-4475 ESS/Science Software Branch FAX: 410-338-4767 Baltimore, MD 21218
>>>>> "John" == John Gill <jn...@eu...> writes: John> I have some plots I'd like to print out and they would make John> better use of the paper if they were done landscape. John> Can the postscript backend do this? Hi John, I haven't had time to take a close look at this. My initial suggestions is to experiment with the paper size import matplotlib matplotlib.use('PS') import matplotlib.backends.backend_ps as backend_ps backend_ps.defaultPaperSize = 11,8.5 # default is 8.5, 11 You may also have to specify a landscape portrait at print time, or rotate it. I'll take a closer look later. JDH
>>>>> "derek" == derek bandler <d_b...@ho...> writes: derek> I am interested in using Matplotlib for real-time derek> updating plot applications. My concern is with system load derek> issues (they're pretty high). Using the code below, which derek> came off of an earlier posting to this list, on a pc (2.4 derek> gig processor) memory usage ranges from 20 - 50+ megs derek> (there's a cycling pattern) and 30-40% of the cpu is being derek> used for this basic app. If left to run for 20 minutes or derek> so, it seems to crash (entire screen turns grey and reboot derek> is required to get machine back to working order). I answered this problem on the support request you submitted to sourceforge a couple of days ago. I'll paste in my response from the sourceforge site Date: 2004年02月06日 14:22 Sender: jdh2358 Logged In: YES user_id=395152 Thanks for the bug report! I have spent a lot of time optimizing matplotlib for pltotting and interacting with large data sets, but not for frequently redrawing small data sets. Fortunately, I was able to replicate the bug on my system. I identified a memory leak in pygtk in a function I use for rotating tick labels. It turns out almost all the CPU usuage (and memory) was for repeatedly computing layout information, rotations, and so on for text onthe tick labels. Since these rarely change (eg, in system demo) I cache all the relevant information. I also cache the result that is causing the memory leak in pygtk, so repeated calls will not drain memory. The result is a system demo with CPU usage reduced from 30-40% to 4-8% and memory consumption reduced from a growing memory leak to a stable 1.2%. Not bad. Please let me know if you continue to experience performance issues. I I have updated CVS. I you have trouble accessing CVS, email me at jdh...@ac... and I'll send you a snapshot. I have no idea about the solaris redraw problem currently JDH Date: 2004年02月06日 15:51 Sender: jdh2358 Logged In: YES user_id=395152 I tracked down the memory leak in pygtk. I you are intersting in patching your pygtk, the bug report and patch are here http://bugzilla.gnome.org/show_bug.cgi?id=133681
<html><div style='background-color:'><DIV class=RTE> <P>I am interested in using Matplotlib for real-time updating plot applications. My concern is with system load issues (they're pretty high). Using the code below, which came off of an earlier posting to this list, on a pc (2.4 gig processor) memory usage ranges from 20 - 50+ megs (there's a cycling pattern) and 30-40% of the cpu is being used for this basic app. If left to run for 20 minutes or so, it seems to crash (entire screen turns grey and reboot is required to get machine back to working order).</P> <P>On a solaris machine, the performance numbers are similar, though the memory didn't appear to exceed 30 megs (or cycle). One other solaris issue is that the plot doesn't update, unless it is forced to redraw (by moving another window over the plot window). I've tinkered with the redraw rate, but it didn't seem to help.</P> <P>Short of the performance issues, this software looks great. Is there a way of using the software that will minimize system impact, or better yet, can this become a development priority? It's not clear if the performance issue is driven by matplotlib, pygtk or gtk. Is it possible that different backends lead to non-trivial differences in performance? </P> <P>Also, the crashing on a pc and non-updating on solaris are outstanding concerns.</P> <P>Derek Bandler</P> <P>####</P> <P>import pygtk<BR>pygtk.require('2.0')<BR>import gtk<BR>import time<BR>from matplotlib.matlab import *<BR> <BR>def get_memory():<BR> "Simulate a function that returns system memory"<BR> return 100*(1+sin(0.5*pi*time.time()))<BR> <BR>def get_cpu():<BR> "Simulate a function that returns cpu usage"<BR> return 100*(1+sin(0.2*pi*(time.time()-0.25)))<BR> <BR>def get_net():<BR> "Simulate a function that returns network bandwidth"<BR> return 100*(1+sin(0.7*pi*(time.time()-0.1)))<BR> <BR>def get_stats():<BR> return get_memory(), get_cpu(), get_net()<BR> <BR>fig = figure(1)<BR>ax = subplot(111)<BR>ind = arange(1,4)<BR>pm, pc, pn = bar(ind, get_stats())<BR>centers = ind + 0.5*pm.get_width()<BR>pm.set_facecolor('r')<BR>pc.set_facecolor('g')<BR>pn.set_facecolor('b')</P> <P>ax.set_xlim([0.5,4])<BR>ax.set_xticks(centers)<BR>ax.set_ylim([0,100])<BR>ax.set_xticklabels(['Memory', 'CPU', 'Bandwidth'])<BR>ax.set_ylabel('Percent usage')<BR>ax.set_title('System Monitor')<BR> <BR>def updatefig(*args):<BR> m,c,n = get_stats()<BR> pm.set_height(m)<BR> pc.set_height(c)<BR> pn.set_height(n)<BR> ax.set_ylim([0,100])</P> <P> fig.draw()<BR> <BR> return gtk.TRUE</P> <P>gtk.timeout_add(250, updatefig)<BR>show()</P></DIV></div><br clear=all><hr> <a href="http://g.msn.com/8HMBENUS/2752??PS=">Create your own personal Web page with the info you use most, at My MSN.</a> </html>
I have some plots I'd like to print out and they would make better use of the paper if they were done landscape. Can the postscript backend do this? John
>>>>> "LUK" == LUK ShunTim <shu...@po...> writes: >> OK, now we at least know where the problem is. I don't get >> such an error message on my system (rhl9, pygtk-2.0.0). What >> platform are you on, and what versions of GTK and pygtk are you >> running? JDH >> LUK> W2K, Enthought python 2.3, pygtk 2.0, gtk 2.0 Hi Luk, I get the same error message on my WinXP platform. I recently decoupled the text code from the various backends (gtk, ps, etc). In the past, each backend specified their own default font, and this is no longer possible since text is now backend independent. On the upside, this enables you to save PS or EPS from a GTK or WX GUI window. On the downside, this exposes the problem that font choosing is not backend independent. We've talked a number of times about the importance of this on matplotlib-devel, but haven't done the dirty work of actually getting it implemented. So in a nutshell, there is nothing wrong with your setup. We on the development side just need to spend some time getting fonts standardized across backends. Ie, we need to agree on a bare minimum number of fonts with standard names that we can provide on all the backends, so scripts using these names will work on all the backends. This is complicated by the fact that most fonts are proprietary, so we can't ship them or guarantee their existence on a given system. It's on the list of things to do. If this proves to be a major impediment for you in the mean time, don't hesitate to bring it up again. Sometimes those who complain the loudest get their bugs fixed the soonest. JDH
Thanks, John! Funny thing, I, too, recently installed Glade! That's = it! Best, Dave
>>>>> "Nordquest," == Nordquest, David A <NOR...@ga...> writes: Nordquest> BTW, if I do the pygtk test ( >>>import pygtk >>> Nordquest> pygtk.require('2.0') >>>> import gtk ) once, I get an error message. If I do it again >>>> without changing anything, I get no error message. This reimport situation you describe is expected. If you import a module a second time, python simply ignores it. So if it failed the first time, it will fail silently the next times. You should exist python and start over. The problem you are experiencing is definitely with gtk and not matplotlib. In these situations, the best thing to do is go into DOS or a command shell (Start->Run->command ENTER). Write a little script test.py that contains only import pygtk pygtk.require('2.0') import gtk Then go into the shell, an cd into the dir containing test.py. Manually set your PATH, something like (depends on which windows platform you are on) c:> set PATH=c:\GTK\bin;C:\GTK\lib;C:\Python23;C:\windows\command c:> python test.py I know you've checked your path ad nauseum, but there is still a decent change is the cause of your problem, 9 times out of 10. Hey, didn't you solve this once before :-) ? Is this a new platform for you? Did you reinstall GTK, if so to where? What does c:> dir c:\GTK\bin reveal? I assume you've reread http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq21.012.htp 100 times. There is a long thread on the pygtk mailing list where Cousing Stanley got his gtk corrupted by installing glade, which writes some older libgtk versions into the windows system dir. Do a file search for libgtk and make sure nothing shows up outside of your GTK install tree. Read this thread http://www.mail-archive.com/py...@da.../msg07324.html, which is filled with good advice. Good luck! JDH
>>>>> "Peter" == Peter Groszkowski <pgr...@ge...> writes: Peter> plot(date_in_some_format, data) Are the dates strings, python datetime instances, mx datetime instances, or what? Here is a thread on python-list you may be interested in http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=mailman.766.1068941179.702.python-list%40python.org&rnum=1&prev=/groups%3Fq%3Dmatplotlib%2Bdate%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den%26btnG%3DGoogle%2BSearch Peter> I suppose an alternative would be to convert the times to Peter> say seconds, create a plot and manually add the actual Peter> date/time label (text). This would be tedious but doable. Currently this is the best way. It would not be too much work to write a function called plotdate which took, for example, python2.3 datetime instances as the x arg, arbitrary y values, and a datetime format string as an optional arg, and did all the conversions for you, set the tick labels, etc... If you want to do it, I think it would be a nice addition to matplotlib. JDH
Hi everyone: I am interested in plotting data in the form: 2004年01月29日 15:29:17.161621101 5 2004年01月29日 15:29:18.161621061 6 2004年01月29日 15:29:19.161621021 7 2004年01月29日 15:29:20.161620981 8 2004年01月29日 15:29:21.161620941 9 2004年01月29日 15:29:22.161620901 0 2004年01月29日 15:29:23.161620861 1 ... In some cases I will have data every second, other times every minute or hour.. and so on.. Ideally I would like the x-axis of my plots to show the time/dates as the units. Is this currently possible with matplotlib? So in other words could I call on: plot(date_in_some_format, data) I suppose an alternative would be to convert the times to say seconds, create a plot and manually add the actual date/time label (text). This would be tedious but doable. Thanks. -- Peter Groszkowski Gemini Observatory Tel: +1 808 974-2509 670 N. A'ohoku Place Fax: +1 808 935-9235 Hilo, Hawai'i 96720, USA
I've checked my path several times and all seems to be as it should be. = However when I try to use pygtk and the latest gtk runtime and = matplotlib under Win98, I get the following error: >>> import pygtk >>> pygtk.require('2.0') >>> import gtk >>> from matplotlib.matlab import * Traceback (most recent call last): File "<pyshell#6>", line 1, in -toplevel- from matplotlib.matlab import * File "D:\PROGRA~1\PYTHON23\Lib\site-packages\matplotlib\matlab.py", = line 124, in -toplevel- from backends import new_figure_manager, error_msg, \ File = "D:\PROGRA~1\PYTHON23\Lib\site-packages\matplotlib\backends\__init__.py",= line 12, in -toplevel- from backend_gtk import \ File = "D:\PROGRA~1\PYTHON23\Lib\site-packages\matplotlib\backends\backend_gtk.p= y", line 15, in -toplevel- from gtk import gdk ImportError: cannot import name gdk I'm probably overlooking something obvious but would be grateful for = suggestions. BTW, if I do the pygtk test ( >>>import pygtk >>> pygtk.require('2.0') >>> import gtk ) once, I get an error message. If I do it again = without changing anything, I get no error message. Dave
>>>>> "matthew" == matthew arnison <ma...@ca...> writes: matthew> I haven't been using the pan and zoom stuff very much, matthew> the issues I described this week are all from initial matthew> plots. If I had been doing more zooming then I would have matthew> noticed your very good point about jumping ticks being matthew> distracting. It's fiddly stuff, but getting it right matthew> helps a lot when interpreting results from plots! OK, I think my approach will be to optimize the number of ticks, tick locations and view limits on the initial plot and then fix num ticks for interactive mode (pan/zoom). Ie, the initial guess should be good, but with interaction, you're on your own. I'll send you some code when I get this figured out. >> Ie, ignore the end point is the default behavior of python. matthew> I guessed as much. But I think in this case the python matthew> behaviour needs to be over-ridden. Python range logic is matthew> generally about integers, arange stretches it, and using matthew> this [) style range for plots over-stretches the matthew> principle beyond usefulness. There are also a couple of matthew> contradictions in matplotlib's behaviour: Yes, but I can defend myself! From the first line of the homepage matplotlib is a pure python 2D plotting library with a Matlab syntax Ie, matplotlib does contain inherent contradictions because it is both matlab-like and python-like. matlab has FORTRAN style indexing (starts with 1) and python has C style indexing (starts with 0). So the first matplotlib figure starts with figure(1). When using the matlab interface matplotlib.matlab, I strive for matlab compatibility. Thus, when you set the axis limits with axis([0, 2, -1, -1]) or set(gca(), 'xlim', [0, 2]) I do it like matlab does, ie, endpoints inclusive. However, I plead innocence in the case of t = arange(0.0, 2.0, 0.1) s = sin(2*pi*t) plot(t, s) If the arrays t and s passed to the plot function do not have the point at t=2.0 defined, "plot" can't guess them. I plot the points you give me. Note that matplotlib *does* provide the matlab function "linspace", which returns an evenly sampled array, endpoints included. So if you want matlab-like behavior you should use matlab-like array functions (linspace) rather Numeric python array functions (arange) to define your arrays. t = linspace(0.0, 2.0, 20) s = sin(2*pi*t) plot(t, s) In a nutshell, with the matlab interface I try to be consistent with matlab, but there are inconsistencies which arise by virtue of the fact that it's natural to use python functions (thank god!, that's why we're all here). I definitely appreciate the criticism, so feel free to keep at it. JDH
On Tue, 3 Feb 2004, John Hunter wrote: > So enough excuses! I agree that the current implementation is > suboptimal and will give it some more thought. Out of curiosity: do > the undersirable tick locs appear more frequently for you on an > initial plot or after interacting with the plot. I haven't been using the pan and zoom stuff very much, the issues I described this week are all from initial plots. If I had been doing more zooming then I would have noticed your very good point about jumping ticks being distracting. It's fiddly stuff, but getting it right helps a lot when interpreting results from plots! > This is a consequence of the way python and Numeric do ranges, and > doesn't really have anything to do with matplotlib. eg, the Numeric > function arange > > >>> from Numeric import * > >>> arange(0.0, 1.0, 0.2) > array([ 0. , 0.2, 0.4, 0.6, 0.8]) > > >>> range(5) > [0, 1, 2, 3, 4] > > Ie, ignore the end point is the default behavior of python. I guessed as much. But I think in this case the python behaviour needs to be over-ridden. Python range logic is generally about integers, arange stretches it, and using this [) style range for plots over-stretches the principle beyond usefulness. There are also a couple of contradictions in matplotlib's behaviour: * the axis and tick ranges are inclusive, but the data point range is exclusive of the higher end point only * the auto data range (axis()) is inclusive, but setting it manually is exclusive of the higher end point only Some of this may be alleviated by chooing better tick points. But I think it would also be helpful to make whichever behaviour is chosen more consistent. Cheers, Matthew.
>>>>> "Jean-Baptiste" =3D=3D Jean-Baptiste Cazier <Jean-Baptiste.cazier@d= ecode.is> writes: Jean-Baptiste> S=E6ll ! I am trying to plot very small number for Jean-Baptiste> the Y-axis on semilogy but they do not appear at Jean-Baptiste> all unless one of the value is higher Moreover the Jean-Baptiste> labels on the Y axis become 0 below 0.001 >>> semilogy([1.0, 2.3, 3.3],[9.4e-05, 9.4e-05, 9.4e-05]) <-- does >>> not work Jean-Baptiste> [<matplotlib.lines.Line2D instance at 0x935255c>] >>> semilogy([1.0, 2.3, 3.3],[9.4e-04, 9.4e-05, 9.4e-05]) <--- >>> work Jean-Baptiste> [<matplotlib.lines.Line2D instance at 0x940e964>] S=E6ll Jean! Thanks for this example. The relevant code which handles autoscaling is in matplotlib.axis.autoscale_view. I wasn't handling the special case where min=3Dmax for log scaling (though I do handle it for linear scaling). Try this replacement code for axis.py: and the functions decade_down and decade_up and replace the autoscale_view function. def decade_down(x): 'floor x to the nearest lower decade' lx =3D math.floor(math.log10(x)) return 10**lx def decade_up(x): 'ceil x to the nearest higher decade' lx =3D math.ceil(math.log10(x)) return 10**lx class Axis(Artist): def autoscale_view(self): 'Try to choose the view limits intelligently' vmin, vmax =3D self.datalim.bounds() if self._scale=3D=3D'linear': if vmin=3D=3Dvmax: vmin-=3D1 vmax+=3D1 try: (exponent, remainder) =3D divmod(math.log10(vmax - vmin),= 1) except OverflowError: print >>sys.stderr, 'Overflow error in autoscale', vmin, = vmax return if remainder < 0.5: exponent -=3D 1 scale =3D 10**(-exponent) vmin =3D math.floor(scale*vmin)/scale vmax =3D math.ceil(scale*vmax)/scale self.viewlim.set_bounds(vmin, vmax) elif self._scale=3D=3D'log': if vmin=3D=3Dvmax: vmin =3D decade_down(vmin) vmax =3D decade_up(vmax) self.viewlim.set_bounds(vmin, vmax) Let me know how this works for you, JDH
>>>>> "matthew" == matthew arnison <ma...@ca...> writes: matthew> Hi again, I'm having more trouble with matplotlib ticks matthew> today. I wrote a little demo script that illustrates some matthew> of the problems: Hi Matthew, Thanks for sending me these example scripts - it really helps to have complete examples when working on these problems. I've made a few changes to the tickval formatter. The relevant function is matplotlib.axis.format_tickval and is pretty simple conceptually. Try replacing the default format_tickval with this one. The d variable gives the max-min distance of the view limits. I use different format strings depending on the size of the distance. def format_tickval(self, x): 'Format the number x as a string' d = self.viewlim.interval() if self._scale == 'log': # only label the decades fx = self.transData.func(x) isdecade = abs(fx-int(fx))<1e-10 if self._ticklabelStrings is None and not isdecade: return '' #if the number is not too big and it's an int, format it as an #int if abs(x)<1e4 and x==int(x): return '%d' % x # if the value is just a fraction off an int, use the int if abs(x-int(x))<0.0001*d: return '%d' % int(x) # use exponential formatting for really big or small numbers, # else use float if d < 1e-2 : fmt = '%1.2e' elif d < 1e-1 : fmt = '%1.2f' elif d > 1e5 : fmt = '%1.3e' elif d > 10 : fmt = '%1.1f' elif d > 1 : fmt = '%1.2f' else : fmt = '%1.3f' s = fmt % x #print d, fmt, x, s # strip trailing zeros, remove '+', and handle exponential formatting m = self._zerorgx.match(s) if m: s = m.group(1) if m.group(2) is not None: s += m.group(2) s = s.replace('+', '') return s And then feed it some more of your sadistic examples <wink>. If you don't like what you see, try tweaking the formats and the distance values until you get sensible results. Or feel free to provide more comments and send more examples. JDH
>>>>> "matthew" == matthew arnison <ma...@ca...> writes: matthew> Hi, I am happily using matplotlib-0.50e. I tried eps matthew> output and it worked very nicely. The problem with plot matthew> lines not being clipped by a manual axis in the PS matthew> backend also seems to have been fixed. Good to hear .. matthew> I have some feedback on the default tick matthew> behaviour. matplotlib seems to pick a number of ticks, matthew> and then divides through to get the tick values. This matthew> results in some ugly long tick labels, making it hard to matthew> quickly gauge the range between two points on a graph. matthew> E.g. if the y range of a plot is 1.927 to 1.948, then matthew> matplotlib puts ticks at (1.927, 1.931, 1.935, ..., matthew> 1.948) I agree this is an important issue. It's also a difficult one. If matplotlib just had to make a good choice for the axis limits and tick values for a single plot, it wouldn't be too hard. What becomes harder is to do this in the presence of interactivity. Once you allow the user to pan and zoom, you have some other considerations. For example, if the tick locations or the number of ticks/grids on the axis move while you pan or zoom, that is visually disturbing. The easiest way to optimize the tick locations is to have some flexibility in choosing the number of ticks, but after the initial plot, this number is set for the rest of the interactive session which makes it harder. So enough excuses! I agree that the current implementation is suboptimal and will give it some more thought. Out of curiosity: do the undersirable tick locs appear more frequently for you on an initial plot or after interacting with the plot. matthew> Another slight niggle. If I set the axis range manually, matthew> then if a data point is exactly equal to the end of the matthew> axis range then it won't be plotted. This is a consequence of the way python and Numeric do ranges, and doesn't really have anything to do with matplotlib. eg, the Numeric function arange >>> from Numeric import * >>> arange(0.0, 1.0, 0.2) array([ 0. , 0.2, 0.4, 0.6, 0.8]) >>> range(5) [0, 1, 2, 3, 4] Ie, ignore the end point is the default behavior of python. JDH
>>>>> "Jean-Baptiste" == Jean-Baptiste Cazier <Jea...@de...> writes: Jean-Baptiste> Hi ! I am using with delight the new object_picker Jean-Baptiste> tools as of version 0.42b It works fine but I can Jean-Baptiste> not find out how to draw the legend, labels, title, Jean-Baptiste> etc... Neither the ax (Subplot), nor the fig Jean-Baptiste> (ArtistPickerFigure) have those methods. How could Jean-Baptiste> I access them ? First, I recommend upgrading the 0.50 series as there have been APi changes that affect the object_picker code (the examples.object_picker demo script is updated). Better to catch up sooner rather than later. Second, I don't really understand your question. If you want to "draw the legend, labels, ...", you simply call the draw method. All of these things (Legend, Text, etc..) are derived from Artist, which implements a "draw" method. so you can call legend.draw() label.draw() and so on? Then later you say "those methods" using the plural. I don't know what you mean..... Could you elaborate, and perhaps provide some code with comments showing where you are stuck? Thanks, JDH
>>>>> "Kuzminski," == Kuzminski, Stefan R <SKu...@fa...> writes: Kuzminski> Some notes on compiling GD backend for windows. 1) Kuzminski> _gdmodule.c needs to be modified in 2 places to Kuzminski> compile on windows Hi Stephan, I've been following your instructions on building gdmodule and I've gotten pretty far. I have a couple of questions for you. Did you use the prebuilt gd (not gdmodule) or the dll supplied at the web site. I built it myself, and when I try to build gdmodule, I get errors like _gdmodule.obj : error LNK2001: unresolved external symbol _gdFontGiantRep _gdmodule.obj : error LNK2001: unresolved external symbol _gdFontLargeRep The export to these symbols are dependent on the following preprocessor options (from gd.h) #ifdef BGDWIN32 #define BGD_EXPORT_DATA_IMPL __declspec(dllexport) #else #ifdef WIN32 #define BGD_EXPORT_DATA_IMPL __declspec(dllimport) #else /* 2.0.20: should be nothing at all */ #define BGD_EXPORT_DATA_IMPL #endif /* WIN32 */ #endif /* BGDWIN32 */ In gdfontl.c, there is some code BGD_EXPORT_DATA_IMPL gdFontPtr gdFontLarge = &gdFontLargeRep; I set BGDWIN32 option when building the gd DLL, but I still don't seem to get _gdFontLargeRep exported to the gd.dll. For example, if I grep the dll for gdFontLarge, I see that symbol but not gdFontLargeRep. Ditto for the prebuilt bgd.dll. Did you encounter this problem and do you have any insights here? Thanks, John Hunter
Hi ! I am using with delight the new object_picker tools as of version 0.42b It works fine but I can not find out how to draw the legend, labels, title,= etc... Neither the ax (Subplot), nor the fig (ArtistPickerFigure) have those metho= ds. How could I access them ? Thanks Kve=F0ja Jean-Baptiste --=20 ----------------------------- Jea...@de... Department of Statistics deCODE genetics Sturlugata,8 570 2993 101 Reykjav=EDk
Hi again, I'm having more trouble with matplotlib ticks today. I wrote a little demo script that illustrates some of the problems: ... #!/usr/bin/python from matplotlib.matlab import * xx = arange(0.002, 0.0101, 0.001) print xx # an instance of yy = rand(9), so all values are between 0 and 1 yy = [ 5.94692328e-04, 1.62328354e-01, 7.56822907e-01, 2.28180047e-02, 3.23820274e-01, 3.93120900e-01, 6.41332889e-01, 1.22474302e-02, 5.03485402e-01] subplot(211) plot(xx, yy) subplot(212) plot(xx, yy) autoaxis = axis() print autoaxis axis(autoaxis) show() ... * the x axis includes *two* 0.004 and *two* 0.008; this really worried me until I realised it was a cosmetic rounding / significant figures issue, however it's bad enough to be seriously misleading. I think the actual tick values are something like 0.0036 and 0.0044 but are both rounded to 0.004. * the data points lie *between* the x axis ticks, this is a side-effect of the above * the poor choice of tick positions on the y axis -- they should be in round numbers like 0.2, 0.4, etc. The most significant varying figure should be a multiple of 1, 2, or 5. * the tick labels should all have the same number of significant figures, e.g. 0.00, 0.15, 0.30, 0.45, 0.60, ... for the y axis * after manually setting the axis (lower subplot), the last point is not plotted I hope you find this feedback useful. I had a go at fixing it in axis.py, but it's a) fiddly and b) I don't quite understand which part has precendence when the axis changes during a zoom or pan. Getting the ticks right depends on the correct bounds for the axis and the choice of numticks. I noticed you have logic to clean up the bounds (vmin and vmax) but not the ticklocs. Thanks for matplotlib. Cheers, Matthew.
Hi john, After the refactoring you did for version 0.5 I am having a funny behavior in a plot embedded in wx: the frame appers with the size of the toolbar, but if I resize the frame the plot is there and is not resizable, it justs stays the same no matter the size of the canvas(frame?). I've made the changes to my original module acording to the revised 'embedding_in_wx.py' example, which runs fine. Here is my ploting module: =============================================== import matplotlib matplotlib.use('WX') from matplotlib.backends.backend_wx import Toolbar, FigureManager, FigureCanvasWx from matplotlib.figure import Figure from matplotlib.axes import Subplot import Numeric as numpy from RandomArray import * from MLab import * from wxPython.wx import * def create(parent): return PlotFigure(parent) class PlotFigure(wxFrame): def __init__(self,parent): wxFrame.__init__(self,None,-1,"Results") self.fig = Figure((5,4), 75) self.canvas = FigureCanvasWx(self,-1,self.fig) self.toolbar = Toolbar(self.canvas) self.toolbar.Realize() # On Windows, default frame size behaviour is incorrect # you don't need this under Linux tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() self.toolbar.SetSize(wxSize(fw, th)) # Create a figure manager to manage things self.figmgr = FigureManager(self.canvas, 1, self) # Now put all into a sizer sizer = wxBoxSizer(wxVERTICAL) # This way of adding to sizer prevents resizing #sizer.Add(self.fig, 0, wxLEFT|wxTOP) # This way of adding to sizer allows resizing sizer.Add(self.toolbar, 1, wxLEFT|wxTOP|wxGROW) # Best to allow the toolbar to resize! sizer.Add(self.toolbar, 0, wxGROW) self.SetSizer(sizer) self.Fit() def plotLine(self,y, leg, tit='Time Series'): """ Generate line plots """ # Use ths line if using a toolbar a = self.figmgr.add_subplot(211) # Or this one if there is no toolbar #a = Subplot(self.fig, 211) styles = ('-', '--', ':', '.', 'o', '^', 'v', '<', '>', 's', '+') colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k') s = 0 c = 0 for i in range(numpy.shape(y)[0]): if s > len(styles)-1: s = 0 if c > len(colors)-1: c = 0 style = styles[s] color = colors[c] a.plot(y[i,:],style+color) # plot each line with a different combination of color and style if c == len(colors)-1: s += 1 c += 1 a.set_title(tit) a.legend(leg) self.toolbar.update() =============================================== which I call like this: (I import the plotting module as PF) self.fig = PF.create(None) leg = self.modict["slabels"] tit = 'Time Series and Final State' self.fig.plotLine(results, leg, tit) self.fig.plotBar(results, leg) self.fig.Show()
>>>>> "Engelsma," == Engelsma, Dave <D.E...@La...> writes: Hi David, please post questions directly to the matplotlib-users list. Engelsma> Hello -- Is it possible to save figures (I'm using the Engelsma> .eps feature) without having to show the plots/charts Engelsma> on the user's screen? I'd like to be able to save the Engelsma> figures to disk without showing them on the Engelsma> screen. Currently, it seems that the figures will not Engelsma> save to disk, unless I issue the show() command after Engelsma> the savefig. I'd like to eliminate having to call Engelsma> show(). From your email, it sounds like you are using the GTK backend and saving figures with the ps backend. If you just want to save the figures as PS and not show them to the screen, use the ps backend directly as described on http://matplotlib.sourceforge.net/backends.html > python myscript.py -dPS or import matplotlib matplotlib.use('PS') from matplotlib.matlab import * t = arange(0.0, 3.0, 0.01) for i in range(1,10): figure(1) s = sin(2*pi*i*t) plot(t,s) savefig('plot%02d' % i) close(1) In either case, there is no need to call 'show'. If you want to make multiple figures, you need to clear them between each save, as I did here by closing the figure. If you really want to use the GTK backend to make PS figures without showing the figure, there are some things that will enable this, but I don't see any reasons to go this route. Let me know. JDH
Hi, I am happily using matplotlib-0.50e. I tried eps output and it worked very nicely. The problem with plot lines not being clipped by a manual axis in the PS backend also seems to have been fixed. ... I have some feedback on the default tick behaviour. matplotlib seems to pick a number of ticks, and then divides through to get the tick values. This results in some ugly long tick labels, making it hard to quickly gauge the range between two points on a graph. E.g. if the y range of a plot is 1.927 to 1.948, then matplotlib puts ticks at (1.927, 1.931, 1.935, ..., 1.948) I think it would be better (and closer to the plotting behaviour of other software) if matplotlib picked ticks that were "round", even if that means the endpoints of the axes are slightly outside the range of the data. So the ticks for the example above would become: (1.925, 1.930, 1.935, ..., 1.950) I guess this would be more complicated to implement than the current algorithm, but it would make life easier when interpreting graphs from matplotlib! ... Another slight niggle. If I set the axis range manually, then if a data point is exactly equal to the end of the axis range then it won't be plotted. Making the axis range slightly longer is clumsy. This also violates the principle of least surprise, because automatic axis ranges do not have this behaviour. A simple way to see the problem is to compare the output of the two plots below: >>> xvals = arange(0.0, 1.0, 0.1) >>> plot(xvals, [sin(x) for x in xvals]) [<matplotlib.lines.Line2D instance at 0x93fa844>] >>> show() >>> plot(xvals, [sin(x) for x in xvals]) [<matplotlib.lines.Line2D instance at 0x9249d2c>] >>> autoaxis = axis() >>> autoaxis [0.0, 0.90000000000000002, 0.0, 0.80000000000000004] >>> axis(autoaxis) >>> show() Presumably the logic for picking the datapoints to plot should use <= not <. Cheers, Matthew.
>>>>> "Flavio" == Flavio Codeco Coelho <fcc...@ci...> writes: Flavio> Hi John, What do you think of adding a button to the Flavio> standara toolbar allowing the plotted data to be save in Flavio> CSV format? My initial thought is this would be hard to do well. Axes can contain an arbitrary combination of lines, text and patches (of which there are many types). The lines can be different lengths. The plot can contain an arbitrary number of axes. How to export these in a meaningful way so that the code on the other side can load and use it is not clear to me. Perhaps you should write a function def line_to_csv(l, fname): # export the x and y line data to csv likewise you may want def hist_output_to_csv(args) and call these functions from your python script as necessary. Take a look at the file examples/object_picker.py (requires gtk backend), where you can select an individual line with the mouse. It wouldn't be hard to plug an export to csv function together with this picker functionality. But it seems that for the most part these are specialized use cases that may be better handled on your end by writing your own functions and subclassing the NavigationToolbar to add your own buttons (easy to do, I can provide some example code if you like) because I suspect there would be little agreement about what export functionality is desirable. Flavio> Talking about plots, I am writing a module to calculate Flavio> Kernel density estimates (a kind of continuous histogram) Flavio> would you be interested in adding it to matplotlib? Please send me the module code and some demo script and I'll take a look. I'm happy to include useful numerical and statistical code in matplotlib.mlab or wherever appropriate. Maybe a few online references where I can read about kernel density estimates too... Thanks! JDH
>>>>> "Nils" == Nils Wagner <nw...@me...> writes: Nils> ~/cvs/matplotlib/htdocs/screenshots> /usr/bin/python Nils> makeshots.py Making screenshot simple_plot.py Traceback Nils> (most recent call last): File "simple_plot.py", line 1, in ? Nils> from matplotlib.matlab import * File Nils> "/usr/local/lib/python2.1/site-packages/matplotlib/matlab.py", Nils> line 109, in ? from mlab import * File Nils> "/usr/local/lib/python2.1/site-packages/matplotlib/mlab.py", Nils> line 147 else: numFreqs = NFFT//2+1 ^ SyntaxError: invalid Nils> syntax matplotlib requires python2.2, which supports from __future__ import division That line should be the on or near the first code line of matplotlib/mlab.py. When this is imported, the integer division // operator is defined. See what's new in python2.2 http://www.python.org/doc/2.2.3/whatsnew/node7.html I'm surprised you didn't get an error on the call to from __future__ import division. JDH