Wednesday, March 11, 2015

Gnuplot Tips (2)

GNUPLOT Tips (2

How to draw the same graph in the same number of figure

gnuplot> set multiplot #is set to multi-graph mode
gnuplot> set origin 0.0,0.5 #set the first figure the location of the origin
gnuplot> set size 0.5,0.5 #set the first figure of the size of the
gnuplot> plot "a1.dat"
gnuplot> set origin 0.5,0.5 #set the second figure the location of the origin
gnuplot> set size 0.5,0.5 #set the size of the second graph
gnuplot> plot "a2.dat"
gnuplot> set origin 0.0,0.0 #set the origin of the third location figure
gnuplot> set size 0.5,0.5 #set the size of the third graph
gnuplot> plot "a3.dat"
gnuplot> set origin 0.5,0.0 #set the fourth position of the origin figure
gnuplot> set size 0.5,0.5 #set the size of the fourth figure
gnuplot> plot "a4.dat"

Of course, if a graph after a quantity of the same set and the previous one, then after a set amount of this can be omitted. For example, on the face of the second, third and fourth the size of the set plans. The previous figure set on a volume will play a role in the latter figure.If you want to cancel the role of the figure in the back, must use the following commands, such as canceling the label, use
gnuplot> unset label

For two-dimensional graphs, how to make both sides of the axis length of the unit length

gnuplot> set size square #the graph is square
gnuplot> set size 0.5,0.5 #the graph is the size you want
gnuplot> set xrange [-a: a]
gnuplot> set yrange [-a: a] #same as the two axes scale range
gnuplot> plot 'a.dat'

How to use the same graph in the left and right sides of the y-axis are drawing

gnuplot> set xtics nomirror #remove the top of the scale axis x2
gnuplot> set ytics nomirror #to remove the right side of the scale axis y2
gnuplot> set x2tics #above the axis to scale automatically generated x2
gnuplot> set y2tics #to the right side of the scale of the axes automatically generated y2
gnuplot> plot sin (x), cos (x) axes x1y2 #cos (x) with x1y2 coordinates, axes x1y2 x1y2 said axis with
gnuplot> plot sin (x), cos (x) axes x2y2 #cos (x) with x2y2 coordinates, axes x2y2 x2y2 said axis with
gnuplot> set x2range [-20:20] #set the range of coordinates x2
gnuplot> replot
gnuplot> set xrange [-5:5] #set the x coordinate of the range
gnuplot> replot
gnuplot> set xlabel 'x'
gnuplot> set x2label 't'
gnuplot> set ylabel 'y'
gnuplot> set y2label 's'
gnuplot> replot
gnuplot> set title 'The figure'
gnuplot> replot
gnuplot> set x2label 't' textcolor lt 3 #textcolor lt 3 or tc lt 3 set the color of the axis name

How to insert Greek letters and special symbols

Generally only in the ps and eps figure, and must specify the enhanced option. In the X11 terminal (ie display) can not be displayed.

gnuplot> set terminal postscript enhanced and Greek letters can, through {/ Symbol a} input. For example,
gnuplot> set label '{/ Symbol a}'

Greek letters and special symbols of various input methods please see the installation package in gnuplot-4.0.0/docs/psdoc directory ps_guide.ps file.
Another See also:
http://t16web.lanl.gov/Kawano/gnuplot/label-e.html # 4.3

Gnuplot how to insert the Angstrom (Egypt) The symbol (A top of a small circle)

Before you insert the script by adding
gnuplot> set encoding iso_8859_1
This command, and then can use the "{\ 305}" added. Abscissa should be labeled as "k (1 /?)":
gnuplot> set xlabel 'k (1 / {\ 305})
If multiplot mode, this command must be placed in
gnuplot> set multiplot
Front.
If the latter have to escape into other characters, but also added after the character in the insert the following command:
set encoding default
Installation package gnuplot-4.0.0/docs/psdoc/ps_guide.ps file table 'E' on behalf of all the symbols in that column are entered using this method.

Gnuplot drawing contour figures

gnuplot> splot 'file name. dat' u 1:2:3 wl #do three-dimensional figure
gnuplot> set dgrid3d 100,100 #three-dimensional figure the surface of the grid to set the number of
gnuplot> replot
gnuplot> set contour #draw contour set
gnuplot> set cntrparam levels incremental -0.2,0.01,0.2 #set spacing of contour lines and scope of the data at intervals from -0.2 to 0.2 0.01 to draw a line between
gnuplot> unset surface to remove the above three-dimensional graphics
Drop the mouse end graphics, you can choose the right angle. Or directly setting (0,0) perspective can also:
gnuplot> set view 0,0
gnuplot> replot

Note here, drawing three-dimensional figure data file to be partitioned, that is, transform a value for each x, y within the range of its change in a week, so as a piece, and then take an x value, y and then changes a week, as the next a block of data, and so on. Between the blocks to open with a blank line grid.

How to draw beautiful pm3d figure

gnuplot> set pm3d #set pm3d mode
gnuplot> set isosamples 50,50 #set grid
gnuplot> splot x ** 2 + y ** 2 #three-dimensional graph drawing
gnuplot> splot x ** 2 + y ** 2 w pm3d #drawn pm3d mode, note that comparing changes
gnuplot> set view 0,0 #set the view, (0,0) to the surface of the projector in the end
gnuplot> splot x ** 2 + y ** 2 w pm3d #redrawn, note the changes
gnuplot> unset ztics #figures to remove the z axis
gnuplot> set isosamples 200,200 #thinner to the grid
gnuplot> replot #redrawn, note the changes, mainly a more smooth transition

Using a script file to avoid duplication of input

Sometimes a data file of a good figure, the next may have to use this data file to draw, but one or some settings to make some subtle changes. At this time, the first time can be plotted all the commands written to a file, such as a.plt, the next as long as the appropriate setting to do modifications, with the following command will automatically run the file all the commands and the last received you want the figure:

gnuplot> load 'a.plt'

As an example, suppose the file name a.plt, the contents of which are:

set pm3d
set view 0,0
unset ztics
set isosamples 200,200
splot x ** 2 + y ** 2 w pm3d
set term post color
set output 'a.ps'
replot

So start gnuplot, simply run the following command on it:

gnuplot> load 'a.plt'

If we want only the. Ps or. Eps figure, it can also be directly in linux command prompt, run the following command:

[Abc @ Abc] $ gnuplot a.plt

In the linux command gnuplot mode

In the gnuplot prompt can run linux commands, but must be preceded by the corresponding command! Number. For example, suppose a lot of parameters have been set, but need to modify a data file a.dat after drawing, you can use as follows:

gnuplot>! vi a.dat

In this way, all the linux commands can be run in gnuplot environment.
Alternatively, you can enter in the gnuplot prompt shell, temporary exit gnuplot, into the linux environment, done things to do, run the exit command, and went back to gnuplot environment.

gnuplot> shell
[Abc @ Abc] $ vi af
[Abc @ Abc] $ f77 af
[Abc @ Abc] $ a.out (assuming the data file generated a.dat)
[Abc @ Abc] $ exit

gnuplot> plot 'a.dat' wl

No comments:

Post a Comment