The Artima Developer Community
Sponsored Link

Java Buzz Forum
Gnuplot

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Brian McCallister

Posts: 1282
Nickname: frums
Registered: Sep, 2003

Brian McCallister is JustaProgrammer who thinks too much.
Gnuplot Posted: Mar 8, 2011 2:09 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Brian McCallister.
Original Post: Gnuplot
Feed Title: Waste of Time
Feed URL: http://kasparov.skife.org/blog/index.rss
Feed Description: A simple waste of time and weblog experiment
Latest Java Buzz Posts
Latest Java Buzz Posts by Brian McCallister
Latest Posts From Waste of Time

Advertisement

Gnuplot is a handy-dandy tool for drawing graphs, which not enough people know about. One of its nicest features is that it is fast for large data sets. Take, for example, this plot of response times for calls to an external service which I scrubbed out of some logs a while back::

Graph 1

It was generated in gnuplot from a six hundrend thousand or so line, tab delimited file of times and durations, which looked like:

2010-07-20T01:10:05	368
2010-07-20T01:10:24	368
2010-07-20T01:10:40	332
2010-07-20T01:10:58	328
2010-07-20T01:11:15	518
2010-07-20T01:12:02	131
2010-07-20T01:12:02	167
2010-07-20T01:12:02	445
2010-07-20T01:12:09	105
2010-07-20T01:12:09	274

I like to work in interactive mode, so this was rendered via the following commands, in the interactive prompt:

gnuplot> set xdata time
gnuplot> set timefmt '%Y-%m-%dT%H:%M%S'
gnuplot> set format x '%R'
gnuplot> set terminal png size 640,480
gnuplot> set output '/tmp/graph.png'
gnuplot> plot 'zps.tsv' using 1:2 with dots

To summarize each line we tell it that the X axis is time, give it the time format to read, set the output format for the X axis to be just times, specify png output and size, specify the output file, and then tell it to plot.

Gnuplot has lots more that it can do, one easy and common one is to switch to log scale. Given our previous commands, we can re-render with the Y axis in log scale via:

gnuplot> set logscale y
gnuplot> set output '/tmp/graph-logscale.png'
gnuplot> plot 'zps.tsv' using 1:2 with dots

Which gives us something easier which can be a bit easier to see things outside the outliers around the downtime near the end.

Logscale Graph

It can do some analysis, not nearly what R can do, but really only that related to plotting graphs. It can do other fun things, like three dimensional plots, heat maps, etc. Check out the documentation and have fun!

Read: Gnuplot

Topic: Featureous Previous Topic   Next Topic Topic: links for 2011-02-16

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use