
| Generating Graphs with gnuplot, Part 1 |
| From: ldn.linuxfoundation.org read times: 102 |
Provided by yangyi at 2009-07-01 23:03:36 |
The gnuplot package can be used to generate some very slick two and three dimensional graphs. Tools such as IOzone make use of gnuplot to generate three dimensional plots letting you see the relative effect that the size of IO requests has on performance. While gnuplot has many features which let you interactively explore your data, it is command line driven and if you don't know the commands you don't get to play the game. The default graphical plot window only has a handful of buttons in a toolbar and no menu to help a user unfamiliar with gnuplot create and modify their graphs. In this article series I'll go though how to change the default setup of gnuplot to be more pleasing, how to make plots from data files and finally how to plot data from SQLite and PostgreSQL databases, including the use of pivot tables to massage the data into the format that gnuplot expects. There are many reasons that one might like to set aside the difficulties in the default user interface and take the time to learn the commands to generate plots with gnuplot. A major benefit of gnuplot is that once you have your graph setup as you like, you can export it as png, jpeg, svg, pdf, postscript, or in many formats that work with LaTeX or plain TeX. You can also save the state of gnuplot to a text file so you can pick up where you left off at a later point. The saved state gnuplot file is a plain text file which contains all the gnuplot commands to setup the same graph again at a later time. This way you can save not only the exported png graphic of the graph but the commands used to generate it. Keeping the saved gnuplot commands around also helps you create new graphs by looking for a graph you have created which is similar to what you are looking to create. In this first part, I'll go into how to make the default settings for gnuplot more attractive. How to set vector fonts for your png exports, how to set the default image width and height of a png export, changing colors to be more legible and easier on the eye. The rendering in gnuplot is handled by what is referred to as a terminal. There are interactive terminals such as x11 and wxt and non interactive ones like PDF and jpeg. If you are using the x11 terminal for interactive graphs you might like to switch to the wxt one because it uses Cairo to render and can make anti-aliased and oversampled graphs which look much nicer than those generated by the default x11 terminal. I'll go over how to change your terminal in a moment. When gnuplot starts up, it reads and interprets the ...... Please access the below link to view the full content. Original link: http://ldn.linuxfoundation.org/a... |