How do I specify the working directory for gnuplot in interactive mode? If I want to call a script with "call 'label_loop.gnu'" and do not want to put the script file in the gnuplot installation folder, do I need to specify the full path each time? I think the following would be the case with normal usage. "I put the data or script I want to load in any directory"-> "I plot it in interactive mode"-> "I want to adjust the position of the label (preferably) with the mouse action"- > "I copy and paste the previous commands and I create a batch file"-> "GnuPlot converts the output to PDF"

1 Answer 1


If I understand you clearly, look for GNUPLOT_LIB in man gnuplot:


Additional search directories for data and command files. The variable may contain a single directory name, or a list of directories separated by ':'. The contents of GNUPLOT_LIB are appended to the "loadpath" variable, but not saved with the "save" and "save set" commands.

So, just call gnuplot with the environment variable you want:

GNUPLOT_LIB=my/chosen/path gnuplot

For example, this plots a curve for the points (0,0), (1,1) and (2,3):

$ cat Test/data.dat
0 0
1 1
2 3
$ GNUPLOT_LIB=Test gnuplot 
gnuplot> plot 'data.dat' with lines

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.