Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some time-series data I want to visualize as 2d plot.

The input is ISO-date-format and value separated by space, one record per line:

2010-10-21 23
2010-10-22 32

The output should be a nice looking 2d plot. Basic requirements:

  • output to a X11 window (as preview) and to a png file
  • x-axis has to understand the dates and naturally scale the data, e.g. a gap between 3 days should be three times as long as a gap between 1 day
  • should be callable from a script
  • nice output and convenient to use


  • svg output

I tried gnuplot and it works - it has some date support:

gnuplot> set xdata time
gnuplot> set timefmt "%Y-%m-%d"
gnuplot> plot "test.dat" using 1:2

But I have some problems with gnuplot:

  • with default settings plots look very ugly
  • it is difficult to find stuff in the manual - e.g. when plotting points how do I use small filled circles instead of the default '+' sign?
  • the gnuplot shell is a pain in the neck - it does not use readline, it is broken, command completion is a joke, I don't know how to enable vi shortcuts - or if they are supported, what about reverse search etc.

Thus my question: What are the alternatives for visualizing time-series data?

Or am I overstating the gnuplot issues?

share|improve this question
up vote 5 down vote accepted

RRDTool's whole purpose of existence is plotting time series data, but it's primarily meant for automated graphing and may not be the best fit for your needs.

That said:

  • It can output in either PNG or SVG, but has no preview functionality.
  • Time-scaling is built in.
  • Easily scripted (command line access or libraries in many scripting languages).
  • Output can be made to look pretty decent .

RRDTool graph

share|improve this answer
Sounds interesting, missing preview is no that bad - just generating a png and using an image viewer side by side should be ok. Could you give an example of simple command line call of this tool? – maxschlepzig Jan 29 '11 at 10:30
Basically you run rrdtool create ... once to set up the RRD db, rrdtool update ... once per piece of data and rrdtool graph ... to generate a graph. – Kowh Jan 29 '11 at 14:41

R is better at this sort of thing than Gnuplot because:

  1. It's a complete programming environment, with C and Fortran-compatible extension APIs. If your computer can do a thing, you can do it with R.

  2. Many have already contributed their solutions to common problems to the CRAN: Comprehensive R Archive Network. You might find the zoo and ggplot2 packages helpful for this task.

  3. There are many books on time series analysis and R in general.

R has everything you asked for:

  • Outputs to X11, PNG, or (with an add-on) SVG

  • Filled circles for plot points: pass pch=19 or pch=20 to par() or points(). There are many other plot point symbols predefined, plus all of Unicode if you're using a font with Unicode support.

  • Time-aware charting: if the built-in ones don't have the scaling you want, you can build anything you need with R's plotting primitives

  • Callable from a script: use a #!/usr/bin/Rscript shebang line on your R program file

  • Nice and convenient: There are GUI frontends, if you like, and if you don't like, the default command-driven environment has a lot of nice features, like the ability to see the R source code of many builtin operations, which helps to learn how the system is put together. (Yes, much of R is written in R!)

  • Pretty plots: Antialiasing is the default if R is built against Cairo, which it will be if it's a recent build on Linux. Old versions of R may not have AA built in. For an idea of the capability of R if you put a bit of time into it, check this out:

    (Click image for article describing it.)

Regarding the gnuplot command line, you can build it to support GNU readline, BSD libedit, or as a fall-back, a custom built-in command line editing scheme. (This according to p.20 of the manual.) I have gnuplot 3.7 on one machine and 4.0 on another, and they're both built with readline. Is your binary built without any of these?

share|improve this answer
I started using R for all my statistics and plotting at work, it's great! – jsbillings Jan 29 '11 at 1:42
Good hint about libedit. Well, I am using the default gnuplot package on Ubuntu 10.04. It seems that it is linked against libedit which seems to support vi mode at least. But command completion is just minimal (works only for filenames) and not with gnuplot commands, i.e. it is basically useless (this is not the fault of libedit). – maxschlepzig Jan 29 '11 at 2:07
Could you add a simple example R session for generating a basic plot (reading the (above sketched) file and issuing a plot function I guess)? – maxschlepzig Jan 29 '11 at 22:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.