This is a nice tool. I am also thinking about getting a matlab which never expires.
The drawing ability of matlab is amazing.
Generally, we want to find a tool that could load the input data file, store the customization of the user, and generate portable figure file format.
In this case, we can write the scripts to draw the graphs and finish this job automatically.
Let's look at gnuplot to see how it fits the needs.
One basic example illustrating the configuration is like this:
set terminal latex
set output "eg3.tex"
set format xy "$%g$" #set the data format in the figure
set title "This is another plot" #title
set xlabel "$x$ axis" #x and y label
set ylabel "$y$ axis"
set key at 15,-10
plot x with lines, "eg3.dat" with linespoints
If we want to print the data in log scale, then the command should be
set log xy #in log scale, the y range must be greater than 0
use:
set xrange [ : ] to set the range of x, similarly for y set yrange..
2. How to load the data from files
The data file can be
Discrete data contained in a file can be displayed by specifying the name of the data file (enclosed in quotes) on the plot or splot command line. Data files should have the data arranged in columns of numbers. Columns should be separated by white space (tabs or spaces) only, (no commas). Lines beginning with a # character are treated as comments and are ignored by Gnuplot. A blank line in the data file results in a break in the line connecting data points.
For example your data file, force.dat , might look like:
# This file is called force.dat
# Force-Deflection data for a beam and a bar
# Deflection Col-Force Beam-Force
0.000 0 0
0.001 104 51
0.002 202 101
0.003 298 148
0.0031 290 149
0.004 289 201
0.0041 291 209
0.005 310 250
0.010 311 260
0.020 280 240
You can display your data by typing:
gnuplot> plot "force.dat" using 1:2 title 'Column', \
"force.dat" using 1:3 title 'Beam'
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.