Search code examples
command-linesetgnuplotdefault-valuexrange

How to set xrange on command line in gnuplot


I have several gnuplot scripts that draw graphs for me. I need to set the same xrange values ​​on the command line for everyone gnuplot scripts. I don't want to open each one separately.

Code in gnuplot scripts(name:tlakD.gnuplot):

set xdata time 
set timefmt "%m/%d/%Y %H:%M" # specify time string format
set xrange datum
set format x "%d/%m/%Y "

Command line attempt: gnuplot -e "datum='["1/1/19 12:00":"1/5/19 11:59"]'" tlakD.gnuplot

Second attempt: I removed the xrange.

Code in gnuplot scripts(name:tlakD.gnuplot):

set xdata time 
set timefmt "%m/%d/%Y %H:%M" # specify time string format
set format x "%d/%m/%Y "

Command line attempt: gnuplot -e "xrange='["1/1/19 12:00":"1/5/19 11:59"]'" tlakD.gnuplot

An idea of ​​what I want: gnuplot -e "xrange='["1/1/19 12:00":"1/5/19 11:59"]'" tlakD.gnuplot ; vlhkosD.gnuplot; teplotaD.gnuplo and many more gnuplots scripts I want to run all scripts with the same xrange. Thanks


Solution

  • It doesn't seem you can specify a range [...:...] in one variable, but you can do so in 2 separate string variables:

    gnuplot  -e a='"1/1/19 12:00"' -e b='"1/5/19 11:59]"'
    
    set xrange [a:b]