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.


11#11


12#12

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
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"

other gnuplot functions
Function Arguments Returns
column(x) int or string column 13#13 during datafile input
columnhead(x) int string containing first entry of column 13#13 in datafile.
exists("X") string returns 1 if a variable named X is defined, 0 otherwise.
hsv2rgb(h,s,v) h,s,v 14#14 [0:1] 24bit RGB color value.
palette(z) double RGB palette color mapped to z.
stringcolumn(x) int or string content of column 13#13 as a string.
timecolumn(N,"timeformat") int, string time data from column 15#15 during data input.
tm_hour(t) time in sec the hour (0..23)
tm_mday(t) time in sec the day of the month (1..31)
tm_min(t) time in sec the minute (0..59)
tm_mon(t) time in sec the month (0..11)
tm_sec(t) time in sec the second (0..59)
tm_wday(t) time in sec the day of the week (Sun..Sat) as (0..6)
tm_week(t) time in sec week of year in ISO8601 "week date" system (1..53)
tm_yday(t) time in sec the day of the year (0..365)
tm_year(t) time in sec the year
time(x) any the current system time in seconds
valid(x) int test validity of 16#16 during datafile input
value("name") string returns the value of the named variable.
voxel(x,y,z) real value of the active grid voxel containing point (x,y,z)


Subsections