Database Reference
In-Depth Information
Gnuplot is different from most command-line tools we've been using for two reasons.
First, it uses a script instead of command-line arguments. Second, the output is
always written to a file and not printed to standard output.
One great advantage of Gnuplot being around for so long, and the main reason we've
included it in this topic, is that it's able to produce visualizations for the command
line. That is, it's able to print its output to the terminal without the need for a GUI.
Even then, you would still need to set up a script.
Luckily, there is a command-line tool called feedgnuplot (Kogan, 2014), which can
help us with setting up a script for Gnuplot. feedgnuplot is entirely configurable
through command-line arguments. Plus, it reads from standard input. After we have
introduced ggplot2 , we're going to create a few visualizations using feedgnuplot .
One great feature of feedgnuplot that we would like to mention here, is that it allows
you to plot streaming data. The following is a snapshot of a continuously updated
plot based on random input data:
$ while true ; do echo $RANDOM ; done | sample -d 10 | feedgnuplot --stream \
> --terminal 'dumb 80,25' --lines --xlen 10
30000 ++-----+------------+-------------+-------------+------------+-----++
| + * + + + |
| : ** : ******* : *
25000 ++.................*.*..........................*.....*............+*
| : *: * : *: * : *|
| : *: * : *: * : *|
| : * : * : * : * : * |
20000 ++................*....*......................*.........*.........*++
| : * : * : * : * : * |
| : * : * : * : * : * |
15000 ++....**.........*.......*..................*............*.......*.++
| **** :* * : * : * : * : * |
** :* * : * **** * : * : * |
10000 ++.......*......*.........*....**....*.....*..............*.....*..++
| : * * : * ** : * * : * : * |
| : * * : ** : ** * : * : * |
| : * * : : * : * : * |
5000 ++..........*..*.........................*..................*.*....++
| : * * : : : *:* |
| + ** + + + * |
0 ++-----+------*-----+-------------+-------------+------------*-----++
2350 2352 2354 2356 2358
Introducing ggplot2
A more modern software package for creating visualizations is ggplot2 , which is an
implementation of the grammar of graphics in R (Wickham, 2009).
Search WWH ::




Custom Search