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: Alan G I. <ai...@am...> - 2004-09-21 05:07:12
|
Two questions and a comment: Q1. For 'figure' I'm not seeing any effect of edgecolor (on screen). Isn't this the color of the border between the face (or frame) and the figure (as determined by axes)? Q2. Can line colors be set to arbitrary rgb colors using matlab.plot? If so, what is the syntax? If not, can this be a feature request? Minor comment: is the 'y' yellow needed for a Matlab match? If not, it needs adjustment IMHO. fwiw, Alan Isaac |
From: Alan G I. <ai...@am...> - 2004-09-21 01:50:24
|
On Thu, 09 Sep 2004, John Hunter apparently wrote: > # set the locations of the xticks > xticks( arange(6) ) > # set the locations and labels of the xticks > xticks( arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') ) Just for context, there is much I can do with Matplotlib that I cannot do in gnuplot, and vice versa. Naturally I want the best of both worlds ... In gnuplot, I can set xtics axis to put the tics (both the tics themselves and the accompanying labels) along the zeroaxis (If the zeroaxis is very close to the border, the axis option will move the tic labels to outside the border.) Now that you have given us axhline as a generalization of gnuplot's set xzeroaxis please consider letting xticks take an optional "loc" argument, which could either be "border" or a number to be interpreted as a 'y' value. So, e.g., axhline() xticks(arange(5),loc=0) would draw an xzeroaxis and put the xtics along it. Am I overlooking an obvious way to do this (in the matlab module)? fwiw, Alan |
From: Peter G. <pgr...@ge...> - 2004-09-20 23:49:25
|
Eli Glaser wrote: >You can also use ImageMagick. I believe the command is: > >convert -delay 20 c:/myimages/img*.png c:/myvideo/imgs.mpg > > might also note that to use this you will need to have mpeg2encode installed... ImageMagic does not depend on this directly so you will have to do the install yourself... i initially used 'convert' for my purposes, but it is much more limited than mencoder (ex. frame rates)... peter |
From: Darren D. <dd...@co...> - 2004-09-20 22:46:47
|
On Monday 20 September 2004 09:56 pm, you wrote: > > ..you can play with lots of settings in the line above... for example > the dimensions of your images will probably be different... the codec > you use might also vary.. i wanted something that would be usable by > many windows users.. (note that with wmv2 some still have to get codec > updates).. note that this command will use all the images in the > current working directory.. > OOOH, I have been avoiding figuring out how to do this sort of work to create movies for my thesis defense. I guess that means I have to graduate. -- Darren Dale |
From: Peter G. <pgr...@ge...> - 2004-09-20 21:59:54
|
John Hunter wrote: >>>>>> "Peter" == Peter Groszkowski <pgr...@ge...> writes: >>>>> > > Peter> use mplayer to put the png images together.. results are > Peter> quite nice... > > Can you post the command you use to play the pngs? Can mplayer output > an avi or mpg, or does it just animate the images. > i use something like this: mencoder mf://*.png -mf type=png:w=600:h=500:fps=10 -ovc lavc -lavcopts vcodec=wmv2 -oac copy -o animation.avi it creates an avi file as you can probably guess... initially i started to play with animated images (gifs) but they would be waaaay too large for my purposes... ..you can play with lots of settings in the line above... for example the dimensions of your images will probably be different... the codec you use might also vary.. i wanted something that would be usable by many windows users.. (note that with wmv2 some still have to get codec updates).. note that this command will use all the images in the current working directory.. finally, mencoder comes with mplayer.. .the easiest is to do: apt-get install mplayer this will work for debian users, and redhat/fedora (althought you would have to get apt-get first - try here: http://apt.freshrpms.net/ )... -- Peter Groszkowski Gemini Observatory Tel: +1 808 974-2509 670 N. A'ohoku Place Fax: +1 808 935-9235 Hilo, Hawai'i 96720, USA |
From: Eli G. <eg...@se...> - 2004-09-20 21:54:20
|
You can also use ImageMagick. I believe the command is: convert -delay 20 c:/myimages/img*.png c:/myvideo/imgs.mpg Eli ----- Original Message ----- From: "John Hunter" <jdh...@ni...> To: "Peter Groszkowski" <pgr...@ge...> Cc: "Christian Kristukat" <ge...@ho...>; <mat...@li...> Sent: Monday, September 20, 2004 4:50 PM Subject: Re: [Matplotlib-users] turn off antialiasing > >>>>> "Peter" == Peter Groszkowski <pgr...@ge...> writes: > > Peter> use mplayer to put the png images together.. results are > Peter> quite nice... > > Can you post the command you use to play the pngs? Can mplayer output > an avi or mpg, or does it just animate the images. > > I saw from the man pages that something like > > mplayer mf=type=png:fps=25 mf:/filemask > > is required, but I don't know how to set the filemask of if this is > the right approach. I'd like to add some instructions to the FAQ. > > Thanks, > JDH > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: John H. <jdh...@ac...> - 2004-09-20 21:40:03
|
>>>>> "Peter" == Peter Groszkowski <pgr...@ge...> writes: Peter> use mplayer to put the png images together.. results are Peter> quite nice... Can you post the command you use to play the pngs? Can mplayer output an avi or mpg, or does it just animate the images. I saw from the man pages that something like mplayer mf=type=png:fps=25 mf:/filemask is required, but I don't know how to set the filemask of if this is the right approach. I'd like to add some instructions to the FAQ. Thanks, JDH |
From: Peter G. <pgr...@ge...> - 2004-09-20 21:24:23
|
>> >> An alternative approach is to save a series of PNGs and use one of >> many programs on the web to turn a series of images into a mpeg or >> AVI. Perhaps then powerpoint won't try and be so helpful :-) > > > Yes, that could be an idea. I do this all the time... infact create daily movies of the forces exerted on our primary mirrors during nightly observing.. use mplayer to put the png images together.. results are quite nice... -- Peter Groszkowski Gemini Observatory Tel: +1 808 974-2509 670 N. A'ohoku Place Fax: +1 808 935-9235 Hilo, Hawai'i 96720, USA |
From: Alan G I. <ai...@am...> - 2004-09-20 19:10:19
|
Hi John, Since I read your previous message so poorly, I really appreciate your willingness to communicate again. At the moment I'm overcaffeinated and underslept, so I may do as badly again. I just do not quite "get it" yet. I think I do not fully understand xlim and ylim. What I have been doing up to now to get what I need is to use figsize and 'axes' to determine the aspect ratio of the viewport (AR(V), the screen area where the data will be displayed) and then (after the plot) 'axis' to determine the aspect ratio of the viewing window (AR(W), the relative lengths of the axes in data units). OK, I see all these same steps, with the only thing new that instead of having to plug the right numbers into 'axis', I get a keyword instead. (That "only" is comparative, not disparaging, of course.) So here is what I think you are offering: a keyword that will set the same "width" of data to be displayed on each axis, so that the AR(W)=1. This means that I can determine the compression ration CR=AR(W)/AR(V) from AR(V) alone. And in particular, if I use figsize and 'axes' to give me AR(V)=1, then axis('equal') will produce a compression ratio of unity as well. Do I have that right? If so: i. this seems useful ii. this seems somewhat related to the behavior of axis('square') in Matlab, if I read the documentation right http://www.mathworks.com/access/helpdesk/help/techdoc/ref/axis.html iii. This does *not* seem to be like the behavior of Matlab's axis('equal') I'm not a Matlab user, but (relying on the documentation) here is an example of the kind of thing I think you get from axis('equal') in Matlab: #define function to graph def f(x): return 2*x**3-5*x #choose points in domain for plotting d=(arange(401)-200.0)/100 #set figure size for plot figure(1,figsize=(2,5)) #determine AR(V) = AR(W) = 5/2 axes([0.1, 0.1, 0.8, 0.8]) plot(d,f(d)) #determine AR(W) = 5/2 axis([-2,2,-5,5]) show() Conceptually this works a little backwards, of course. What you really know first is the AR(W) that you want, and you choose the AR(V) to yield a compression ratio of unity (so that the units match along each axis). So if I have understood correctly, you have indeed offered something that can be useful, but it should have a different name. Or this may be overcaffeinated babble. Gotta run... fwiw, Alan |
From: John H. <jdh...@ac...> - 2004-09-20 14:17:18
|
>>>>> "Alan" == Alan G Isaac <ai...@am...> writes: Alan> OK, this does not work for me. Test case: Alan> d=arange(201)*pi/100 plot(cos(d),sin(d)) square() show() Alan> This should look like a circle. It looks like an oval. Alan> Problems: 1. fig.set_figsize_inches is ignored. It has no Right, I noted this in my original post - if you continue that post where I posted this code: It's the right idea, but it doesn't work currently if you are using a GUI backend. The reason it fails is has to do with the pipeline order in which figure managers, figures etc are created by default, and the fact that configure events and resize events change the figure width and height (so you can for example, resize your figure window). It *does* work if you specify the figure size figure(figsize=(8,8)) This is a bug, as I mentioned before, but will require some thought about how to get this right across backends. Alan> 2. axis('equal') should not be desirable, if it is matlab Alan> compatible Alan> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/axis.html Alan> That is, square() should set an axis aspect ratio of unity, Alan> but axis('equal') should equate the *unit length* along each Alan> axis. (For my example circle this is not a problem, but in Alan> generaly this is completely wrong.) With the amended axes code I'm attaching below, does this example work as you hope from matplotlib.matlab import * figure(figsize=(8,8)) ax = axes([0.1, 0.1, 0.8, 0.8]) d=arange(201)*pi/100 plot(10+cos(d),sin(d)) axis('equal') show() Perhaps more typing than you want for an interactive demo, but does make everything clear and should work, at least up to the dpix/dpiy error we discussed earlier. If it works fine, I'll make it a FAQ. I still have to handle the case where the axis lim are decreasing... JDH def axis(*v): """ axis() returns the current axis as a length a length 4 vector axis(v) where v= [xmin xmax ymin ymax] sets the min and max of the x and y axis limits axis('off') turns off the axis lines and labels axis('equal') sets the xlim width and ylim height to be to be identical. The longer of the two intervals is chosen """ if len(v)==1 and is_string_like(v[0]): s = v[0] if s.lower()=='on': gca().set_axis_on() elif s.lower()=='off': gca().set_axis_off() elif s.lower()=='equal': ax = gca() xmin, xmax = ax.get_xlim() ymin, ymax = ax.get_ylim() width = xmax-xmin height = ymax-ymin # TODO: handle decreasing lim interval = max([width, height]) ax.set_xlim((xmin, xmin+interval)) ax.set_ylim((ymin, ymin+interval)) draw_if_interactive() else: error_msg('Unrecognized string %s to axis; try on or off' % s) return try: v[0] except IndexError: xlim = gca().get_xlim() ylim = gca().get_ylim() return [xlim[0], xlim[1], ylim[0], ylim[1]] v = v[0] if len(v) != 4: error_msg('v must contain [xmin xmax ymin ymax]') return gca().set_xlim([v[0], v[1]]) gca().set_ylim([v[2], v[3]]) draw_if_interactive() |
From: Alan G I. <ai...@am...> - 2004-09-20 13:38:20
|
On Tue, 14 Sep 2004, John Hunter apparently wrote: > def square(): > fig = gcf() > ax = gca() > figw, figh = fig.get_size_inches() > l,b,axw,axh = ax.get_position() > side = min([figw, figh]) > frac = min([axw, axh]) > fig.set_figsize_inches(side, side) > ax.set_position([l,b,frac,frac]) > axis('equal') > draw() OK, this does not work for me. Test case: d=arange(201)*pi/100 plot(cos(d),sin(d)) square() show() This should look like a circle. It looks like an oval. Problems: 1. fig.set_figsize_inches is ignored. It has no effect on figure size. (It changes the size the figure reports, as checked by printing it, but not the size that is drawn---a missing argument to draw?) 2. axis('equal') should not be desirable, if it is matlab compatible http://www.mathworks.com/access/helpdesk/help/techdoc/ref/axis.html That is, square() should set an axis aspect ratio of unity, but axis('equal') should equate the *unit length* along each axis. (For my example circle this is not a problem, but in generaly this is completely wrong.) Hope that's useful, Alan Isaac |
From: Shin, D. <sd...@em...> - 2004-09-19 20:54:32
|
> I am concerned about the performance and memory hit of using, for > example, a list of a list of datetime objects rather than a numeric > array of floats. In the float representation, you can efficiently > create a large date range array with, for example, the drange code I > posted. Yes. For intensive operations on time series, a list of datetime objects will slow overall performance down significantly. Sometimes, I dream a sort of time array in numarray like string array, or object array. It can be implemented by holding a datetime object indicating an epoch and an array of floating points indicating intervals from the epoch. Daehyok Shin |
From: John H. <jdh...@ac...> - 2004-09-19 17:58:04
|
>>>>> "Wayne" == Wayne Christopher <wa...@4r...> writes: Wayne> I have been using matplotlib with TkInter (TkAgg backend) Wayne> and it's really nice once I got the hang of it... I have Wayne> two questions though, which I couldn't find in the manual. Wayne> 1. The figure window has a pretty large border around it, Wayne> that seems to expand as I enlarge the window. Is there a Wayne> way to set this to, say, N pixels? You cannot set it by pixel, but you can control it with the axes command. The syntax is axes([left, bottom, width, height]) where all values are fractions of the figure. Eg, left and width are fractions of the figure width, and bottom, top are fractions of the figure height. With a little arithmetic, you can figure out what fractions to use for a given pixel value, since the figure width in pixels is width in inches * dpi. See http://matplotlib.sf.net/matplotlib.matlab.html#-axes. Wayne> 2. I have some x, y window coordinates I got via Tk event Wayne> bindings. How can I translate these into data coordinates? You can plot in any coordinate system you want by setting the appropriate transform. If you want to plot in pixels, just specify your data in pixels and use the identity_transform, as in this example from matplotlib.matlab import * from matplotlib.transforms import identity_transform # left, bottom, width, height as fractions of figure size axes([0.05, 0.05, .9, 0.9]) # plot in pixel coords with the identity transform plot([100,400], [200,300], transform=identity_transform()) axis('off') # turn off tick labeling show() See http://matplotlib.sf.net/matplotlib.transforms.html for more information on transforms. For some backends, you may want to subtract the y pixel coordinate from the figure height. You can get the pixel width and height of the current figure with w, h = gcf().get_width_height() See http://matplotlib.sf.net/matplotlib.figure.html for help with figure methods. Good luck - when I get the users guide finished, some of these details will be more accessible. JDH Wayne> Thanks, Wayne> Wayne Wayne> ------------------------------------------------------- Wayne> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one Wayne> of 170 Project Admins to receive an Apple iPod Mini FREE Wayne> for your judgement on who ports your project to Linux PPC Wayne> the best. Sponsored by IBM. Deadline: Sept. 24. Go here: Wayne> http://sf.net/ppc_contest.php Wayne> _______________________________________________ Wayne> Matplotlib-users mailing list Wayne> Mat...@li... Wayne> https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Wayne C. <wa...@4r...> - 2004-09-19 05:23:43
|
I have been using matplotlib with TkInter (TkAgg backend) and it's really nice once I got the hang of it... I have two questions though, which I couldn't find in the manual. 1. The figure window has a pretty large border around it, that seems to expand as I enlarge the window. Is there a way to set this to, say, N pixels? 2. I have some x, y window coordinates I got via Tk event bindings. How can I translate these into data coordinates? Thanks, Wayne |
From: Andre M. <a....@hc...> - 2004-09-17 17:59:53
|
Hi Chris Thanks for your reply. I will take a look at your FloatCanvas to see whether it is useful for my purpose. The way you describe it might very well. The Agg library is awesome and making it fully available in Python would be more than nice. The whole Python community would benefit from this. Unfortunately, I do not have the knowledge nor the time to do the job. I need good graphics for the simulations that I already develop on top of the work I am paid for... The Tkinter Canvas is looking awful and unprofessional and the API is horrible. My feeling is that there is already a lot available*, but it needs to be combined in the right way. Maybe it is just getting the right developers together to give it a push. I don't know. hope this will really move in the right direction kind regards Andre * http://matplotlib.sourceforge.net/backends.html On Fri, 2004-09-17 at 17:23, Chris Barker wrote: > AP Meyer wrote: > > My problem is to visualise the process of a simulation, thus vector > > graphics objects controlled by a simulation program. At the moment I use > > a Tkinter Canvas, but it is very limiting. Look at the attached image > > for an example: cars driving on roads and trying to avoid crashing > > (Windows version). Imagine the cars driving around, of course! > > Did you post a similar message to comp.lang.python? Anyway, I tried to > reply to that, but maybe you didn't see it. No. > > I would suggest my wxPython FloatCanvas package: > > http://home.comcast.net/~chrishbarker/FloatCanvas/ > > (it's also included with recent versions of wxPython) > > Sorry I don't have a really nifty page describing it, but it does come > with a fairly comprehensive demo. I'd describe it's core mission as such: > > * It is designed to display data, which are likely to be in arbitrary > coordinates, rather than a picture, but is not a plotting tool (axes and > all that) > > * It is object based, and thus separates you from most of the need to > understand drawing with wx (DCs and all), and lets you create and > maintain objects. > > * It is designed to be high performance enough for simple animation > > > What I need is something similar to the Java2D API or JGraph. I need > > With a quick glance at the Java2D page, I can say that it has a slightly > different mission, but the biggest issues are: > > - No OpenGL (but I'd love to see that!) > > - No printing (though I was given a patch that I have not had a chance > to integrate yet. It shouldn't be too hard) > > - Not as mature or Robust (maybe a half a dozen people are using it for > real) > > As for your requirements: > > > - interactive (by application, not user) creation and modification of > > graphics primitives, such as: > circles - yes > text - yes > rects - yes > arcs - no, but it wouldn't be hard to add > arrows - yes, but not in the released version--hopefully I'll get anew > one out soon, otherwise, I can send it to you directly. > > > splines, etc. -- no, but same as arcs. > > > - transparency (alpha blending) - No (this is NOT well supported by wx yet, :-( ) > > - anti-aliasing -- I think text is covered, but > > These two could be supported by AGG, which is used by matplotlib. There > was some talk a while back about creating a wxAggDC, which I could then > use for FloatCanvas, but no one has stepped up to do it yet! Would you > like to? > > > - rotation, skewing, scaling, etc. -- some,a nd it wouldn't be hard to add more. > > - SVG output -- nope > > wxArt2d (A C++ library for wx) has a lot of this. It would be great to > see it wrapped for Python, unfortunately, not a trivial job, as I > understand it. > > Question: do you need it to be user-interactive, i.e. events responding > to clicking on objects? FloatCanvas does have that. > > > I have already looked at Tkinter and wxPython/OGL, but neither seems to > > do what I want. > > I'm afraid you're going to have to adapt anything that exists for > Python, the libraries just aren't as comprehensive as to for JAVA, at > least for this kind of thing. One reason is that there are quite a few > GUI toolkits, so development is kind of spread thin. > > If you really need the alpha blending and anti-aliasing, and matplotlib > can't do what you want out of the box, I'd highly encourage you to work > on a general purpose Agg module. It would be a real contribution to the > community, and I'd integrate it into FloatCanvas, so you could get the > rest of what you need from that. Another option would be to look at > wrapping wxArt2d. > > -Chris |
From: Chris B. <Chr...@no...> - 2004-09-17 15:29:51
|
AP Meyer wrote: > My problem is to visualise the process of a simulation, thus vector > graphics objects controlled by a simulation program. At the moment I use > a Tkinter Canvas, but it is very limiting. Look at the attached image > for an example: cars driving on roads and trying to avoid crashing > (Windows version). Imagine the cars driving around, of course! Did you post a similar message to comp.lang.python? Anyway, I tried to reply to that, but maybe you didn't see it. I would suggest my wxPython FloatCanvas package: http://home.comcast.net/~chrishbarker/FloatCanvas/ (it's also included with recent versions of wxPython) Sorry I don't have a really nifty page describing it, but it does come with a fairly comprehensive demo. I'd describe it's core mission as such: * It is designed to display data, which are likely to be in arbitrary coordinates, rather than a picture, but is not a plotting tool (axes and all that) * It is object based, and thus separates you from most of the need to understand drawing with wx (DCs and all), and lets you create and maintain objects. * It is designed to be high performance enough for simple animation > What I need is something similar to the Java2D API or JGraph. I need With a quick glance at the Java2D page, I can say that it has a slightly different mission, but the biggest issues are: - No OpenGL (but I'd love to see that!) - No printing (though I was given a patch that I have not had a chance to integrate yet. It shouldn't be too hard) - Not as mature or Robust (maybe a half a dozen people are using it for real) As for your requirements: > - interactive (by application, not user) creation and modification of > graphics primitives, such as: circles - yes text - yes rects - yes arcs - no, but it wouldn't be hard to add arrows - yes, but not in the released version--hopefully I'll get anew one out soon, otherwise, I can send it to you directly. > splines, etc. -- no, but same as arcs. > - transparency (alpha blending) - No (this is NOT well supported by wx yet, :-( ) > - anti-aliasing -- I think text is covered, but These two could be supported by AGG, which is used by matplotlib. There was some talk a while back about creating a wxAggDC, which I could then use for FloatCanvas, but no one has stepped up to do it yet! Would you like to? > - rotation, skewing, scaling, etc. -- some,a nd it wouldn't be hard to add more. > - SVG output -- nope wxArt2d (A C++ library for wx) has a lot of this. It would be great to see it wrapped for Python, unfortunately, not a trivial job, as I understand it. Question: do you need it to be user-interactive, i.e. events responding to clicking on objects? FloatCanvas does have that. > I have already looked at Tkinter and wxPython/OGL, but neither seems to > do what I want. I'm afraid you're going to have to adapt anything that exists for Python, the libraries just aren't as comprehensive as to for JAVA, at least for this kind of thing. One reason is that there are quite a few GUI toolkits, so development is kind of spread thin. If you really need the alpha blending and anti-aliasing, and matplotlib can't do what you want out of the box, I'd highly encourage you to work on a general purpose Agg module. It would be a real contribution to the community, and I'd integrate it into FloatCanvas, so you could get the rest of what you need from that. Another option would be to look at wrapping wxArt2d. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: AP M. <a.p...@fe...> - 2004-09-17 10:28:29
|
Dear matplotlib users On my search for a good drawing API for Python I discovered matplotlib. It has most of the features that I would like to see in a Python vector drawing API. My problem is to visualise the process of a simulation, thus vector graphics objects controlled by a simulation program. At the moment I use a Tkinter Canvas, but it is very limiting. Look at the attached image for an example: cars driving on roads and trying to avoid crashing (Windows version). Imagine the cars driving around, of course! What I need is something similar to the Java2D API or JGraph. I need the following features: - interactive (by application, not user) creation and modification of graphics primitives, such as circles, text, rects, arcs, arrows, splines, etc. - transparency (alpha blending) - anti-aliasing - rotation, skewing, scaling, etc. - SVG output ? Can matplotlib be used for visualising simulations? I do not need the axes and the various diagrams, but the rest is already there, it seems. I have already looked at Tkinter and wxPython/OGL, but neither seems to do what I want. Thanks for your help. Andre Java2D http://java.sun.com/products/java-media/2D/index.jsp http://java.sun.com/docs/books/tutorial/2d/display/strokeandfill.html http://java.sun.com/j2se/1.4.2/docs/guide/2d/spec/j2d-awt.html#wp64995 JGraph http://www.jgraph.com/showcase.html -- Dr. Andre P. Meyer http://home.hccnet.nl/a.meyer/ TNO FEL Command & Control and Simulation, http://www.fel.tno.nl/div2/ Delft Cooperation on Intelligent Systems, http://www.decis.nl/ -- ------------------------------------------------------------------------------ The disclaimer that applies to e-mail from TNO Physics and Electronics Laboratory can be found on: http://www.tno.nl/disclaimer/email.html ------------------------------------------------------------------------------ |
From: Stephen W. <ste...@cs...> - 2004-09-17 04:51:32
|
On Thu, 2004-09-16 at 13:41, John Hunter wrote: > >>>>> "Stephen" == Stephen Walton <ste...@cs...> writes: > > Stephen> Attempts to do an imshow() result in an error message > Stephen> that "pygtk was not compiled with Numeric Python > Stephen> support." > > My guess is you are using a precompiled pygtk (eg the one that ships > with FC1). Yup. I changed .matplotlibrc to force the GTKAgg backend and all is more or less well. I say this because (1) I'm using "ipython -pylab" on both FC1 and FC2; (2) I'm using the precompiled pygtk2 on both; (3) imshow works fine on FC2 with no .matplotlibrc file; and (4) the default colormap on FC1 seems to be grayscale, but on FC2 it is colorful. All systems have IPython 0.6.3 installed from Fernando's RPM and matplotlib 0.62.4 built locally with no changes to the defaults. Steve |
From: John H. <jdh...@ac...> - 2004-09-16 21:30:45
|
>>>>> "Stephen" == Stephen Walton <ste...@cs...> writes: Stephen> I'm doing something wrong, obviously, but am not sure Stephen> what. I have Numeric 23.1 (and numarray 1.1) installed Stephen> under Python 2.2 on Fedora Core 1, and matplotlib 0.62.4. Stephen> Attempts to do an imshow() result in an error message Stephen> that "pygtk was not compiled with Numeric Python Stephen> support." My guess is you are using a precompiled pygtk (eg the one that ships with FC1). You'll probably need to compile pygtk from src, with threads and numpy support > ./configure --enable-thread --enable-numpy > sudo make install Alternatively, you could simply use the gtkagg backend, in which case you won't need gtk with numpy support. JDH |
From: Todd M. <jm...@st...> - 2004-09-16 20:29:54
|
On Thu, 2004-09-16 at 16:12, Stephen Walton wrote: > I'm doing something wrong, obviously, but am not sure what. I have > Numeric 23.1 (and numarray 1.1) installed under Python 2.2 on Fedora > Core 1, and matplotlib 0.62.4. Attempts to do an imshow() result in an > error message that "pygtk was not compiled with Numeric Python support" I looked into this a little and the message is coming from pygtk itself, not surprisingly. Is there any chance you installed Numeric after pygtk? If so, you might want to try reconfiguring and re-installing pygtk. Hope this helps, Todd |
From: Stephen W. <ste...@cs...> - 2004-09-16 20:12:24
|
I'm doing something wrong, obviously, but am not sure what. I have Numeric 23.1 (and numarray 1.1) installed under Python 2.2 on Fedora Core 1, and matplotlib 0.62.4. Attempts to do an imshow() result in an error message that "pygtk was not compiled with Numeric Python support." --=20 Stephen Walton <ste...@cs...> Dept. of Physics & Astronomy, Cal State Northridge |
From: John H. <jdh...@ac...> - 2004-09-16 18:40:56
|
>>>>> "Chris" == Chris Barker <Chr...@no...> writes: Chris> I think you should generally not blindly apply the MATLAB Chris> approach. Python is a more powerful language than MATLAB, Chris> and support for more than just doubles is one it's Chris> features! Agreed. That's why we're here, after all. Chris> How does the datetime module store the values in a datetime Chris> object? My first inclination would be to follow it's Chris> approach, but it may not be suited to arrays ( :-( ) From the header of datetime.h /* Fields are packed into successive bytes, each viewed as unsigned and * big-endian, unless otherwise noted: * * byte offset * 0 year 2 bytes, 1-9999 * 2 month 1 byte, 1-12 * 3 day 1 byte, 1-31 * 4 hour 1 byte, 0-23 * 5 minute 1 byte, 0-59 * 6 second 1 byte, 0-59 * 7 usecond 3 bytes, 0-999999 * 10 */ I am concerned about the performance and memory hit of using, for example, a list of a list of datetime objects rather than a numeric array of floats. In the float representation, you can efficiently create a large date range array with, for example, the drange code I posted. Another concern is implementation: I would have to special case setting the tick limits and locations, eg calls to set_xlim and set_xticks, to check for datetime instances. I'm not totally wed to the float array approach however, and it is possible to handle datetime conversions as special cases in the axis functions if the consensus is that this would be better. Chris> A couple projects you might want to make use of: Chris> http://pytz.sourceforge.net/ Chris> and: Chris> https://moin.conectiva.com.br/DateUtil These look very nice and their is a good likelihood I'll use both. DateUtil can extend and improve the date tickers considerably, and the pytz classes should keep users happy around the world! Thanks, JDH |
From: Chris B. <Chr...@no...> - 2004-09-16 17:03:23
|
>>I think the >>cleanest approach is to require python2.3 and datetime. Ie, I would >>jettison support for epoch times and mx datetimes, as well as the >>converter stuff. +1 on this. >> def plot_date(self, d, y, fmt='bo', **kwargs): >> >>where d would be an array of floats (no converter) and the floats >>would be the number of days since 1,1,1 (Gregorian calendar). The >>supported date range would be datetime.min to datetime.max (years 0001 >>- 9999). > > Actually, MATLAB adopts the same approach using floats for date and time. I think you should generally not blindly apply the MATLAB approach. Python is a more powerful language than MATLAB, and support for more than just doubles is one it's features! How does the datetime module store the values in a datetime object? My first inclination would be to follow it's approach, but it may not be suited to arrays ( :-( ) A couple projects you might want to make use of: http://pytz.sourceforge.net/ and: https://moin.conectiva.com.br/DateUtil -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: Shin, D. <sd...@em...> - 2004-09-16 16:35:57
|
> I would like to rewrite the dates module, and the ticker functions for > dates, to use the python datetime module. Getting dates, timezones, > and daylight savings time right is non-trivial, and I think the > cleanest approach is to require python2.3 and datetime. Ie, I would > jettison support for epoch times and mx datetimes, as well as the > converter stuff. I agree that datetime is the cleanest approach. Always, better to choose standard libraries than 3rd party ones. > > The new plot_date signature would be > > def plot_date(self, d, y, fmt='bo', **kwargs): > > where d would be an array of floats (no converter) and the floats > would be the number of days since 1,1,1 (Gregorian calendar). The > supported date range would be datetime.min to datetime.max (years 0001 > - 9999). Actually, MATLAB adopts the same approach using floats for date and time. There, the epoch is 0000/00/00. The datenum and datestr functions provide the conversion between floats and strings. > > The dates module would provide some helper functions so that you could > use to build date arrays from datetime and timedelta instances. It > not be too hard to add some helper functions to convert existing > epoch, mx, or datetime arrays to the required array of days floats. > > timezones, including timezones other than the local one, would be > supported. Ie, if you are a financial guru in California, you could > work with Eastern time zone stock quotes or Central time zone pork > belly quotes. daylight savings time, etc, would be handled by the > datetime module. I have developed similar functions to convert an array of date or datetime to array of numbers. To avoid imprecision of floating points, I used seconds since 1900/1/1 without considering time zone. For my own domain, hydrologic modeling, I am rarely concerned about time zone. Based on my experience, I noticed the following things. The function names to_ordinalf and from_ordinalf are difficult to remember. How about just time2num and num2time? In addition, how about modifying the functions to handle an array of numbers or datetimes directly using map function? And the from_ordinalf function will produce an error message if date object, not datetime object, is tossed. I also recommend to provide strftime and isoformat functions to handle array of floating points directly. Thanks for your effort. Daehyok Shin |
From: John H. <jdh...@ac...> - 2004-09-16 15:17:30
|
First, a general note about python2.2. It is becoming difficult to maintain adequate support for python2.2. The pyparsing module, on which mathtext relies, currently requires 2.3. Handling dates properly requires the datetime module (or mx.datetime but I'm not inclined to impose an external dependency). I am inclined to gently drop support for 2.2. By gently, I mean that some features will no longer work (mathtext and dates) but the core should, at least for the near future. How many people would this adversely affect? The dates module, aside from a bug that I patched yesterday in response to a post by Jim Boyle, has two fundamental problems: no timezone support and the date range supported by the built-in time functions (the 1972 epoch) is too narrow. Both of these limitations are imposed by trying to support python2.2. I would like to rewrite the dates module, and the ticker functions for dates, to use the python datetime module. Getting dates, timezones, and daylight savings time right is non-trivial, and I think the cleanest approach is to require python2.3 and datetime. Ie, I would jettison support for epoch times and mx datetimes, as well as the converter stuff. The new plot_date signature would be def plot_date(self, d, y, fmt='bo', **kwargs): where d would be an array of floats (no converter) and the floats would be the number of days since 1,1,1 (Gregorian calendar). The supported date range would be datetime.min to datetime.max (years 0001 - 9999). The dates module would provide some helper functions so that you could use to build date arrays from datetime and timedelta instances. It not be too hard to add some helper functions to convert existing epoch, mx, or datetime arrays to the required array of days floats. timezones, including timezones other than the local one, would be supported. Ie, if you are a financial guru in California, you could work with Eastern time zone stock quotes or Central time zone pork belly quotes. daylight savings time, etc, would be handled by the datetime module. The datetime module has functions toordinal and fromordinal to convert to integer number of days since the start of the Gregorian calendar, but not floating point. Ie, hours minutes, seconds, etc are lost. My guess is that it is done this way to avoid imprecisions in floating point, but am not sure. I have implemented to_ordinalf and from_ordinalf to do these conversions preserving the hours, etc. They seem to work. I occasionally get rounding error on the order of a couple microseconds, which I think should be tolerable for the vast majority of cases. If you need microsecond precision, you can use plot and not plot_date in any case. Below, I'm including some prototype code which does these conversions - if you have interest or experience with dates and timezones, please look over it to see if I'm making any fundamental or conceptual errors. There is also a function drange, which can be used to construct the floating point days arrays plot_date would require. Any other suggestions for improvement or changes to date handling welcome. Speak now, or forever hold your peace! JDH import sys, datetime from matplotlib.numerix import arange from matplotlib.dates import Central, Pacific, Eastern, UTC HOURS_PER_DAY = 24. MINUTES_PER_DAY = 60.*HOURS_PER_DAY SECONDS_PER_DAY = 60.*MINUTES_PER_DAY MUSECONDS_PER_DAY = 1e6*SECONDS_PER_DAY #tz = None tz = Pacific #tz = UTC def close_to_dt(d1, d2, epsilon=5): 'assert that datetimes d1 and d2 are within epsilon microseconds' delta = d2-d1 mus = abs(delta.days*MUSECONDS_PER_DAY + delta.seconds*1e6 + delta.microseconds) assert(mus<epsilon) def close_to_ordinalf(o1, o2, epsilon=5): 'assert that float ordinals o1 and o2 are within epsilon microseconds' delta = abs((o2-o1)*MUSECONDS_PER_DAY) assert(delta<epsilon) def to_ordinalf(dt): """ convert datetime to the Gregorian date as UTC float days, preserving hours, minutes, seconds and microseconds. return value is a float """ if dt.tzinfo is not None: delta = dt.tzinfo.utcoffset(dt) if delta is not None: dt -= delta base = dt.toordinal() return (base + dt.hour/HOURS_PER_DAY + dt.minute/MINUTES_PER_DAY + dt.second/SECONDS_PER_DAY + dt.microsecond/MUSECONDS_PER_DAY ) def from_ordinalf(x, tz=None): """ convert Gregorian float of the date, preserving hours, minutes, seconds and microseconds. return value is a datetime """ ix = int(x) dt = datetime.datetime.fromordinal(ix) remainder = x - ix hour, remainder = divmod(24*remainder, 1) minute, remainder = divmod(60*remainder, 1) second, remainder = divmod(60*remainder, 1) microsecond = int(1e6*remainder) dt = datetime.datetime(dt.year, dt.month, dt.day, int(hour), int(minute), int(second), microsecond, tzinfo=UTC()) if tz is not None: return dt.astimezone(tz) else: return dt def drange(dstart, dend, delta): """ Return a date range as float gregorian ordinals. dstart and dend are datetime instances. delta is a datetime.timedelta instance """ step = delta.days + delta.seconds/SECONDS_PER_DAY + delta.microseconds/MUSECONDS_PER_DAY f1 = to_ordinalf(dstart) f2 = to_ordinalf(dend) return arange(f1, f2, step) dt = datetime.datetime(1011, 10, 9, 13, 44, 22, 101010, tzinfo=tz) x = to_ordinalf(dt) newdt = from_ordinalf(x, tz) close_to_dt(dt, newdt) date1 = datetime.datetime( 2000, 3, 2, tzinfo=tz) date2 = datetime.datetime( 2000, 3, 5, tzinfo=tz) delta = datetime.timedelta(hours=8) print drange(date1, date2, delta) d1 = datetime.datetime( 2000, 3, 2, 4, tzinfo=tz) d2 = datetime.datetime( 2000, 3, 2, 12, tzinfo=UTC()) o1 = to_ordinalf(d1) o2 = to_ordinalf(d2) close_to_ordinalf(o1, o2) print 'all tests passed' |