## 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.

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]
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
word("string",n) | string, int | returns the nth word in "string"
words("string") | string | returns the number of words in "string"

other gnuplot functions
Function | Arguments | Returns
column(x) | int or string | column during datafile manipulation.
columnhead(x) | int | string containing first entry of column in datafile.
exists("X") | string | returns 1 if a variable named X is defined, 0 otherwise.
hsv2rgb(h,s,v) | h,s,v [0:1] | 24bit RGB color value.
stringcolumn(x) | int or string | content of column as a string.
timecolumn(N,"timeformat") | int, string | time data from column during data input.
tm_hour(x) | int | the hour
tm_mday(x) | int | the day of the month
tm_min(x) | int | the minute
tm_mon(x) | int | the month
tm_sec(x) | int | the second
tm_wday(x) | int | the day of the week
tm_yday(x) | int | the day of the year
tm_year(x) | int | the year
time(x) | any | the current system time
valid(x) | int | test validity of during datafile manip.
value("name") | string | returns the value of the named variable.

Subsections

- Elliptic integrals
- Random number generator
- Value
- Counting and extracting words