|
Two ways:
1. Plot the function first and let gnuplot to tell the minimum x value:
plot "inline.dat" using 1:2 with impulses linewidth 2x
minx = GPVAL_DATA_X_MIN
minY = GPVAL_DATA_Y_MIN
maxx = GPVAL_DATA_X_MAX
maxY = GPVAL_DATA_Y_MAX
plot "inline.dat" using ($1-xmin):2 with impulses linew
2. Use external script to figure out what is the minimum x value:
set macro (*This command is necessary)
data = './inline.dat'
xmin = `sort -nk 1 data | head -n 1 | awk '{print $1}'`
(or get the the value in the first column second row:)
x12 = `cat @data | head -n 2 | tail -n 1 | awk '{print $1}'`
plot "inline.dat" using ($1-xmin):2 with impulses linewidth 2
Note: the second method can not work in gnuplot in windows. It works only under pgnuplot, which works with cygwin terminal.
refenrence: http://stackoverflow.com/questions/7540614/reading-dataset-value-into-a-gnuplot-variable-start-of-x-series
http://stackoverflow.com/questions/18616063/passing-gnuplot-variables-to-a-shell-expression
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-9-24 07:48
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社