====== Gnuplot: Frequently Asked Questions ====== * http://stackoverflow.com/questions/tagged/gnuplot -- Newest 'gnuplot' Questions - Stack Overflow * http://lowrank.net/gnuplot/index-e.html -- Not so Frequently Asked Questions. ===== Inofficial Gnuplot FAQ ===== This is an inofficial gnuplot FAQ (yes, its my personal one). * [[https://stackoverflow.com/questions/19412382/gnuplot-line-types|Gnuplot line types]] [(https://web.archive.org/web/20210401201439/https://stackoverflow.com/questions/19412382/gnuplot-line-types)] * [[https://stackoverflow.com/questions/67232200/consistent-fonts-in-gnuplot|Consistent fonts in gnuplot?]] [(https://web.archive.org/web/20210517094855/https://stackoverflow.com/questions/67232200/consistent-fonts-in-gnuplot)] * [[http://stackoverflow.com/questions/12224567/mutiple-fit-lines-on-same-plot-in-gnuplot|Mutiple fit lines on same plot in gnuplot?]] [(https://web.archive.org/web/20170327005502/https://stackoverflow.com/questions/12224567/mutiple-fit-lines-on-same-plot-in-gnuplot)] * [[http://stackoverflow.com/questions/23586904/fitting-a-function-with-multiple-data-sets-using-gnuplot|How to fit a function with multiple data sets using gnuplot]] * [[#How can I make a gnuplot script an executable file?]] * [[#How do I change the datafield separator?]] * [[#How do I change decimal separator?]] * [[#How do I export a plot as list of ASCII-data samples?]] * [[#How to change plot device/output media?]] * [[#How do I change output format of numbers?]] * [[#Where can I find the official gnuplot FAQ?]] * [[https://wiki.geany.org/config/gnuplot|How to add Gnuplot color syntax support to Geany editor?]] * [[#How do I change background color of screen and/or graph?]] * [[#How to change linestyle (e.g. line width) for a set of lines?]] * [[#How to set line colors to MATLAB default colors?]] * [[#How can I add a watermark?]] * [[#How to plot multiple y-axes?]] * [[#Is there an overview about the predefined gnuplot colors?]] ~~REFNOTES~~ ---- === Where can I find the official gnuplot FAQ? === Look [[http://www.gnuplot.info/faq/faq.html|here]]. -- Note that there are also some [[http://t16web.lanl.gov/Kawano/gnuplot/index-e.html|not so Frequently Asked Questions]]. === How can I make a gnuplot script an executable file? === Add the shebang to the first line of your script [(http://www.cyberciti.biz/tips/finding-bash-perl-python-portably-using-env.html)] #!/usr/bin/env gnuplot plot sin(x) with lines ~~REFNOTES~~ === How do I change the datafield separator? === E.g. to read in csv (comma-separated value) files written by spreadsheet programs. set datafile separator "," === How do I change decimal separator? === set decimalsign ',' # set separator to ',' #set decimalsign locale # get separator from system locale settings #set decimalsign locale "en_GB.utf8" # set separator to '.' by overriding system locale #set decimalsign locale "de_DE.utf8" # set separator to ',' by overriding system locale === How do I export a plot as list of ASCII-data samples? === set table #set terminal table # some releases of gnuplot need the keyword 'terminal' set output "temp(u).dat" set samples 1024 plot [0:1023] f(x*4.8/1024) === How to change plot device/output media? === set terminal emf # Windows Enhanced Meta File set output "filename.emf" replot # plot again but utilize the new terminal set term pop # return to primary terminal === How do I change output format of numbers? === set format "%.1f" # output float numbers with one digit after decimal separator Note that format can be limited to axes, e.g. set format y "%.1f" === How do I change background color of screen and/or graph? === # define screen background color set object rectangle from screen 0,0 to screen 1,1 fillstyle border fillcolor '#deebf7' behind # define graph background color set object rectangle from graph 0,0 to graph 1,1 fillstyle border fillcolor 'white' behind === How to change linestyle (e.g. line width) for a set of lines? === set for [i=1:8] style line i linewidth 3 === How to set line colors to MATLAB default colors? === :Y_FIXME: # New default Matlab line colors, introduced together with parula (2014b) set style line 1 lc rgb '#0072bd' # blue set style line 2 lc rgb '#d95319' # orange set style line 3 lc rgb '#edb120' # yellow set style line 4 lc rgb '#7e2f8e' # purple set style line 5 lc rgb '#77ac30' # green set style line 6 lc rgb '#4dbeee' # light-blue set style line 7 lc rgb '#a2142f' # red === How can I add a watermark? === # Urheberkennzeichnung watermark = "`whoami`".'\@'."`hostname`, `date`" set label watermark at screen 0.01,0.02 font ',6' tc rgb 'gray' #set bmargin 3.75 === How to plot multiple y-axes? === * https://stackoverflow.com/questions/27390317/how-to-plot-multiple-y-axes [(https://web.archive.org/web/20230414210334/https://stackoverflow.com/questions/27390317/how-to-plot-multiple-y-axes)] * https://stackoverflow.com/questions/72197168/how-to-plot-several-y-axis-in-the-left-side-using-gnuplot [(https://web.archive.org/web/20230510055740/https://stackoverflow.com/questions/72197168/how-to-plot-several-y-axis-in-the-left-side-using-gnuplot)] ~~REFNOTES~~ === Is there an overview about the predefined gnuplot colors? === * https://stackoverflow.com/questions/54658674/gnuplot-apply-colornames-from-datafile [(https://web.archive.org/web/20220122005618/https://stackoverflow.com/questions/54658674/gnuplot-apply-colornames-from-datafile)] ~~REFNOTES~~