Re: [Matplotlib-users] imshow : text.py broken?
Thanks for fixing that. I forgot to mention when I added baseline alignment -- I really have no idea how to get a good baseline out of the usetex machinery, or if that's even possible. Now that you've fixed that bug, the baseline-misalignment problem should only affect those who explicitly turn on baseline alignment (using valignment = baseline on a text object). If we can't get a baseline from usetex, we may have to decide whether it's worth keeping baseline alignment in as a feature at all... Cheers, Mike Jouni K. Seppänen wrote: Xavier Gnata [EMAIL PROTECTED] writes: I do not know if we should post bug reports against matplotlib svn. Posting bug reports is likely to be helpful, but I suspect the developers' list might be more appropriate for bugs in the svn version. For bugs in released versions, I think John has told people to file a bug in the Sourceforge tracker and also send a message to the mailing list. Anyway, imshow is now fully broken this way : [...] -- 200 w, h, d = renderer.get_text_width_height_descent( ValueError: need more than 2 values to unpack It's not in imshow really, but in the usetex branch of get_text_width_height_descent in the agg backend. I fixed the immediate problem, though baseline alignment is unlikely to work with usetex as of now. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] imshow : text.py broken?
Michael Droettboom [EMAIL PROTECTED] writes: I forgot to mention when I added baseline alignment -- I really have no idea how to get a good baseline out of the usetex machinery, or if that's even possible. In principle it should be possible: TeX aligns its boxes on a baseline unless you request otherwise, so you just have to make sure you position your text or formula at known coordinates, and when you examine the resulting page, you keep track of where the baseline should be. In practice there probably are some more complications. Or, resort to some TeX hackery... you can get TeX to report the dimensions (height, depth, and width) of a box with \showbox: http://uucode.com/blog/2006/02/26/showbox-in-latex/ -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to set the colorbar ticks fontsize.
Hi all, I looking for a way to modify the colorbar ticks font size. a=rand(100,100) imshow(a) colorbar() and then?? For instance, xticks(fontsize=20) works well to modify the ticks fontsize along the X-axis but colorbar(fontsize=20) does not exists. I must be missing something. Xavier -- Xavier Gnata CRAL - Observatoire de Lyon 9, avenue Charles André 69561 Saint Genis Laval cedex Phone: +33 4 78 86 85 28 Fax: +33 4 78 86 83 86 E-mail: [EMAIL PROTECTED] - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basic understanding of plotting dates
C M wrote: 1. What exactly must I import (which modules) and how do I import them (in the sense of import x vs. from x import y)? 2. What arguments does the plot_date() command take and what is format of the arguments? 3. Do I have to make the conversion from the date format above to the matplotlib date format? If so, how? The code snippet below should answer most of your questions. 2 problems: autofmt_xdate() did not rotate the minor tick label, I don't now how to do that. I could not figure out how to draw minor tick grid lines. import datetime as DT import pylab as P import time x = ['2007-09-01 12:00:02', '2007-09-02 12:00:02', '2007-09-03 12:00:02'] y = [10, 20, 30] fmt='%Y-%m-%d %H:%M:%S' x1=[DT.datetime(*time.strptime(d,fmt)[:6]) for d in x] dates=P.date2num(x1) fig = P.figure() ax = fig.add_subplot(111) ax.plot_date(dates, y) ax.xaxis.set_major_locator( P.DayLocator() ) ax.xaxis.set_minor_locator( P.HourLocator(12)) ax.xaxis.set_major_formatter( P.DateFormatter('%Y-%m-%d') ) ax.xaxis.set_minor_formatter( P.DateFormatter('%Y-%m-%d %H:%M:%S')) ax.grid(True) fig.autofmt_xdate() P.show() -- Bill [EMAIL PROTECTED] Gentoo Linux X86_64 2.6.20-gentoo-r8 Reclaim Your Inbox with http://www.mozilla.org/products/thunderbird/ All things cometh to he who waiteth as long as he who waiteth worketh like hell while he waiteth. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basic understanding of plotting dates
Maybe this will get you going: import pylab as p import datetime as d from matplotlib.dates import DateFormatter t = [ d.datetime (2007,9,1,12), d.datetime(2007,9,2,12), d.datetime(2007,9,3,12) ] t = p.date2num(t) p.plot_date( t, [10,20,30] ) p.xticks(t) y = DateFormatter('%Y-%m-%d') p.gca().xaxis.set_major_formatter(y) p.draw() Mark From: C M [EMAIL PROTECTED] Subject: [Matplotlib-users] basic understanding of plotting dates x = (2007-09-01 12:00:02, 2007-09-02 12:00:02, 2007-09-03 12:00:02) y = (10, 20, 30) - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basic understanding of plotting dates
On 9/4/07, Brendan Barnwell [EMAIL PROTECTED] wrote: Incidentally, is there a reason why matplotlib can't just handle datetime objects itself? The requirement of having to manually convert them to an ad-hoc matplotlib format (which is just an integer) seems rather obtuse. It can handle native datetime objects, as of recent versions, but it is not trivial. The original versions of matplotlib assumed you were passing in floating point (not integer) sequences (matplotlib was written before python had a datetime object by the way, and we supported conversion from mx datetime objects). So we supplied some conversion functions to convert mx dates or python datetimes to floating point numbers so matplotlib could handle them like all other numbers, and used custom tick locators and tick formatters decorate the date axes. More recent versions of matplotlib support plotting with custom (non scalar) types via a conversion registry, so you can do the obvious thing with native datetime objects. JDH - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basic understanding of plotting dates
Bill Dandreta wrote: C M wrote: 1. What exactly must I import (which modules) and how do I import them (in the sense of import x vs. from x import y)? 2. What arguments does the plot_date() command take and what is format of the arguments? 3. Do I have to make the conversion from the date format above to the matplotlib date format? If so, how? The code snippet below should answer most of your questions. Incidentally, is there a reason why matplotlib can't just handle datetime objects itself? The requirement of having to manually convert them to an ad-hoc matplotlib format (which is just an integer) seems rather obtuse. -- --Brendan Barnwell Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail. --author unknown - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] [Newbie question] Is 0:3:100 possible?
Hi, I come from using Matlab and I was just curious if it was possible to create an arange from a quick for loop of numbers? For example: 0:3:100 would generate: 0, 3, 6, 9, 12, , 96, 99 And I would want this range to be in an arange() object. Is there a similar way of doing this? Thanks. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [Newbie question] Is 0:3:100 possible?
Hi, numpy.arange(0, 100, 3) perhaps ? Matthieu 2007/9/4, Robert Dailey [EMAIL PROTECTED]: Hi, I come from using Matlab and I was just curious if it was possible to create an arange from a quick for loop of numbers? For example: 0:3:100 would generate: 0, 3, 6, 9, 12, , 96, 99 And I would want this range to be in an arange() object. Is there a similar way of doing this? Thanks. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [Newbie question] Is 0:3:100 possible?
Ah; Thanks guys. I thought 'arange' was a class, however it is a function. I get it now. Sorry for the confusion! On 9/4/07, Steve Lianoglou [EMAIL PROTECTED] wrote: On Sep 4, 2007, at 3:09 PM, Robert Dailey wrote: Hi, I come from using Matlab and I was just curious if it was possible to create an arange from a quick for loop of numbers? For example: 0:3:100 would generate: 0, 3, 6, 9, 12, , 96, 99 In ipython's pylab mode: In [1]: arange(3,100,3) Out[1]: array([ 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99]) And I would want this range to be in an arange() object. Is there a similar way of doing this? Thanks. Not sure what you mean by an arange object, but arange returns a numpy array. HTH, -steve - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basic understanding of plotting dates
Mark, Mark, Brendan, John, thanks for the input. I have a related question that may help to continue to clear things up for me. My goal is to use matplotlib with wxPython, and I've been able to embed graphs in wxPython apps fine so far (in this case, directly, not using wxMPL). What I wanted to know is whether it is necessary to use pylab or not. I am a little unclear what the purpose of pylab is in distinction to matplotlib itself. I gather that pylab is a way to sort of emulate Matlab, but I am unclear as to whether I need to be using pylab in my apps or not. I am not doing scientific plots, just fairly simple graphs, though I may throw some regression lines and r values on there at some point. I really just want to keep things as simple as possible, and if I don't need to use pylab, I'd rather not. Any insight would be helpful. Thank you. Che M On 9/4/07, Mark Bakker [EMAIL PROTECTED] wrote: Maybe this will get you going: import pylab as p import datetime as d from matplotlib.dates import DateFormatter t = [ d.datetime (2007,9,1,12), d.datetime(2007,9,2,12), d.datetime(2007,9,3,12) ] t = p.date2num(t) p.plot_date( t, [10,20,30] ) p.xticks(t) y = DateFormatter('%Y-%m-%d') p.gca().xaxis.set_major_formatter(y) p.draw() Mark From: C M [EMAIL PROTECTED] Subject: [Matplotlib-users] basic understanding of plotting dates x = (2007-09-01 12:00:02, 2007-09-02 12:00:02, 2007-09-03 12:00:02) y = (10, 20, 30) - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] inverted x-axis
Jouni, thanks for your reply. I could test that plot([1,2,3],[1,2,3]) setp(gca(), 'xlim', (3.0,1.0)) works, but setp(gca(), 'xlim', reversed(getp(gca(), 'xlim'))) gives me an error : --- TypeError Traceback (most recent call last) /home/cohen/ipython console in module() /usr/lib/python2.5/site-packages/matplotlib/pylab.py in setp(*args, **kwargs) 1386 1387 def setp(*args, **kwargs): - 1388 ret = _setp(*args, **kwargs) 1389 draw_if_interactive() 1390 return ret /usr/lib/python2.5/site-packages/matplotlib/artist.py in setp(h, *args, **kwargs) 704 funcName = set_%s%s 705 func = getattr(o,funcName) -- 706 ret.extend( [func(val)] ) 707 return [x for x in flatten(ret)] 708 /usr/lib/python2.5/site-packages/matplotlib/axes.py in set_xlim(self, xmin, xmax, emit, **kwargs) 1543 raise ValueError('Cannot set nonpositive limits with log transform') 1544 - 1545 xmin, xmax = mtrans.nonsingular(xmin, xmax, increasing=False) 1546 self.viewLim.intervalx().set_bounds(xmin, xmax) 1547 if emit: self.callbacks.process('xlim_changed', self) /usr/lib/python2.5/site-packages/matplotlib/transforms.py in nonsingular(vmin, vmax, expander, tiny, increasing) 272 vmin, vmax = vmax, vmin 273 swapped = True -- 274 if vmax - vmin = max(abs(vmin), abs(vmax)) * tiny: 275 if vmin==0.0: 276 vmin = -expander TypeError: unsupported operand type(s) for -: 'reversed' and 'float' I guess that the issue is that reversed returns the reversed iterator on the sequnce, not the reversed sequence itself. Best, Johann - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] inverted x-axis
On Tuesday 04 September 2007 17:53:56 Johann Cohen-Tanugi wrote: Jouni, thanks for your reply. I could test that plot([1,2,3],[1,2,3]) setp(gca(), 'xlim', (3.0,1.0)) works, but setp(gca(), 'xlim', reversed(getp(gca(), 'xlim'))) Johann, You may find it easier to use methods instead of functions: gca().set_xlim(gca().get_xlim()[::-1]) Note the [::-1], that will reverse your tuple. - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basic understanding of plotting dates
I realize that the clearer question (and one which ties into my original thread) is: do I need pylab to do plot_date()? On 9/4/07, C M [EMAIL PROTECTED] wrote: Mark, Mark, Brendan, John, thanks for the input. I have a related question that may help to continue to clear things up for me. My goal is to use matplotlib with wxPython, and I've been able to embed graphs in wxPython apps fine so far (in this case, directly, not using wxMPL). What I wanted to know is whether it is necessary to use pylab or not. I am a little unclear what the purpose of pylab is in distinction to matplotlib itself. I gather that pylab is a way to sort of emulate Matlab, but I am unclear as to whether I need to be using pylab in my apps or not. I am not doing scientific plots, just fairly simple graphs, though I may throw some regression lines and r values on there at some point. I really just want to keep things as simple as possible, and if I don't need to use pylab, I'd rather not. Any insight would be helpful. Thank you. Che M On 9/4/07, Mark Bakker [EMAIL PROTECTED] wrote: Maybe this will get you going: import pylab as p import datetime as d from matplotlib.dates import DateFormatter t = [ d.datetime (2007,9,1,12), d.datetime(2007,9,2,12), d.datetime(2007,9,3,12) ] t = p.date2num(t) p.plot_date( t, [10,20,30] ) p.xticks(t) y = DateFormatter('%Y-%m-%d') p.gca().xaxis.set_major_formatter(y) p.draw() Mark From: C M [EMAIL PROTECTED] Subject: [Matplotlib-users] basic understanding of plotting dates x = (2007-09-01 12:00:02, 2007-09-02 12:00:02, 2007-09-03 12:00:02) y = (10, 20, 30) - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basic understanding of plotting dates
C M wrote: Mark, Mark, Brendan, John, thanks for the input. I have a related question that may help to continue to clear things up for me. My goal is to use matplotlib with wxPython, and I've been able to embed graphs in wxPython apps fine so far (in this case, directly, not using wxMPL). What I wanted to know is whether it is necessary to use pylab or not. I am a little unclear what the purpose of pylab is in distinction to matplotlib itself. I gather that pylab is a way to sort of emulate Matlab, but I am unclear as to whether I need to be using pylab in my apps or not. I am not doing scientific plots, just fairly simple graphs, though I may throw some regression lines and r values on there at some point. I really just want to keep things as simple as possible, and if I don't need to use pylab, I'd rather not. Any insight would be helpful. Thank you. Che M No, you do not need to use pylab. It provides an API that is concise, comfortable, and responsive, especially for interactive use. Even in scripts that are mostly written in OO fashion, use of a few pylab functions (e.g., figure, subplot, show) can simplify the code. This does not apply if you are embedding mpl in wx, however; none of the examples/embedding_in_*.py demos import pylab. In addition to its role as an alternative interface to mpl, pylab imports most of numpy and some additional functions, providing a somewhat matlab-like environment. This can be handy for interactive work. There is a range of opinion regarding pylab, but I think the center of the range is: don't use pylab when mpl is embedded; use it very sparingly for normal programming; and for interactive use, if it makes you more productive, use it as much as you want. Eric - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basic understanding of plotting dates
C M wrote: I realize that the clearer question (and one which ties into my original thread) is: do I need pylab to do plot_date()? No, plot_date is available as an axes method. Most pylab plotting commands are thin wrappers for axes methods. Eric - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [Newbie question] Is 0:3:100 possible?
Robert Dailey wrote: Ah; Thanks guys. I thought 'arange' was a class, however it is a function. I get it now. Sorry for the confusion! Just a note: most often (at least if you are working with floating point values) you want linspace, rather than arange: N.linspace(3, 99, 33) array([ 3., 6., 9., 12., 15., 18., 21., 24., 27., 30., 33., 36., 39., 42., 45., 48., 51., 54., 57., 60., 63., 66., 69., 72., 75., 78., 81., 84., 87., 90., 93., 96., 99.]) fewer surprises with floating point oddities. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users