[time-nuts] Plotting csv files

Attila Kinali attila at kinali.ch
Thu May 8 09:24:47 UTC 2008


On Thu, 8 May 2008 09:53:34 +0100
"Martyn Smith" <martyn at ptsyst.com> wrote:

> Does anyone has some nice software that will easily plot a csv file.  I do
> need to be able to change the vertical scale rather than have it autorange.
> 
> It doesn't have to be free, but it has to be easy to use.  I've never got 
> the time to "learn" how to use new software.
> Said jackson kindly sent me some software, but I could never get it going.

What is easy to use for you? If you mean point and click, then
probably calc from the Openoffice suit will do the trick (if
it doesn't fail with the same problem like Excel). If you are
not afraid of typing a few comands to plot, then i would recomend
either gnuplot[1] or ploticus[2], both OSS. Gnuplot is simpler to use
for "just plot" stuff or if all you need are calculations on the
data (simple and complex). If you need nicely aranged graphs
then ploticus is the better choice, but also quite a bit more complex
to use.

A sample gnuplot script looks like this:

---
set xdata time 		# x-axis represents a time value
set timefmt "%s"	# the time format is Unix epoc (seconds since 1970)
set format x "%H:%M"	# the display format for the x axis is HH:MM
set terminal png	# the output format is png
set key left center	# the legend should be on the left side, centered

set output "plot.png"	# set the output file name

# plot four lines in one graph:
# first is x: first coulum, y: second coulum times 5 divided by 255
# second is x: first coulum, y: third coulum times 5 divided by 255
# third is x: first coulum, y: fourth coulum
# fourth is x: first coulum, y: fifth coulum

plot "log" using 1:($2*5/255) title "charge voltage" with lines, \
        "log" using 1:($3*5/255) title "battery voltage" with lines, \
        "log" using 1:4 title "charging" with lines, \
        "log" using 1:5 title "discharging" with lines
---

It takes input data from the file "log" of the form of:

---
1210237126, 117, 118, 1, 0
1210237186, 118, 118, 1, 0
1210237246, 118, 118, 0, 1
1210237306, 118, 118, 0, 1
1210237366, 118, 118, 0, 1
---

And generates a plot like the one attached.

HTH

			Attila Kinali

[1] http://www.gnuplot.info/
[2] http://ploticus.sourceforge.net

-- 
Praised are the Fountains of Shelieth, the silver harp of the waters,
But blest in my name forever this stream that stanched my thirst!
                         -- Deed of Morred
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot.png
Type: image/png
Size: 4477 bytes
Desc: not available
URL: <http://febo.com/pipermail/time-nuts_lists.febo.com/attachments/20080508/241b1907/attachment.png>


More information about the Time-nuts_lists.febo.com mailing list