command-line/ set/ gnuplot/ default-value/ xrange

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 gnuplot -e "xrange='["1/1/19 12:00":"1/5/19 11:59"]'" tlakD.gnuplot; vlhkosD.gnuplot; teplotaD.gnuplo and many more gnuplots scripts 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

I suggest to put the range command in a separate file and invoke both the range file and the plot file in the command. You could even have a collection of range files and choose the one you want at the time of plotting.

 gnuplot setrange_1.gp tlakD.gp

It is not necessary to use the -e construct here. gnuplot will execute each file listed on the command line in the order given, as if they had been concatenated into a single larger file prior to execution.

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]

I created a data.txt file like this:

"2/1/2019 10:00:00" 4
"3/1/2019 10:00:00" 8
"4/1/2019 10:00:00" 16
"5/1/2019 10:00:00" 32

The commands I would run inside gnuplot would be:

set timefmt '"%d/%m/%Y %H:%M:%S"'
set xdata time
set xrange ['"1/1/2019 12:00"':'"1/5/2019 11:59"']
plot "data.txt" using 1:2

So, that means my bash command line would be:

gnuplot -p \
        -e "set timefmt '\"%d/%m/%Y %H:%M:%S\"'"                    \
        -e "set xdata time"                                         \
        -e "set xrange ['\"1/1/2019 12:00\"':'\"5/1/2019 11:59\"']" \
        -e "plot \"data.txt\" using 1:2"

在此处输入图像描述

暂无
暂无

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question How to pass command line argument to gnuplot? gnuplot command-line options how to set command line for electron How to stop gnuplot window poping-up when using it from command line in windows? How to run the set of commands in windows command line How to set the classpath in Windows Command Line correctly How to set proxy from command line Windows 7 How to set Linux kernel command line on ARM? how to set comment to label using command line wireshark 2.2.5 - how to set ESP preference from command line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM