Credits | Overview | Plotting Styles | Commands | Terminals
--- | --- | --- | --- | ---

## Functions

Arguments to math functions in gnuplot can be integer, real, or complex unless otherwise noted. Functions that accept or return angles (e.g. sin(x)) treat angle values as radians, but this may be changed to degrees using the command set angles.

Math library and built-in functions
Function | Arguments | Returns
--- | --- | ---
abs(x) | int or real | |x|, absolute value of x; same type
abs(x) | complex | length of x, √( Re(x)2 + Im(x)2 )
acos(x) | any | cos-1 x (inverse cosine)
acosh(x) | any | cosh-1 x (inverse hyperbolic cosine)
airy(x) | real | Airy function Ai(x) for real x
arg(x) | complex | the phase of x
asin(x) | any | sin-1 x (inverse sin)
asinh(x) | any | sinh-1 x (inverse hyperbolic sin)
atan(x) | any | tan-1 x (inverse tangent)
atan2(y,x) | int or real | tan-1(y/x) (inverse tangent)
atanh(x) | any | tanh-1 x (inverse hyperbolic tangent)
besj0(x) | real | J0 Bessel function of x in radians
besj1(x) | real | J1 Bessel function of x in radians
besjn(n,x) | int,real | Jn Bessel function of x in radians
besy0(x) | real | Y0 Bessel function of x in radians
besy1(x) | real | Y1 Bessel function of x in radians
besyn(n,x) | int,real | Yn Bessel function of x in radians
besi0(x) | real | Modified Bessel function of order 0, x in radians
besi1(x) | real | Modified Bessel function of order 1, x in radians
besin(n,x) | int,real | Modified Bessel function of order n, x in radians
cbrt(x) | real | cube root of x, domain and range both real
ceil(x) | any | ⌈x⌉, smallest integer not less than x (real part)
conj(x) | complex | complex conjugate of x
cos(x) | radians | cos x, cosine of x
cosh(x) | any | cosh x, hyperbolic cosine of x in radians
EllipticK(k) | real k in (-1:1) | K(k) complete elliptic integral of the first kind
EllipticE(k) | real k in [-1:1] | E(k) complete elliptic integral of the second kind
EllipticPi(n,k) | real n<1, real k in (-1:1) | Π(n,k) complete elliptic integral of the third kind
erf(x) | any | erf(Re(x)), error function of real(x)
erfc(x) | any | erfc(Re(x)), 1.0 - error function of real(x)
exp(x) | any | ex, exponential function of x
expint(n,x) | any | En(x), exponential integral function of x
floor(x) | any | ⌊x⌋, largest integer not greater than x (real part)
gamma(x) | any | Γ(Re(x)), gamma function of real(x)
ibeta(p,q,x) | any | ibeta(Re(p,q,x)), ibeta function of real(p,q,x)
inverf(x) | any | inverse error function real(x)
igamma(a,z) | complex | igamma(a>0,z), igamma function of complex a>0,z
imag(x) | complex | Im(x), imaginary part of x as a real number
int(x) | real | integer part of x, truncated toward zero
invibeta(a,b,p) | 0<p<1 | inverse incomplete beta function
invigamma(a,p) | 0<p<1 | inverse incomplete gamma function
invnorm(x) | any | inverse normal distribution function real(x)
LambertW(z,k) | complex, int | kth branch of complex Lambert W function
lambertw(x) | real | principal branch (k=0) of Lambert W function
lgamma(x) | real | lgamma(Re(x)), lgamma function of real(x)
lnGamma(x) | complex | lnGamma(x) valid over entire complex plane
log(x) | any | ln x, natural logarithm (base e) of x
log10(x) | any | log10 x, logarithm (base 10) of x
norm(x) | any | norm(x), normal distribution function of real(x)
rand(x) | int | pseudo random number in the interval (0:1)
real(x) | any | Re(x), real part of x
sgn(x) | any | 1 if x > 0, -1 if x < 0, 0 if x = 0. ℑ(x) ignored
Sign(x) | complex | 0 if x = 0, otherwise x/|x|
sin(x) | any | sin x, sine of x
sinh(x) | any | sinh x, hyperbolic sine of x in radians
sqrt(x) | any | √x, square root of x
SynchrotronF(x) | real | Synchtrotron function F
tan(x) | any | tan x, tangent of x
tanh(x) | any | tanh x, hyperbolic tangent of x in radians
uigamma(a,x) | real | uigamma(a,x), upper incomplete gamma function a>0,x
voigt(x,y) | real | convolution of Gaussian and Lorentzian
zeta(s) | any | Riemann zeta function

Special functions from libcerf (only if available)
Function | Arguments | Returns
--- | --- | ---
cerf(z) | complex | complex error function
cdawson(z) | complex | complex Dawson's integral
faddeeva(z) | complex | rescaled complex error function w(z) = exp(-z²) × erfc(-iz)
erfi(x) | real | imaginary error function erfi(x) = -i × erf(ix)
FresnelC(x) | real | cosine (real) component of Fresnel integral
FresnelS(x) | real | sine (imaginary) component of Fresnel integral
VP(x,sigma,gamma) | real | Voigt profile
VP_fwhm(sigma,gamma) | real | Voigt profile full width at half max

String functions
Function | Arguments | Returns
--- | --- | ---
gprintf("format",x,...) | any | string result from applying gnuplot's format parser
sprintf("format",x,...) | multiple | string result from C-language sprintf
strlen("string") | string | number of characters in string
strstrt("string","key") | strings | int index of first character of substring "key"
substr("string",beg,end) | multiple | string "string"[beg:end]
split("string","separator") | string | array containing individual fields of original string
join(array,"separator") | array,string | concatenates array elements into a string
strftime("timeformat",t) | any | string result from applying gnuplot's time parser
strptime("timeformat",s) | string | seconds since year 1970 as given in string s
system("command") | string | string containing output stream of shell command
trim(" string ") | string | string without leading or trailing whitespace
word("string",n) | string, int | returns the nth word in "string"
words("string") | string | returns the number of words in "string"

time functions
Function | Arguments | Returns
--- | --- | ---
time(x) | any | the current system time
timecolumn(N,format) | int, string | formatted time data from column N of input data
tm_hour(t) | time in sec | the hour
tm_mday(t) | time in sec | the day of the month
tm_min(t) | time in sec | the minute
tm_mon(t) | time in sec | the month
tm_sec(t) | time in sec | the second
tm_wday(t) | time in sec | the day of the week
tm_week(t) | time in sec | ISO 8601 week of year
tm_yday(t) | time in sec | the day of the year
tm_year(t) | time in sec | the year
weekdate_iso(year,week,day) | int | time eqv to ISO 8601 standard week date
weekdate_cdc(year,week,day) | int | time eqv to CDC epidemiological week date

other gnuplot functions
Function | Arguments | Returns
--- | --- | ---
column(x) | int or string | contents of column x during data input.
columnhead(x) | int | string containing first entry of column x in datafile.
exists("X") | string | returns 1 if a variable named X is defined, 0 otherwise.
hsv2rgb(h,s,v) | h,s,v in [0:1] | converts HSV color to 24bit RGB color.
index(A,x) | array, any | returns i such that A[i] equals x
palette(z) | real | 24bit RGB palette color mapped to z
rgbcolor("name") | string | 32bit ARGB color from name
stringcolumn(x) | int | content column x as a string.
valid(x) | int | test validity of column x during datafile input
value("name") | string | returns the current value of the named variable.

Subtopics

- abs
- acos
- acosh
- airy
- arg
- asin
- asinh
- atan
- atan2
- atanh
- besj0
- besj1
- besjn
- besy0
- besy1
- besyn
- besi0
- besi1
- besin
- cbrt
- conj
- cos
- cosh
- EllipticK
- EllipticE
- EllipticPi
- erf
- erfc
- exp
- gamma
- inverf
- imag

- invnorm
- lambertw
- lgamma
- lngamma
- log
- log10
- norm
- rand
- real
- sgn
- Sign
- sin
- sinh
- sqrt
- tan
- tanh
- voigt
- cerf
- cdawson
- faddeeva
- erfi
- Voigt Profile
- gprintf
- sprintf
- strlen
- strstrt
- substr
- split
- join
- strftime
- strptime
- system

- trim
- word
- words
- exists
- hsv2rgb
- palette
- rgbcolor
- voxel
- integer conversion functions (int floor ceil round)
- elliptic integrals
- Complex Airy functions
- Complex Bessel functions
- Expint
- Fresnel integrals FresnelC(x) and FresnelS(x)
- Gamma
- Igamma
- Invigamma
- Ibeta
- Invibeta
- LambertW
- lnGamma
- Random number generator
- Special functions with complex arguments
- Synchrotron function
- Time functions
- uigamma
- using specifier functions
- value
- Counting and extracting words
- zeta