Introduction to GnuPlot
from: http://learn.tsinghua.edu.cn/homepage/2001315450/gnuplot-doc/TOC.html
1, Variables and Functions
In 2D plots, the variable to use is x, in 3D plots, use x and y. Multiplication is denoted by *, and division by /. Exponents are denoted by**, and all multiplication must be explicit. That is, 3x would generate and error, you would want to use 3*x.
ps file:
You can also add the with keywork to plot and splot commands. For example,
Define new variables and Functions:
1, Variables and Functions
In 2D plots, the variable to use is x, in 3D plots, use x and y. Multiplication is denoted by *, and division by /. Exponents are denoted by**, and all multiplication must be explicit. That is, 3x would generate and error, you would want to use 3*x.
- The standard trig functions, sin, cos, and tan Note, to use the constant pi can be referenced by just using pi.
- The inverse trig functions , asin, acos, and atan.
- The hyperbolic trig functions, sinh, cosh, and tanh.
- The exp and log function. exp raises e to the power of its argument. For example, 4e2x would be 4*exp(2*x) in Gnuplot. log returns the natural log (base e) of it's argument. This corresponds to ln in normal math notation.
- For information on other functions, type help functions in Gnuplot.
- plot
- plot [x1:x2] [y1:y2]
- plot [x1:x2]
(To just set the x range) - plot [] [y1:y2]
(To just set the y range).
- set xrange [-10:10]
- set autoscale y
- splot
- splot [x1:x2] [y1:y2] [z1:z2]
- splot [x1:x2]
(To just set the x range) - splot [] [y1:y2]
(To just set the y range). - splot [] [] [z1:z2]
(To just set the y range).
- set hidden3d
- replot
- set isosamples x_rate, y_rate
- set contour base - Draw the contour lines along the base of the diagram
- set contour surface - Draws the lines along the 3D surface
- set contour both - Draws lines on both surface and base
- set nocontour - Turns off contour lines
- set view horizontal_angle,vertical_angle
- set view horizontal_angle,vertical_angle,zoom
- set view ,,zoom
- set parametric
- set noparametric
- set polar
- set nopolar
# Example1.dat
# number of subint. - width of subinterval, computed value, abs. error
0 1 5 0.00673794699908559
plot "example1.dat"
- set logscale
- set data style linespoints
- replot
- set nologscale
- plot "example1.dat" using 1:3
3-D data plots:
- set parametric
- set data style lines
- splot "try2.dat"
ps file:
- set output "filename.ps" where filename.ps is the name of the output file.
- set terminal postscript
- replot
- set output "filename.eps"
- set terminal postscript eps
- load 'work.gnu'
You can also add the with keywork to plot and splot commands. For example,
- plot sin(x) with boxes
- plot "turkey.dat" with impulses
Define new variables and Functions:
- constant_name = expression
- function-name(parameters) = expression
- set time
- set title "Farm Data Plot"
- set nokey

0 Comments:
Post a Comment
<< Home