分水岭分享 http://blog.sciencenet.cn/u/ZhangJun8 人员疏散建模、行人流动力学

博文

Gnuplot 绘图中寻找最大最小坐标值

已有 6450 次阅读 2013-9-5 00:24 |系统分类:科研笔记

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







https://blog.sciencenet.cn/blog-251698-722403.html

上一篇:Pedestrian safety
收藏 IP: 134.94.171.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-5 02:52

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部