You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(15) |
Sep
(21) |
Oct
(15) |
Nov
|
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(7) |
Feb
(6) |
Mar
(2) |
Apr
(5) |
May
(6) |
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(3) |
Oct
(14) |
Nov
(16) |
Dec
(10) |
2004 |
Jan
(5) |
Feb
(10) |
Mar
(4) |
Apr
(8) |
May
(1) |
Jun
(5) |
Jul
(5) |
Aug
(4) |
Sep
(10) |
Oct
(3) |
Nov
(4) |
Dec
|
2005 |
Jan
(1) |
Feb
(4) |
Mar
|
Apr
(15) |
May
(12) |
Jun
(1) |
Jul
(4) |
Aug
(3) |
Sep
(6) |
Oct
(7) |
Nov
(21) |
Dec
(11) |
2006 |
Jan
(16) |
Feb
(12) |
Mar
(4) |
Apr
(6) |
May
(5) |
Jun
(9) |
Jul
|
Aug
(5) |
Sep
(1) |
Oct
(10) |
Nov
(4) |
Dec
(3) |
2007 |
Jan
(6) |
Feb
(4) |
Mar
(6) |
Apr
(11) |
May
(1) |
Jun
(21) |
Jul
|
Aug
(6) |
Sep
(2) |
Oct
(4) |
Nov
|
Dec
|
2008 |
Jan
(14) |
Feb
(1) |
Mar
(5) |
Apr
(22) |
May
(4) |
Jun
(1) |
Jul
(7) |
Aug
(5) |
Sep
(7) |
Oct
(3) |
Nov
|
Dec
(1) |
2009 |
Jan
(14) |
Feb
(1) |
Mar
(9) |
Apr
(5) |
May
(6) |
Jun
(7) |
Jul
(8) |
Aug
(3) |
Sep
|
Oct
|
Nov
(2) |
Dec
(4) |
2010 |
Jan
(2) |
Feb
|
Mar
(6) |
Apr
(6) |
May
(34) |
Jun
|
Jul
(8) |
Aug
(3) |
Sep
|
Oct
(5) |
Nov
(3) |
Dec
(1) |
2011 |
Jan
|
Feb
(4) |
Mar
(3) |
Apr
|
May
|
Jun
(5) |
Jul
(9) |
Aug
(5) |
Sep
(9) |
Oct
(3) |
Nov
(10) |
Dec
(1) |
2012 |
Jan
(1) |
Feb
(3) |
Mar
(2) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(3) |
Nov
(2) |
Dec
(9) |
2014 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2016 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael H. <mh...@al...> - 2011-07-03 15:04:33
|
On 07/03/2011 11:54 AM, tony wrote: > Thanks Michael > I can now place a label on the graph, but what I really want to do is > have the label be a variable that is updated every few seconds. > I've tried to include this in > g('set label 1 sprintf("%f",inc) at 2,2') > where inc is the variable but in a While loop I keep getting an > undefined variable error, even though the variable is defined in the > line above. I've seen this done in other scripts, but not necessarily in > a while loop - is that the problem? It sounds like you are defining the variable "inc" in Python but then expecting gnuplot to know how to put it into a string. Either you have to define the variable in gnuplot or you have to do the string interpolation in Python. You might try the "debug" option to the Gnuplot constructor to see what commands it is passing to gnuplot. That might make the situation clearer. Michael -- Michael Haggerty mh...@al... http://softwareswirl.blogspot.com/ |
From: tony <t.v...@in...> - 2011-07-03 09:54:50
|
Thanks Michael I can now place a label on the graph, but what I really want to do is have the label be a variable that is updated every few seconds. I've tried to include this in g('set label 1 sprintf("%f",inc) at 2,2') where inc is the variable but in a While loop I keep getting an undefined variable error, even though the variable is defined in the line above. I've seen this done in other scripts, but not necessarily in a while loop - is that the problem? Thanks Tony |
From: Michael H. <mh...@al...> - 2011-07-03 03:32:53
|
On 07/02/2011 10:11 AM, tony wrote: > I've just found gnuplot-py and love it - thanks. I use it to provide > realtime plotting of serial data from an Arduino power logger. > I'm wondering if it is possible to add a label e.g. text to the chart > similar to the set label command in gnuplot? i.e not an axis label but a > text label on the chart. You can pass arbitrary commands to gnuplot; e.g., g = Gnuplot.Gnuplot() g('set label ...') Michael -- Michael Haggerty mh...@al... http://softwareswirl.blogspot.com/ |
From: tony <t.v...@in...> - 2011-07-02 08:11:41
|
Hi I've just found gnuplot-py and love it - thanks. I use it to provide realtime plotting of serial data from an Arduino power logger. I'm wondering if it is possible to add a label e.g. text to the chart similar to the set label command in gnuplot? i.e not an axis label but a text label on the chart. Thanks |
From: Michael H. <mh...@al...> - 2011-07-01 08:53:45
|
On 07/01/2011 07:03 AM, Ben Whale wrote: > [...] Thus I'm assuming that my > problem is due to something like the temporary files for each g.plot() > call being removed when a new Gnuplot.Gnuplot object is instantiated. > > Am I right? It indeed sounds like a problem with temporary files being deleted too early (or perhaps with the gnuplot processes being killed too early). It is not immediately obvious why the last plot *doesn't* fail if the rest of them do fail. The handling of temporary files varies from platform to platform. What platform are you using? You should also try the suggestions in the first FAQ question. Michael -- Michael Haggerty mh...@al... http://softwareswirl.blogspot.com/ |
From: Ben W. <ben...@ot...> - 2011-07-01 05:10:19
|
Hi The pseudo code representing my code is as follows: def plot(gnuCommands, data, fileID) #gnuCommands is an array of strings #data is a 2D numpy array with data[0] #giving the x-axis and data[1] giving the #y-values over the x-axis for some function g = Gnuplot.Gnuplot() fileName = getFileName(fileID) for command in gnuCommands: g(command) g('set terminal postscript enhance color') g('set output "fileName"') g.plot(data[0],data[1]) g.close() def foo(args): #args is an array of 2D numpy arrays gnuCommands = getCommands() for arg in args: plot(gnuCommands, arg, getFileID()) The result of this is that the last call to plot produces a correct plot. All preceding calls produce an empty plot. The only fix I've found is to initialise g in foo and pass it to plot. Thus I'm assuming that my problem is due to something like the temporary files for each g.plot() call being removed when a new Gnuplot.Gnuplot object is instantiated. Am I right? I'd like to keep the initialisation of Gnuplot.Gnuplot within the plot method (in my case the plot method is in a different class and I'd prefer not to include needless requirements for initialisation on other classes that use this method). What steps can I take to fix this? E.g. if the temporary file thing is the problem is there a way to make them permanent? (It's not a bad thing in my case to have the data output in such a way). Cheers, Ben |
From: calmar c. <ma...@ca...> - 2011-06-01 20:56:09
|
On Wed, Jun 01, 2011 at 10:56:00AM +0200, Michael Buttgereit wrote: hi Michael, > pythonscript 1>/dev/null 2>/dev/null or 1>/dev/null 2>&1 I think, But actually I would prefer to get rid of it 'inside' the pythonscript. Possibly that scrips gets some use on MS as well. Anyway, there is only this warning about the empty y2 range now (since the values are 0 all the time sometimes). it's not an overly big issue. Cheers and thanks, marco PS "Extraterrestrische Physik" wow :) > > actually all the output to stdout and stderr will then be deleted. > > maybe that helps. :) > > --- > On Wed, 1 Jun 2011 10:30:36 +0200 > "calmar c." <ma...@ca...> wrote: > > > On Wed, Jun 01, 2011 at 10:11:43AM +0200, Michael Buttgereit wrote: > > hi Michael, > > > > > > > > if you are on a linux machine you can start gnuplot with > > > > > > >> gnuplot 2>>/dev/null > > > > > > this will pipe the err_stream to dev/null and you have a clean > > > output. > > > > > > but there are some drawbacks. ;-) > > > > > > Regards > > > Michael > > > > Ah Ok, I guess this would be the solution to get rid of Warning > > messages like: "Warning: empty y2 range [0:0], adjusting to > > [-1:1]" - they are still there. > > > > pythonscript 2>/dev/null worked at least. > > > > Cheers > > marco > > > > > > > > ---- > Michael Buttgereit > Extraterrestrische Physik, IEAP > Christian-Albrechts-Universitaet zu Kiel > Telefon: +49(431) 880 3799 > www.ieap.uni-kiel.de/et > > ------------------------------------------------------------------------------ > Simplify data backup and recovery for your virtual environment with vRanger. > Installation's a snap, and flexible recovery options mean your data is safe, > secure and there when you need it. Data protection magic? > Nope - It's vRanger. Get your free trial download today. > http://p.sf.net/sfu/quest-sfdev2dev > _______________________________________________ > Gnuplot-py-users mailing list > Gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-py-users -- (o_ It rocks: LINUX + Command-Line-Interface //\ GPG: 0x59D90F4D V_/_ http://www.calmar.ws |
From: Michael B. <but...@ph...> - 2011-06-01 09:24:29
|
Hmm, well I'm not quite sure but you can start your script with pythonscript 1>/dev/null 2>/dev/null actually all the output to stdout and stderr will then be deleted. maybe that helps. :) --- On Wed, 1 Jun 2011 10:30:36 +0200 "calmar c." <ma...@ca...> wrote: > On Wed, Jun 01, 2011 at 10:11:43AM +0200, Michael Buttgereit wrote: > hi Michael, > > > > > if you are on a linux machine you can start gnuplot with > > > > >> gnuplot 2>>/dev/null > > > > this will pipe the err_stream to dev/null and you have a clean > > output. > > > > but there are some drawbacks. ;-) > > > > Regards > > Michael > > Ah Ok, I guess this would be the solution to get rid of Warning > messages like: "Warning: empty y2 range [0:0], adjusting to > [-1:1]" - they are still there. > > pythonscript 2>/dev/null worked at least. > > Cheers > marco > > ---- Michael Buttgereit Extraterrestrische Physik, IEAP Christian-Albrechts-Universitaet zu Kiel Telefon: +49(431) 880 3799 www.ieap.uni-kiel.de/et |
From: calmar c. <ma...@ca...> - 2011-06-01 08:30:45
|
On Wed, Jun 01, 2011 at 10:11:43AM +0200, Michael Buttgereit wrote: hi Michael, > > if you are on a linux machine you can start gnuplot with > > >> gnuplot 2>>/dev/null > > this will pipe the err_stream to dev/null and you have a clean output. > > but there are some drawbacks. ;-) > > Regards > Michael Ah Ok, I guess this would be the solution to get rid of Warning messages like: "Warning: empty y2 range [0:0], adjusting to [-1:1]" - they are still there. pythonscript 2>/dev/null worked at least. Cheers marco -- (o_ It rocks: LINUX + Command-Line-Interface //\ GPG: 0x59D90F4D V_/_ http://www.calmar.ws |
From: calmar c. <ma...@ca...> - 2011-06-01 08:15:29
|
On Wed, Jun 01, 2011 at 09:48:46AM +0200, calmar c. wrote: > Hi all, > > is there a way to make gnuplot silent - i.e. pipes stuff to > gnuplot but not printing it out to the terminal (what is does > actually)? OPS, I just saw the debug=1 thing ... ok making it a debug=0 did the trick :) thanks and cheers marco -- (o_ It rocks: LINUX + Command-Line-Interface //\ GPG: 0x59D90F4D V_/_ http://www.calmar.ws |
From: calmar c. <ma...@ca...> - 2011-06-01 08:06:59
|
Hi all, is there a way to make gnuplot silent - i.e. pipes stuff to gnuplot but not printing it out to the terminal (what is does actually)? Thanks a lot marco -- (o_ It rocks: LINUX + Command-Line-Interface //\ GPG: 0x59D90F4D V_/_ http://www.calmar.ws |
From: Ben W. <bw...@ma...> - 2011-03-01 20:16:19
|
Ah! Cheers, I did wonder if it was some thing like that. My guess is that changing the GnuPlot.py code would be quite involved and therefore beyond both my skill and available time. Thanks for the quick answer! Ben On 03/01/2011 09:00 PM, Michael Haggerty wrote: > On 03/01/2011 02:51 AM, Ben Whale wrote: >> I'm not famliar with the inner workings of GnuPlot.py and am very >> confused by an error I get. Anyone have an suggestions how I could avoid >> it? Details below. >> >> Here's some sudo-code indicating how I'm using GnuPlot.py: >> >> g = GnuPlot.Gnuplot() >> domain = calculate_function_domain() >> time = 0 >> C = 1000000 #just a very large number >> t = 0 >> while t<C: >> data = function(domain, t) >> p = Gnuplot.Data(domain,data) >> g.plot(p) >> time.sleep(0.01) >> t+=1 #just an example num >> >> This is the traceback for the error: >> >> Traceback (most recent call last): >> [...] >> File "/usr/lib/python2.7/site-packages/Gnuplot/PlotItems.py", line >> 485, in get_base_command_string >> fifo = _FIFOWriter(self.content, self.mode) >> File "/usr/lib/python2.7/site-packages/Gnuplot/PlotItems.py", line >> 443, in __init__ >> self.start() >> File "/usr/lib64/python2.7/threading.py", line 473, in start >> _start_new_thread(self.__bootstrap, ()) >> thread.error: can't start new thread > Gnuplot.py us using fifos to write to gnuplot, and it does so by > starting a thread for each Data object that is plotted. (This could be > improved, but that's how it works now...) Each of these threads should > die as soon as gnuplot is done reading the input from the corresponding > FIFO. > > For some reason it is having trouble starting one of these threads. > Assuming that the problem only occurs after many iterations of the loop, > the most likely cause is that the process already has too many threads > running and is therefore not allowed to start a new thread. This, in > turn, is probably because your loop is trying to write data to gnuplot > faster than gnuplot can process them, and therefore many commands are > backing up in gnuplot's stdin. When the number of backed-up commands > equals the number of allowed threads, BOOM. > > You could try increasing the sleep time between iterations, or somehow > changing the Gnuplot.py code to limit the number of FIFO threads that > are allowed to run at once. In any case, you will have to find a way to > prevent your program from getting so far ahead of gnuplot, otherwise > even if threads don't run out, some other resource will. > > Michael > |
From: Michael H. <mh...@al...> - 2011-03-01 08:00:38
|
On 03/01/2011 02:51 AM, Ben Whale wrote: > I'm not famliar with the inner workings of GnuPlot.py and am very > confused by an error I get. Anyone have an suggestions how I could avoid > it? Details below. > > Here's some sudo-code indicating how I'm using GnuPlot.py: > > g = GnuPlot.Gnuplot() > domain = calculate_function_domain() > time = 0 > C = 1000000 #just a very large number > t = 0 > while t<C: > data = function(domain, t) > p = Gnuplot.Data(domain,data) > g.plot(p) > time.sleep(0.01) > t+=1 #just an example num > > This is the traceback for the error: > > Traceback (most recent call last): > [...] > File "/usr/lib/python2.7/site-packages/Gnuplot/PlotItems.py", line > 485, in get_base_command_string > fifo = _FIFOWriter(self.content, self.mode) > File "/usr/lib/python2.7/site-packages/Gnuplot/PlotItems.py", line > 443, in __init__ > self.start() > File "/usr/lib64/python2.7/threading.py", line 473, in start > _start_new_thread(self.__bootstrap, ()) > thread.error: can't start new thread Gnuplot.py us using fifos to write to gnuplot, and it does so by starting a thread for each Data object that is plotted. (This could be improved, but that's how it works now...) Each of these threads should die as soon as gnuplot is done reading the input from the corresponding FIFO. For some reason it is having trouble starting one of these threads. Assuming that the problem only occurs after many iterations of the loop, the most likely cause is that the process already has too many threads running and is therefore not allowed to start a new thread. This, in turn, is probably because your loop is trying to write data to gnuplot faster than gnuplot can process them, and therefore many commands are backing up in gnuplot's stdin. When the number of backed-up commands equals the number of allowed threads, BOOM. You could try increasing the sleep time between iterations, or somehow changing the Gnuplot.py code to limit the number of FIFO threads that are allowed to run at once. In any case, you will have to find a way to prevent your program from getting so far ahead of gnuplot, otherwise even if threads don't run out, some other resource will. Michael -- Michael Haggerty mh...@al... http://softwareswirl.blogspot.com/ |
From: Ben W. <bw...@ma...> - 2011-03-01 01:47:06
|
Hi I'm not famliar with the inner workings of GnuPlot.py and am very confused by an error I get. Anyone have an suggestions how I could avoid it? Details below. Here's some sudo-code indicating how I'm using GnuPlot.py: g = GnuPlot.Gnuplot() domain = calculate_function_domain() time = 0 C = 1000000 #just a very large number t = 0 while t<C: data = function(domain, t) p = Gnuplot.Data(domain,data) g.plot(p) time.sleep(0.01) t+=1 #just an example num This is the traceback for the error: Traceback (most recent call last): File "main.py", line 52, in <module> problem.run(tstart, tstop) File "/mnt/maybe/home/bwhale/Documents/Academic/Research/Current work/Numerical/git/gravity/Code/EvolutionSBP/Main_program/code/ibvp.py", line 88, in run action(self.iteration, u) File "/mnt/maybe/home/bwhale/Documents/Academic/Research/Current work/Numerical/git/gravity/Code/EvolutionSBP/Main_program/code/actions.py", line 11, in __call__ self._doit(it, u) File "/mnt/maybe/home/bwhale/Documents/Academic/Research/Current work/Numerical/git/gravity/Code/EvolutionSBP/Main_program/code/actions.py", line 65, in _doit g.plot(*graphs) File "/usr/lib/python2.7/site-packages/Gnuplot/_Gnuplot.py", line 285, in plot self.refresh() File "/usr/lib/python2.7/site-packages/Gnuplot/_Gnuplot.py", line 225, in refresh plotcmds.append(item.command()) File "/usr/lib/python2.7/site-packages/Gnuplot/PlotItems.py", line 192, in command self.get_base_command_string(), File "/usr/lib/python2.7/site-packages/Gnuplot/PlotItems.py", line 485, in get_base_command_string fifo = _FIFOWriter(self.content, self.mode) File "/usr/lib/python2.7/site-packages/Gnuplot/PlotItems.py", line 443, in __init__ self.start() File "/usr/lib64/python2.7/threading.py", line 473, in start _start_new_thread(self.__bootstrap, ()) thread.error: can't start new thread |
From: <bm...@ca...> - 2011-02-22 10:41:48
|
It would be nice to have a cookbook section somewhere where interesting code examples can be posted. Benny Quoting Michael Haggerty <mh...@al...>: > On 02/21/2011 09:51 PM, John E Field wrote: >> I installed Gnuplot.py and I like it a lot. How about a really quick and >> easy routine to just plot a function or several functions. It seems like >> I am plotting things so much that I shouldn't have to write several >> lines of code to make it happen. Perhaps it is already in there and I >> just don't know about it. Something sort of like this : > > I'm not such a fan of magical functions that try to guess what you mean. > The problem is that everybody has a different opinion about what magic > they prefer. I prefer flexible but straightforward functions that can > be *used* to make magical functions. So I wouldn't advocate putting a > function like this in Gnuplot.py, though it is a fine example. > >> gplot(x,y) <- plots y vs x >> gplot(x,y,with_='lines',title='my title') <- adds title and plots with lines >> gplot(x,y,z) <- plots y and z versus x >> gplot([1,2],sin) <- plots sin(x) from 1.0 to 2.0 >> >> and, the code might look something like this : >> >> def gplot(*xy,**args) : >> """ routine for plotting a function using gnuplot directly from python >> usage: pass arguments in args. for with lines, do with_='lines' >> title = 'my title' >> xlabel= 'my xlabel', >> etc. >> if the persist option is false, then the plot will only last >> until the returned object is destroyed >> otherwise, the plot is forever. >> """ >> try : >> if args.has_key('persist') : >> g = Gnuplot.Gnuplot(persist=args['persist']); >> del args['persist']; >> else : g = Gnuplot.Gnuplot(persist=True); >> except : >> from Gnuplot import Gnuplot,Data >> if args.has_key('persist') : >> g = Gnuplot(persist=args['persist']); >> del args['persist']; >> else : g = Gnuplot(persist=True); >> x = xy[0]; >> if len(x) == 2 : # fill up the range >> x = [x[0]+(x[1]-x[0])*0.005*i for i in range(201)]; >> d = []; # make an argument list for each plot function >> for yi in xy[1:] : >> if not (yi.__class__ is list or yi.__class__ is tuple) : yi = >> map(yi,x); >> if args.has_key('with_') : >> di = Data(x,yi,with_=args['with_']); >> else : di = Data(x,yi); >> d.append(di); >> if args.has_key('with_') : del args['with_']; >> return g.plot(*d,**args); > > BTW, there are some things in your function that can be simplified > (untested code): > > def gplot(*xy,**args): > """...""" > try: > Gnuplot, Data > except NameError: > from Gnuplot import Gnuplot, Data > > g = Gnuplot(persist=args.pop('persist', True)); > > x = xy[0] > if len(x) == 2: > # fill up the range > x = [x[0]+(x[1]-x[0])*0.005*i for i in range(201)] > d = [] # make an argument list for each plot function > data_opts = {} > if 'with_' in args: > data_opts['with_'] = args.pop('with_') > for yi in xy[1:]: > if not isinstance(yi, (list, tuple)): > yi = map(yi,x) > d.append(Data(x, yi, **data_args)) > return g.plot(*d, **args) > > Michael > > -- > Michael Haggerty > mh...@al... > http://softwareswirl.blogspot.com/ > > ------------------------------------------------------------------------------ > Index, Search & Analyze Logs and other IT data in Real-Time with Splunk > Collect, index and harness all the fast moving IT data generated by your > applications, servers and devices whether physical, virtual or in the cloud. > Deliver compliance at lower cost and gain new business insights. > Free Software Download: http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > Gnuplot-py-users mailing list > Gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-py-users > ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. |
From: Michael H. <mh...@al...> - 2011-02-22 09:16:13
|
On 02/21/2011 09:51 PM, John E Field wrote: > I installed Gnuplot.py and I like it a lot. How about a really quick and > easy routine to just plot a function or several functions. It seems like > I am plotting things so much that I shouldn't have to write several > lines of code to make it happen. Perhaps it is already in there and I > just don't know about it. Something sort of like this : I'm not such a fan of magical functions that try to guess what you mean. The problem is that everybody has a different opinion about what magic they prefer. I prefer flexible but straightforward functions that can be *used* to make magical functions. So I wouldn't advocate putting a function like this in Gnuplot.py, though it is a fine example. > gplot(x,y) <- plots y vs x > gplot(x,y,with_='lines',title='my title') <- adds title and plots with lines > gplot(x,y,z) <- plots y and z versus x > gplot([1,2],sin) <- plots sin(x) from 1.0 to 2.0 > > and, the code might look something like this : > > def gplot(*xy,**args) : > """ routine for plotting a function using gnuplot directly from python > usage: pass arguments in args. for with lines, do with_='lines' > title = 'my title' > xlabel= 'my xlabel', > etc. > if the persist option is false, then the plot will only last > until the returned object is destroyed > otherwise, the plot is forever. > """ > try : > if args.has_key('persist') : > g = Gnuplot.Gnuplot(persist=args['persist']); > del args['persist']; > else : g = Gnuplot.Gnuplot(persist=True); > except : > from Gnuplot import Gnuplot,Data > if args.has_key('persist') : > g = Gnuplot(persist=args['persist']); > del args['persist']; > else : g = Gnuplot(persist=True); > x = xy[0]; > if len(x) == 2 : # fill up the range > x = [x[0]+(x[1]-x[0])*0.005*i for i in range(201)]; > d = []; # make an argument list for each plot function > for yi in xy[1:] : > if not (yi.__class__ is list or yi.__class__ is tuple) : yi = > map(yi,x); > if args.has_key('with_') : > di = Data(x,yi,with_=args['with_']); > else : di = Data(x,yi); > d.append(di); > if args.has_key('with_') : del args['with_']; > return g.plot(*d,**args); BTW, there are some things in your function that can be simplified (untested code): def gplot(*xy,**args): """...""" try: Gnuplot, Data except NameError: from Gnuplot import Gnuplot, Data g = Gnuplot(persist=args.pop('persist', True)); x = xy[0] if len(x) == 2: # fill up the range x = [x[0]+(x[1]-x[0])*0.005*i for i in range(201)] d = [] # make an argument list for each plot function data_opts = {} if 'with_' in args: data_opts['with_'] = args.pop('with_') for yi in xy[1:]: if not isinstance(yi, (list, tuple)): yi = map(yi,x) d.append(Data(x, yi, **data_args)) return g.plot(*d, **args) Michael -- Michael Haggerty mh...@al... http://softwareswirl.blogspot.com/ |
From: John E F. <jf...@do...> - 2011-02-21 20:52:28
|
Hi All, I installed Gnuplot.py and I like it a lot. How about a really quick and easy routine to just plot a function or several functions. It seems like I am plotting things so much that I shouldn't have to write several lines of code to make it happen. Perhaps it is already in there and I just don't know about it. Something sort of like this : gplot(x,y) <- plots y vs x gplot(x,y,with_='lines',title='my title') <- adds title and plots with lines gplot(x,y,z) <- plots y and z versus x gplot([1,2],sin) <- plots sin(x) from 1.0 to 2.0 and, the code might look something like this : def gplot(*xy,**args) : """ routine for plotting a function using gnuplot directly from python usage: pass arguments in args. for with lines, do with_='lines' title = 'my title' xlabel= 'my xlabel', etc. if the persist option is false, then the plot will only last until the returned object is destroyed otherwise, the plot is forever. """ try : if args.has_key('persist') : g = Gnuplot.Gnuplot(persist=args['persist']); del args['persist']; else : g = Gnuplot.Gnuplot(persist=True); except : from Gnuplot import Gnuplot,Data if args.has_key('persist') : g = Gnuplot(persist=args['persist']); del args['persist']; else : g = Gnuplot(persist=True); x = xy[0]; if len(x) == 2 : # fill up the range x = [x[0]+(x[1]-x[0])*0.005*i for i in range(201)]; d = []; # make an argument list for each plot function for yi in xy[1:] : if not (yi.__class__ is list or yi.__class__ is tuple) : yi = map(yi,x); if args.has_key('with_') : di = Data(x,yi,with_=args['with_']); else : di = Data(x,yi); d.append(di); if args.has_key('with_') : del args['with_']; return g.plot(*d,**args); cheers, John Field |
From: manuel a. <al...@gm...> - 2011-02-13 11:43:54
|
Following crashes, === ... >>> gp = Gnuplot.Gnuplot(persist = 1) >>> gp('set xdata time') >>> gp('set timefmt "%Y-%m-%d"') >>> data = [['2010-01-01',1] ['2010-02-02',2]] >>> plot1 = Gnuplot.PlotItems.Data(data, with_="lines") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.6/dist-packages/Gnuplot/PlotItems.py", line 549, in Data data = utils.float_array(data[0]) File "/usr/lib/python2.6/dist-packages/Gnuplot/utils.py", line 33, in float_array return numpy.asarray(m, numpy.float32) File "/usr/lib/python2.6/dist-packages/numpy/core/numeric.py", line 230, in asarray return array(a, dtype, copy=False, order=order) ValueError: setting an array element with a sequence. I read that it is known issue, the communication between python and native gnuplot works with passing arrays. In my case they don't have expected pattern/structure. Does somebody know workaround so it works directly in python script? Currently I spit out .csv data to file and then "natively" plot it under gnuplot console. I am using gnuplot.py 1.8-1.1 with transitive dep to numpy 1.3.0. thanks. -- manuel aldana al...@gm... software-engineering blog: http://www.aldana-online.de |
From: Peter V. <pvi...@gm...> - 2010-12-18 20:05:27
|
After installation of Gnuplot.py, I'm getting the following: >> gnuplot dyld: Library not loaded: /opt/local/lib/libXau.6.dylib Referenced from: /opt/local/lib/libgd.2.dylib Reason: no suitable image found. Did find: /opt/local/lib/libXau.6.dylib: mach-o, but wrong architecture Trace/BPT trap Any help would be most appreciated. Thanks. |
From: Michael H. <mh...@al...> - 2010-11-29 13:56:27
|
On 11/29/2010 09:05 AM, Paul Bukhovko wrote: > I want to translate 'Gnuplot.py' page > (http://gnuplot-py.sourceforge.net/ ) to Belorussian language, which is > my mother tongue. > > When I"ll be done I'm gonna send to you a link to the article. Is it ok > with you, don't you mind? This is fine with me. > Do you prefer email or IM for contact (if any questions regarding the > translation arise)? What instant messaging client (if any) do you use? > AIM, MSN, Skype? I suggest that most contact be via the mailing list rather than to me directly, as I have not been active in the Gnuplot.py project for quite a while. I have sent a copy of this email to the mailing list: gnu...@li... If you need a quick answer to something, I am usually available at mh...@ja... (XMPP) mh...@ir... (IRC) There is no Gnuplot.py IRC channel (at least none that I know of). Michael -- Michael Haggerty mh...@al... http://softwareswirl.blogspot.com/ |
From: Michael H. <mh...@al...> - 2010-11-17 09:15:20
|
On 11/16/2010 11:28 PM, the olele wrote: > ok, I know this is not pretty. It's what usually happens when I've been > beating my head ineffectively against the wall. > issue one: I'm trying to create two lists, one 'read', the other > 'write', and then plot them to a png file. I've had success with (much > prettier code) > using temp files, but it seems that one should not have to use temp > files, passing instead an array or file object. > issue two: the data points represent (x) - a set of variable intervals > (time between responses) and (y) an set of irregular data points > (duration of response) > the time - xrange - either doesn't format correctly or throws an > exception: 'x range is invalid' or the infamous ' Need full using spec > for x time data'. > > code: > [...] > what am I doing wrong? Gnuplot.py doesn't know anything about dates, so if you want to avoid a temporary file you might have to define your own PlotItem type. The interface of PlotItem is flexible and not so complicated, so it should be possible to write one by using the existing PlotItems as examples. Michael -- Michael Haggerty mh...@al... http://softwareswirl.blogspot.com/ |
From: the o. <the...@ho...> - 2010-11-16 22:28:42
|
ok, I know this is not pretty. It's what usually happens when I've been beating my head ineffectively against the wall.issue one: I'm trying to create two lists, one 'read', the other 'write', and then plot them to a png file. I've had success with (much prettier code)using temp files, but it seems that one should not have to use temp files, passing instead an array or file object.issue two: the data points represent (x) - a set of variable intervals (time between responses) and (y) an set of irregular data points (duration of response)the time - xrange - either doesn't format correctly or throws an exception: 'x range is invalid' or the infamous ' Need full using spec for x time data'.code:import os, sys, string, Gnuplot#must be negative, offset from end of filelimit = -100#input file/data mungingwrite_list = []read_list = []input_file_name = sys.argv[1]protocol = sys.argv[2]shortname = input_file_name.rstrip('.db')input_file = open(input_file_name, 'r')input_list = input_file.readlines()input_file.close()for line in input_list[ limit: ]: delta = 0 timestamp = 0.0 line = line.rstrip("\n") line_protocol, line_verb, delta, timestamp = line.split('|') a = [timestamp,delta] if timestamp and delta: if line_protocol == protocol: if line_verb == 'read': read_list.append(a) else: write_list.append(a)#gnuplot stuffgnuplot_file = ""png_file = "plot/_%s.png" % (shortname)g = Gnuplot.Gnuplot()g.title(protocol + ' history for ' + shortname)g('set style data linespoints')g('set xdata time')g('set timefmt "%s"')g('set format x "%b %y"')g('set xtics 2628000')g('set datafile separator ","')g('set autoscale')g('set grid xtics ytics')g('set terminal png')g('set output %s' % (png_file))#cmd = ' "%s" using 1:2 axes x1y1 title "write" with lines, "%s" using 1:2 axes x2y2 title "read" with lines' % (write_list, read_list)write_data = Gnuplot.PlotItems.Data( write_list, using= '1:2 axes x1y1', with_='linespoints', title='write', inline=True)read_data = Gnuplot.PlotItems.Data( read_list, using= '1:2 axes x2y2', with_='linespoints', title='read', inline=True)#allData = [write_data, read_data]#g.plot(cmd)g.plot(write_data) </snip> what am I doing wrong? thanks a lot |
From: Michael H. <mh...@al...> - 2010-10-21 04:45:59
|
On 10/20/2010 05:37 PM, Jan-Hendrik Hanne wrote: > Gnuplot.py works fine on my machine (Ubuntu). > My Python-Gui (gtk) opens a Gnuplot Window and updates the plots from > time to time. > Python can close the Gnuplot-Window by sending 'quit' to gnuplot. > If the user closes the Gnuplot-Window by clicking the X, the window will > appear again, when the plots are updated. > > Can a message (function call) be send from gnuplot to python, when the > window is closed or can python observe the gnuplot window? I don't know of a way to ask gnuplot to generate a notification that a window has been closed. Perhaps the Python program could use some windows manager trickery to detect the closing of the window. Michael -- Michael Haggerty mh...@al... http://softwareswirl.blogspot.com/ |
From: Jan-Hendrik H. <j-h...@tu...> - 2010-10-20 15:37:45
|
Hi! Gnuplot.py works fine on my machine (Ubuntu). My Python-Gui (gtk) opens a Gnuplot Window and updates the plots from time to time. Python can close the Gnuplot-Window by sending 'quit' to gnuplot. If the user closes the Gnuplot-Window by clicking the X, the window will appear again, when the plots are updated. Can a message (function call) be send from gnuplot to python, when the window is closed or can python observe the gnuplot window? Best regards, Jan |
From: Cuneyt E. <cun...@gm...> - 2010-10-10 22:44:22
|
> Hi, > > I wan to plot more than one curve in the same graph using same function > with different parameters. The following code works without problem. > > from numpy import * > import Gnuplot > > gp = Gnuplot.Gnuplot(persist=1) > x = arange(0,1,0.01,dtype='float_') > d1 = Gnuplot.Data(x, ozfonksiyon(omegalar[0],x), title='1. ozdeger', > with_='lines') > d2 = Gnuplot.Data(x, ozfonksiyon(omegalar[1],x), title='2. ozdeger', > with_='lines') > d3 = Gnuplot.Data(x, ozfonksiyon(omegalar[2],x), title='3. ozdeger', > with_='lines') > d4 = Gnuplot.Data(x, ozfonksiyon(omegalar[3],x), title='4. ozdeger', > with_='lines') > d5 = Gnuplot.Data(x, ozfonksiyon(omegalar[4],x), title='5. ozdeger', > with_='lines') > gp.plot(d1,d2,d3,d4,d5) > > in this code ozfonksiyon and omegalar are user defined functions. But > what I want is to create plotitems (d1,d2,d3,d4,d5) in a for loop. I > modified the code like below, > > for ii in range(n): > datalar.append("Gnuplot.Data(x, > ozfonksiyon(omegalar["+str(ii)+"],x), with_='lines')") > gp.plot(*datalar) > > I get this error. > > /usr/bin/python -u > "/media/disk/doktora_tezi/tek_cubuk/python_files/CALISAN > KOD/fix_free_controlled_parametrelerin_degisimi_deneme.py" > > gnuplot> plot Gnuplot.Data(x, ozfonksiyon(omegalar[0],x), with_='lines') > , Gnuplot.Data(x, ozfonksiyon(omegalar[1],x), with_='lines') , > Gnuplot.Data(x, ozfonksiyon(omegalar[2],x), with_='lines') , > Gnuplot.Data(x, ozfonksiyon(omegalar[3],x), with_='lines') , > Gnuplot.Data(x, ozfonksiyon(omegalar[4],x), with_='lines') > ^ > line 0: ':' expected > > What am I doing wrong? > You shouldn't make the elements of the datalar array into strings; leave > them as Python objects: > > datalar = [] > for ii in range(n): > datalar.append( > Gnuplot.Data(x, ozfonksiyon(omegalar[ii],x), with_='lines') > ) > gp.plot(*datalar) > > Michael Thank you very much for your answer Michael.But when I was reading your answer, I realised that I missed to add plot items title to the elements of datalar. So I want to change title of each curve due to index value of the loop, how can I do that? What I mean is, datalar = [] for ii in range(n): Gnuplot.Data(x, ozfonksiyon(omegalar[ii],x), title=' ii . ozdeger', with_='lines') Best regards, Cuneyt. |