From: Salman S. <sal...@gm...> - 2016-02-09 23:00:06
|
Anybody can tell me why this file isn't working right? -- Even a Smile is charity :) - Prophet Muhammad |
From: Salman S. <sal...@gm...> - 2016-02-09 23:03:10
|
When I take the following script and run in python, I get gnuplot errors for the data file shown below (shortened version). Any body able to see what is wrong with my plot call? import numpy as np import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils fobj = open("rwtc", "r") x, y, z = np.loadtxt(fobj, delimiter=' ', unpack=True) g = Gnuplot.Gnuplot() g.title('RW Speed vs Time NM ') g.xlabel('time') g.ylabel('speed') g('set term png') g('set out "run.png"') g.plot(Gnuplot.Data(x, using='1', with_='line', title="x"), Gnuplot.Data(y, using='2', with_='line', title="y"), Gnuplot.Data(z, using='3', with_='line', title="z")) You can use this as the file rwtc 0.000402 -0.000017 0.000821 0.000402 -0.000017 0.000821 0.000605 -0.000188 0.001000 0.000365 0.000083 0.000197 0.000343 0.000162 0.000060 0.000323 0.000214 -0.000009 0.000308 0.000226 0.000010 0.000294 0.000229 0.000047 0.000281 0.000232 0.000086 0.000266 0.000237 0.000120 0.000248 0.000245 0.000144 0.000227 0.000255 0.000160 0.000202 0.000266 0.000168 0.000174 0.000278 0.000170 Thanks. Salman On Tue, Feb 9, 2016 at 6:00 PM, Salman Sheikh <sal...@gm...> wrote: > Anybody can tell me why this file isn't working right? > > > > -- > Even a Smile is charity :) > - Prophet Muhammad > > > -- Even a Smile is charity :) - Prophet Muhammad |
From: Bernhard H. <b.h...@fz...> - 2016-02-10 10:40:52
Attachments:
signature.asc
|
Hey, I am not fully sure if I understand what you are trying to do, but "using 1" does not really make sense. If you plot 2D- you have to specify at least 2 columns, like "using 1:2". Are you trying to do a 3D-Plot? On 02/10/2016 12:03 AM, Salman Sheikh wrote: > When I take the following script and run in python, I get gnuplot errors > for the data file shown below (shortened version). Any body able to see > what is wrong with my plot call? > > import numpy as np > import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils > > fobj = open("rwtc", "r") > x, y, z = np.loadtxt(fobj, delimiter=' ', unpack=True) > > g = Gnuplot.Gnuplot() > g.title('RW Speed vs Time NM ') > g.xlabel('time') > g.ylabel('speed') > g('set term png') > g('set out "run.png"') > g.plot(Gnuplot.Data(x, using='1', with_='line', title="x"), > Gnuplot.Data(y, using='2', with_='line', title="y"), > Gnuplot.Data(z, using='3', with_='line', title="z")) > > You can use this as the file rwtc > > 0.000402 -0.000017 0.000821 > 0.000402 -0.000017 0.000821 > 0.000605 -0.000188 0.001000 > 0.000365 0.000083 0.000197 > 0.000343 0.000162 0.000060 > 0.000323 0.000214 -0.000009 > 0.000308 0.000226 0.000010 > 0.000294 0.000229 0.000047 > 0.000281 0.000232 0.000086 > 0.000266 0.000237 0.000120 > 0.000248 0.000245 0.000144 > 0.000227 0.000255 0.000160 > 0.000202 0.000266 0.000168 > 0.000174 0.000278 0.000170 > > Thanks. > > Salman > > > > On Tue, Feb 9, 2016 at 6:00 PM, Salman Sheikh <sal...@gm... > <mailto:sal...@gm...>> wrote: > > Anybody can tell me why this file isn't working right? > > > > -- > Even a Smile is charity :) > - Prophet Muhammad > > > > > > -- > Even a Smile is charity :) > - Prophet Muhammad > > > > > ------------------------------------------------------------------------------ > Site24x7 APM Insight: Get Deep Visibility into Application Performance > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month > Monitor end-to-end web transactions and take corrective actions now > Troubleshoot faster and improve end-user experience. Signup Now! > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 > > > > _______________________________________________ > Gnuplot-py-users mailing list > Gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-py-users > -- Bernhard Hopfenmüller Jülich Centre for Neutron Science JCNS Forschungszentrum Jülich GmbH Outstation at MLZ Lichtenbergstraße 1 85747 Garching GERMANY email: b.h...@fz... phone: +49 89 289 10744 |
From: Salman S. <sal...@gm...> - 2016-02-10 15:13:11
|
Doh, stupid mistake, I figured it out, once I assigned the values to x, y and z using np.loadtxt, I don't need the using 1, etc.. I am not good at python but this was my first foray into writing the code. Now, I got a script that parses a massive file, extracts the data and generates a plot all from the command line. #! /usr/bin/python #import sys import numpy as np import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils fobj = open("rwtc", "r") x, y, z = np.loadtxt(fobj, delimiter=' ', unpack=True) g = Gnuplot.Gnuplot() g.title('Dellingr RW Speed vs Time NM ') g.xlabel('time') g.ylabel('speed') g('set term png') g('set out "run.png"') g.plot(Gnuplot.Data(x, with_='line', title="x"), Gnuplot.Data(y, with_='line', title="y"), Gnuplot.Data(z, with_='line', title="z")) On Tue, Feb 9, 2016 at 6:03 PM, Salman Sheikh <sal...@gm...> wrote: > When I take the following script and run in python, I get gnuplot errors > for the data file shown below (shortened version). Any body able to see > what is wrong with my plot call? > > import numpy as np > import Gnuplot, Gnuplot.PlotItems, Gnuplot.funcutils > > fobj = open("rwtc", "r") > x, y, z = np.loadtxt(fobj, delimiter=' ', unpack=True) > > g = Gnuplot.Gnuplot() > g.title('RW Speed vs Time NM ') > g.xlabel('time') > g.ylabel('speed') > g('set term png') > g('set out "run.png"') > g.plot(Gnuplot.Data(x, using='1', with_='line', title="x"), > Gnuplot.Data(y, using='2', with_='line', title="y"), > Gnuplot.Data(z, using='3', with_='line', title="z")) > > You can use this as the file rwtc > > 0.000402 -0.000017 0.000821 > 0.000402 -0.000017 0.000821 > 0.000605 -0.000188 0.001000 > 0.000365 0.000083 0.000197 > 0.000343 0.000162 0.000060 > 0.000323 0.000214 -0.000009 > 0.000308 0.000226 0.000010 > 0.000294 0.000229 0.000047 > 0.000281 0.000232 0.000086 > 0.000266 0.000237 0.000120 > 0.000248 0.000245 0.000144 > 0.000227 0.000255 0.000160 > 0.000202 0.000266 0.000168 > 0.000174 0.000278 0.000170 > > Thanks. > > Salman > > > > > On Tue, Feb 9, 2016 at 6:00 PM, Salman Sheikh <sal...@gm...> > wrote: > >> Anybody can tell me why this file isn't working right? >> >> >> >> -- >> Even a Smile is charity :) >> - Prophet Muhammad >> >> >> > > > -- > Even a Smile is charity :) > - Prophet Muhammad > > > -- Even a Smile is charity :) - Prophet Muhammad |