Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: parse a csv file and create array of arrays and then plot the data

by ambrus (Abbot)
on Jul 20, 2010 at 11:54 UTC ( #850402=note: print w/replies, xml ) Need Help??


in reply to parse a csv file and create array of arrays and then plot the data

Assume the csv file is called a.csv, then preprocess it a bit with this command:

<a.csv tr , \\t | tail -n+2 >a.tsv

Now start gnuplot, and enter the following commands:

set timefmt "%m/%d/%Y" + set xdata time set key outside below plot \ "a.tsv" using 1:4 title "128", \ "a.tsv" using 1:5 title "440", \ "a.tsv" using 1:6 title "1024", \ "a.tsv" using 1:7 title "Mixed"

Feel free to change the commands if you want to change the formatting, or use the set terminal and set output commands to save the plot as an image.

See also Plot a spiral with gnuplot about the general idea of using gnuplot in perl, and Re: Draw chart as an example that uses times as one coordinate.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://850402]
help
Chatterbox?
[Discipulus]: ;=) yes i'm not SO dumb
[LanX]: SO=StackOverflow
[Discipulus]: :=(
[perldigious]: I watched some video on YT awhile back with auto-subtitle on and the speaker had a very thick cockney sort of English accent... hillarity ensued in the subtitles.
[Discipulus]: IHAA=I hate acronyms anyway
LanX LOLs

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2017-06-23 16:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (552 votes). Check out past polls.