. .
14 2005 .
.
. , , . ,
,
( , , , - ).
Gnuplot?
2 Gnuplot
Gnuplot
6 Gnuplot
12
19
1 Gnuplot?
Gnuplot ,
. , . , + Gnuplot
, * .
, Gnuplot . ,
help PLOT, Gnuplot .
, . , f(x)
F(x) ( ), .
(
).
: cd "mydir"
pwd
, Linux ,
: pwd
reset , .
: reset
help , .
Gnuplot. , .
( Gnuplot)
, .
splot
: help splot
cd
, Gnuplot
xrange
, . set xrange[{min}:{max}]. {min} {max} , .
* (
).
:
set xrange[0:10] 0, 10
set xrange[*:1.2] , 1, 2
set xrange[-0.98:*] 0, 98, Gnuplot
reset
yrange
, xrange, .
key
, , . - ,
set nokey, .
set key {text}.
: set key This is the graph of Bessel function
3
terminal
, Gnuplot .
, .
(, ),
set terminal {terminal-type}.
{terminal-type} help set terminal.
:
set terminal postscript Gnuplot PostScript.
set terminal X11 X11 Linux,
Gnuplot .
set terminal windows , ,
Windows
set terminal latex LATEX.
LATEX, ,
, .
output
. set output {filename}
, terminal, Gnuplot ( ). ,
gnuplot>set terminal postscript
gnuplot>plot sin(x)
PostScript (
). .
: set output "myfile.ps" ( )
myfile.ps.
. : ,
, set output
, .
Gnuplot
, ,
Gnuplot. ,
( C Python !). ,
.
, , .
-, ,
. , ,
f (x) = a sin x,
a , 12 .
Gnuplot,
( ,
)
4
gnuplot>
gnuplot>
gnuplot>
1
gnuplot>
0
a = 1
b = 2
print a
print a/b
, Gnuplot 1 2 . ,
1 .
, , . :
Gnuplot , , . , 4 , 4. .
(
) Gnuplot plot.
plot {<ranges>} {<function>}
{axes <axes>} {<title-spec>} {with <style>}
{, {definitions,} <function> ...}
<ranges>
{<ranges>} ,
.
[{<dummy-var>=}{{<min>}:{<max>}}]
, {<dummy-var>}, 2. ,
, , x. {<min>} {<max>}
. , , * (
Gnuplot ).
[{{<min>}:{<max>}}]
{{<min>} {<max>}} , .
,
, :
x, y. trange, xrange
yrange.
sin x (
set, Gnuplot )
gnuplot>plot sin(x)
1 ,
2
a b p, , a = pb + q, 0 6 q < 1
, [, ]
gnuplot>plot [t=-pi:pi] sin(t)
, t
gnuplot>plot [-pi:pi] [-0.5:0.5] sin(x)
gnuplot>plot [0:*] [*:0.5] sin(x)
<function>
Gnuplot, .
.
Gnuplot ,
C, Pascal Basic. ,
Gnuplot 3 .
2.35 1.6
gnuplot>plot 1/sqrt(2)/sqrt(pi)*exp(-(x-2.35)**2/1.6**2)
(,
, ). ,
gnuplot>p(x)=sin(x)*exp(-x**2)
gnuplot> plot p(x), p(x+1)
{<title-spec>}
, .
title "<title>"|notitle
, .
, ( ). .
\t4 , .
, notitle
( title ).
, , ( ,
,
)
gnuplot>plot besj0(x) title 0th Bessel function,
3
A
,
{with}
Gnuplot (,
, ).
with <style> { {linestyle | ls <line_style>}
| {{linetype | lt <line_type>}
{linewidth | lw <line_width>}
{pointtype | pt <point_type>}
{pointsize | ps <point_size>}} }
, <style>, , .
: lines, points, linespoints, impulses, dots, steps, fsteps, histeps,
errorbars, xerrorbars, yerrorbars, xyerrorbars, boxes, boxerrorbars, boxxyerrorbars, financebars,
candlesticks vectors. .
Gnuplot
5 plot,
( ).
plot <file_name> {index <index list>}
{every <every list>}
{thru <thru expression>}
{using <using list>}
{smooth <option>}
{index <index list>}
(
). .
. <start_point>,
<end_point>. <point_incr>.
.6
{thru <thru expression>}
Gnuplot. ,
plot file thru f(x)
plot file using 1:(f($2))
{using <using list>}
, using .
Gnuplot , , . -.
plot:
, . , .
:
gnuplot> plot - with linespoints
> 1 2
> 2 1
> 3 4
> e
e (
).
, Gnuplot ,
. , replot, , .
Gnuplot .
Gnuplot
Gnuplot , .
, Gnuplot
. ,
Gnuplot.
,
. ,
, . .
if . ,
:
if (<condition>) <command-line>;
if (<condition>) <command-line1>; else <command-line2>
<condition> <commanf-line>.
<command-line1>,
<command-line2>. , Gnuplot ,
if (1>0) print +;
else print -
. , Gnuplot . ,
if.
1>0 , Gnuplot +
, else.
if , . ,
,
C.
if .
:
9
if (<condition1>) <command-line1>;
else if (<condition2>) <command-line2>;
else if ...
else <command-linen>;
<condition1>. ,
<command-line1> .
<condition2> , <command-line2> .
, ( ,
<command-linen>).
Gnuplot . , , . , .
pause. :
pause <time> {"<string>"}
pause mouse {"string"}
<string>
<time>. time .
, -1,
pause -1 Please press any key
. 0
. ,
pause 0 A-A-A
print
print A-A-A
time , .
, mouse,
, Control-C. , , ,
Gnuplot ( - ).
load .
load <filename>
, . , (,
).
Gnuplot , reread. reread .
,
f (x) =
1
1 + ax2
a. : plotter,
10
#
n = n+1
plot 1/(1+n*1.2*x*x)
pause -1 Press any key to continue
if (n < 10) reread
8 .
. cycle:
#
n = 1
set xrange[-3:3]
set yrange[0:1]
load plotter
,
gnuplot cycle
, .
load:
gnuplot> load cycle
, , plotter
cycle.
Gnuplot , load call:
call <input-file> <option1> <option2> ... <optionn10>
, 10 .
Gnuplot <input-file>,
$n, n 0 10. ,
.
4.0 Gnuplot , , bind.
Gnuplot. ,
bind a print 1
, a ( ,
!) .
: ,
11
3.5
lines
. linewidth linetype
.
2.5
1.5
0.5
0.5
1.5
2.5
3.5
3.5
points
.
pointtype ( pt),
pointsize ( ps)
2.5
1.5
0.5
0.5
1.5
2.5
3.5
3.5
linespoints lines
points: , . : linewidth, linetype, pointtype
pointsize
2.5
1.5
0.5
0.5
1.5
2.5
3.5
12
3.5
impulses
x
2.5
1.5
0.5
0.5
1.5
2.5
3.5
dots ,
. ( ,
!).
3.5
steps , ,
gnuplot> plot "datafile.dat" with steps
2.5
1.5
0.5
0.5
1.5
2.5
3.5
3.5
fsteps . .
, .
2.5
1.5
0.5
0.5
1.5
2.5
3.5
13
3.5
histeps. .
.
(x0 , y0 ), (x1 , y1 ) (x2 , y2 )
. Gnuplot ,
x0 + x 1
x1 + x 2
, y1
, y1 .
2
2
2.5
1.5
0.5
0.5
1.5
2.5
3.5
3.5
2.5
1.5
0.5
0.5
1.5
2.5
3.5
3.5
( y = y0
y = y2 ). ,
.
errorbars yerrorbars.
,
. :
, .
(x, y )
(x, y + ), (x, ylow )
(x, yhigh ). Gnuplot : ,
, .
xerrorbars
. , . ,
errorbars
2.5
1.5
0.5
0.5
1.5
2.5
3.5
14
3.5
xyerrorbars , , .
,
errorbars.
2.5
1.5
0.5
0.5
1.5
2.5
3.5
3.5
2.5
1.5
0.5
0.5
1.5
2.5
3.5
boxes .
, x, .
Gnuplot .
, . , , set boxwidth.
,
,
.
15
3.5
2.5
1.5
0.5
0.5
1.5
2.5
3.5
3.5
boxerrorbars .
boxes yerrorbars.
: , .
.
boxxyerrorbars boxes
xyerrorbars. ,
.
2.5
1.5
0.5
0.5
1.5
2.5
3.5
16
3.5
2.5
1.5
0.5
0.5
1.5
2.5
3.5
financebars
(, ). :
x ( ),
, , .
,
.
, , ,
. bar ( set bar).
gnuplot>set bar 5
gnuplot>plot [0.5:3.5] "datafile.dat" \
>notitle with financebars
. , , .
3.5
2.5
1.5
0.5
0.5
1.5
2.5
3.5
candlesticks . : x ( ), , , . ,
x
.
. bar.
17
3.5
vectors (, ).
(x, y) (x + x, y + y) (
).
, .
gnuplot>plot "datafile.dat" with vectors
2.5
1.5
0.5
0.5
1.5
2.5
3.5
18
Gnuplot
abs(x)
acos(x)
acosh(x)
arg(z)
asin(x)
asinh(x)
atan(x)
atan2(x,y)
atanh(x)
besj0(x)
besj1(x)
besy0(x)
besy1(x)
ceil(x)
column(x)
cos(x)
cosh(x)
erf(x)
. , .
arccos x
. ( set angles)
arcsin x
arctg x
x y
0
1
0
1
, x. , x.
cos x
Rx t2
e dt
Erf x =
erfc(x)
exp(x)
floor(x)
gamma(x)
ibeta
igamma
imag
int
inverf
invnorm
lgamma
log
log10
norm
rand
real
sgn
sin
sinh
sqrt
tan
tanh
tm_hour
tm_mday
x ,
1 Erf x
x
(x)
, Erf x
, [1, 1]
19
tm_min
tm_mon
tm_sec
tm_wday
tm_yday
tm_year
valid
**
*
/
5**3
5*3
5/3
a%b
+
==
!=
<
<=
>
>=
&
^
|
&&
||
a+b
a-b
a==b
a!=b
a<b
a<=b
a>b
a>=b
a&b
a^b
a|b
a&&b
a||b
( )
( )
*
*
*
*
*
+
~
!
!
$
-a
+a
~a
!a
a!
$3
* ones complement
*
*
9
Gnuplot ( )
?:
a?b:c
, C. , ( ). ,
9
20
.
.
, f (x),
(
sin(x) 1 6 x 6 2
f (x) = 1
(1)
2 < x 6 3
x
:
gnuplot> f(x) = 1<=x && x<=2 ? sin(x) : 2<= x && 3 ? 1/x : 1/0
gnuplot> plot f(x)
. x < 1 x > 3
, .
. .
gnuplot> f1(x) = 1<=x && x<=2 ? sin(x) : 1/0
gnuplot> f2(x) = 2<x && x<=3 ? 1/x : 1/0
gnuplot> plot f1(x) lt 1, f2(x) lt 1
.
21