Create your own data plots
Martin Rowe, Senior Technical Editor -- Test & Measurement World, 11/1/2005 2:00:00 AM
|
| The gnuplot plotting software lets you write scripts and plot data. |
Engineers often need to plot and analyze data. While Microsoft Excel covers many data-analysis applications, it doesn't always let you set up a plot the way you want. Enter gnuplot, a free plotting program available at www.gnuplot.info. Currently at version 4.0, gnuplot is a command-line-driven program that lets you plot data in two or three dimensions from just about any data set.
To create a plot, you enter a series of commands that set up the plot's parameters and tell gnuplot where to look for the data. For example, if you type
"plot [-30:30]
sin(pi*x)/(pi*x)"
into the command line, gnuplot will plot sinx/x, where x covers the range of –30 to +30. If you'd prefer not to type each command separately, you can combine a series of commands into a script and then call the script from the command line.
The figure shows a sample plot. Using a DMM, I took 100 samples at 10 samples/s of a 1-Hz waveform and saved the data in a text file. The script defines the graph and tells gnuplot where to find the data. You can download a zip file containing the data set and the script I used.
The following sample from the gnuplot script defines the plot's x axis:
# These format statements
# indicate what the numbers
# will look like on the # graph.
set format x "%0.0s %cs"
set format y "%0.1s %cV"
The first command line sets values in the x axis to display no digits to the right of the decimal point with the value followed by "s". The "%cV" in the second command line sets up each value in the y axis to have one decimal place followed by "V".
If you browse gnuplot's documentation, you'll see that it's a powerful plotting tool. You'll have to spend some time learning to use the command-line syntax, but as an engineer, you can handle it.
Acknowledgement
Thanks to Ron Simonson, product engineer at Analog Devices (Beaverton, OR), for writing the gnuplot script used in this article.
No related content found.
- 0 rated items found.
Datasheets.com Electronic Parts & Inventory Search
185 million searchable parts
- Part Number
- Description
- Inventory
- Products
- Manufacturers























