0% found this document useful (0 votes)
264 views6 pages

GNU Plot

The document is a quick guide for installing and using the GNUPLOT graphing software. It describes how to install GNUPLOT on Linux, launch the software, and plot basic functions and data from files. Key functions like sine, cosine, and logarithms are predefined. To plot data, the user specifies the file, columns for the x and y-axes, and line style. Axes ranges and grids can be customized.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
264 views6 pages

GNU Plot

The document is a quick guide for installing and using the GNUPLOT graphing software. It describes how to install GNUPLOT on Linux, launch the software, and plot basic functions and data from files. Key functions like sine, cosine, and logarithms are predefined. To plot data, the user specifies the file, columns for the x and y-axes, and line style. Axes ranges and grids can be customized.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

GNUPLOT

Quick Guide

ELECTGON
www.electgon.com
[email protected]

21.06.2018
Contents

1 Installing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Launch Gnuplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Plotting Data From File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Gnuplot 1. Installing

1 Installing
Install gnuplot in linux using
 
$sudo apt-get install gnuplot
 
the following package is also needed to display output graphs
 
$sudo apt-get install gnuplot-x11
 

2 Launch Gnuplot
In terminal window type gnuplot. There are some de ined functions in gnuplot that you can
work with directly.

Function Returns
abs(x) absolute value of x, |x|
acos(x) arc‐cosine of x
asin(x) arc‐sine of x
atan(x) arc‐tangent of x
cos(x) cosine of x, x is in radians.
cosh(x) hyperbolic cosine of x, x is in radians
erf(x) error function of x
exp(x) exponential function of x, base e
inverf(x) inverse error function of x
invnorm(x) inverse normal distribution of x
log(x) log of x, base e
log10(x) log of x, base 10
norm(x) normal Gaussian distribution function
rand(x) pseudo‐random number generator
sgn(x) 1 if x > 0, ‐1 if x < 0, 0 if x=0
sin(x) sine of x, x is in radians
sinh(x) hyperbolic sine of x, x is in radians
sqrt(x) the square root of x
tan(x) tangent of x, x is in radians
tanh(x) hyperbolic tangent of x, x is in radians
Bessel, gamma, ibeta, igamma, and lgamma
functions are also supported. Many functions
can take complex arguments. Binary and unary
operators are also supported.

Table 1: Prede ined Gnuplot Functions [1]

So you can use any of these functions to make operations or to plot it.
 
$gnuplot> plot sin(x)/x
 
this will plot sin(x)/x with x has default range values [‐5:5] to draw for another range type
 
$gnuplot> plot [-15:15] sin(x)/x
 
you can control range of display graph by de ining it as:

3
Gnuplot 3. Plotting Data From File

 
$gnuplot> set xrange [0:5]
$gnuplot> set yrange [-1:1]
$gnuplot> replot
 

3 Plotting Data From File


Assume you have the following data is stored in a text ile called data.txt

1 30

2 35

3 40

4 45

5 50

6 55

7 60

8 65

9 70

10 75

11 80

12 85

To plot this data type


 
$gnuplot> plot “data.”txt using 1:2 with steps
 
Where data.txt is the ile that contains this data, using 1:2 tells the gnuplot to draw
column 2 against column 1, with steps this to draw it as shown in steps; other options is
with lines or with dots or with points or with impulses.

4
Gnuplot 3. Plotting Data From File

Figure 1: Plot File Data

You can display the grid by


 
$gnuplot> set grid
 
Or you can also display grid at subvalues using
 
$gnuplot> set mxtics 5
$gnuplot> set mytics 5
$gnuplot> set grid xtics ytics mxtics mytics
 
To erase it
 
$gnuplot> set grid noxtics noytics
 

5
Bibliography

[1] http://people.duke.edu/~hpgavin/gnuplot.html

[2] https://web.archive.org/web/20121029110317/http://t16web.lanl.gov/Kawano/gnuplot
/index‐e.html

You might also like