From: Thomas P. <tho...@lu...> - 2005-04-18 09:10:28
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello everyone, I'm not yet a subscriber to this list, so please send at least a CC of your answers to me personally. I have basically the same question as Geoff Low had in his post ' Plotting time formats in gnuplot-py <http://sourceforge.net/mailarchive/message.php?msg_id=10079214> ' on 2004-11-18 01:45 I used gnuplot.py quite extensively a couple of years ago and I really loved it, except for the problem that the gnuplot process needed the 'using' keyword when plotting time-series data. As the PlotItems of that time didn't allow setting the using-keyword I was forced to work with temporary files which takes away much of the speed and comfort of having python controlling gnuplot. Recently I'm again doing more visualization of time-series and I have tried to utilize gnuplot's rather limited batch-file capabilities using nested 'call's to achieve my goals. But that still means a lot of duplication of code, which I would like to avoid. I have also tried IDL, but I found that gnuplot's defaults make up much better images and the cusomization is much easier with gnuplot even though IDL is basically more powerful if you have enough time to tweak it the way you want (and this is what I don't have, as usual :-) ). So my question is, if there is any way to trick the gnuplot process into using python-arrays that contain time-series information without resorting to temporary files? I would be back to gnuplot and python in no time :-) Best regards, Thomas - -- _______________________________________________________ Dipl.-Ing Thomas Pfaff, M.Eng. Dr.-Ing. Karl Ludwig Beratender Ingenieur Wasserwirtschaft - Wasserbau Herrenstr. 14 76133 Karlsruhe Tel: 0721 / 91251-46 Fax: 0721 / 91251-19 tho...@lu... -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCY3mQ08tF9hMUUtURAs4PAJ914UfbQJ8rHgfh+bZ18awa7HxGCQCeIMiu eQSED6U2ouz7Lt7CbzRqe7E= =1l1d -----END PGP SIGNATURE----- |
From: Michael H. <mh...@al...> - 2005-04-21 21:50:29
|
Thomas Pfaff wrote: >I'm not yet a subscriber to this list, so please send at least a CC of >your answers to me personally. > >I used gnuplot.py quite extensively a couple of years ago and I really >loved it, except for the problem that the gnuplot process needed the >'using' keyword when plotting time-series data. As the PlotItems of >that time didn't allow setting the using-keyword I was forced to work >with temporary files which takes away much of the speed and comfort of >having python controlling gnuplot. > >[...] > >So my question is, if there is any way to trick the gnuplot process >into using python-arrays that contain time-series information without >resorting to temporary files? I would be back to gnuplot and python in >no time :-) > > Why are you so allergic to temporary files? In most cases they won't be significantly slower, as the bulk of the time is for Python to format the data as ASCII data, which has to be done anyway. Write yourself a little helper function like utils.write_array() but which is smart about date-formatted data. File PlotItems can take arbitrary strings as their "using" argument. What else do you need? Cheers, Michael |
From: Michael H. <mh...@al...> - 2005-04-26 19:44:20
|
Thomas Pfaff wrote: >>Why are you so allergic to temporary files? In most cases they >>won't be significantly slower, as the bulk of the time is for >>Python to format the data as ASCII data, which has to be done >>anyway. >> >>Write yourself a little helper function like utils.write_array() >>but which is smart about date-formatted data. File PlotItems can >>take arbitrary strings as their "using" argument. What else do you >>need? >> >> >> >Well, basically I didn't like the thought of "having to". In all cases >regular PlotItems work fine, except for time-data where I would "have >to" use File PlotItems just because only they would accept the using >keyword, which seemed to me like some kind of a workaround. > > What's missing isn't the "using" functionality; it's the ability to include date information in data to be sent to gnuplot, and the ability to format the date information in a way that gnuplot can read. Gnuplot.py uses Numeric arrays to hold the data to be plotted (at least when using the Data PlotItem), and I don't know of a good way to store date information within a Numeric array. Therefore the input to Data would have to be in a different form to even get started supporting dates. >Maybe if I understood the concept behind the interaction with gnuplot >.... If you say that Python has to format the data as ASCII data >anyway, is it maybe that Python just creates ASCII lines in gnuplot >format from the data which are then fed to gnuplot via a pipe? > That is correct, though depending on your settings the data might be transferred inline via the gnuplot command-input pipe, via a named pipe, or via a temporary file. > If I >can know beforehand how the final line would look like (the data from >the array marked as x-data would be the first in line, followed by the >y-data and so on), wouldn't it suffice to have all PlotItems accept >the 'using' keyword, and then I would just say "using 1:3" if my >date-strings contained a space? > > I think the real problem is that dates cannot be expressed as space-separated columns of numbers (or can they...?) Gnuplot.py doesn't have a way to output arbitrary strings, at least not via the Data PlotItem. Let us know what you work out, Michael |
From: Thomas P. <tho...@lu...> - 2005-04-27 08:53:21
Attachments:
smime.p7s
|
Michael Haggerty schrieb: > Thomas Pfaff wrote: > >>> Why are you so allergic to temporary files? In most cases they >>> won't be significantly slower, as the bulk of the time is for >>> Python to format the data as ASCII data, which has to be done >>> anyway. >>> >>> Write yourself a little helper function like utils.write_array() >>> but which is smart about date-formatted data. File PlotItems can >>> take arbitrary strings as their "using" argument. What else do you >>> need? >>> >>> >> >> Well, basically I didn't like the thought of "having to". In all cases >> regular PlotItems work fine, except for time-data where I would "have >> to" use File PlotItems just because only they would accept the using >> keyword, which seemed to me like some kind of a workaround. >> >> > > What's missing isn't the "using" functionality; it's the ability to > include date information in data to be sent to gnuplot, and the > ability to format the date information in a way that gnuplot can > read. Gnuplot.py uses Numeric arrays to hold the data to be plotted > (at least when using the Data PlotItem), and I don't know of a good > way to store date information within a Numeric array. Therefore the > input to Data would have to be in a different form to even get started > supporting dates. > >> Maybe if I understood the concept behind the interaction with gnuplot >> .... If you say that Python has to format the data as ASCII data >> anyway, is it maybe that Python just creates ASCII lines in gnuplot >> format from the data which are then fed to gnuplot via a pipe? >> > > That is correct, though depending on your settings the data might be > transferred inline via the gnuplot command-input pipe, via a named > pipe, or via a temporary file. > >> If I >> can know beforehand how the final line would look like (the data from >> the array marked as x-data would be the first in line, followed by the >> y-data and so on), wouldn't it suffice to have all PlotItems accept >> the 'using' keyword, and then I would just say "using 1:3" if my >> date-strings contained a space? >> >> > > I think the real problem is that dates cannot be expressed as > space-separated columns of numbers (or can they...?) Gnuplot.py > doesn't have a way to output arbitrary strings, at least not via the > Data PlotItem. > > Let us know what you work out, > Michael > Well a simple form would be to use numbers according to the %s format, which would be seconds since the UNIX-epoch (1970-01-01, 00:00 UTC). I would prefer Julian dates, as they cover a larger period of time (1 Jan 4716 B.C.E. to 31 Dec 5000000 AD), but one would have to ask the gnuplot-developers to offer that functionality, I suppose; that's nothing gnuplot.py can do. Another possibility, if you just need numbers separated by spaces, might be "2005 04 27 00 00 00" which would be "%y %m %d %H %M %S" for the time format string. Actually I just read in the gnuplot help, that the above format string would also recognize the "number" 20050427000000 as spaces in format strings stand for zero or more spaces. However it would need 64bit integers to represent such numbers. Yet still I suppose gnuplot will still try to read a string using some kind of strptime function? Cheers, Thomas -- _______________________________________________________ Dipl.-Ing Thomas Pfaff, M.Eng. Dr.-Ing. Karl Ludwig Beratender Ingenieur Wasserwirtschaft - Wasserbau Herrenstr. 14 76133 Karlsruhe Tel: 0721 / 91251-46 Fax: 0721 / 91251-19 tho...@lu... |