Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何使用样式线为每个点添加值?_Linux_Gnuplot - Fatal编程技术网

Linux 如何使用样式线为每个点添加值?

Linux 如何使用样式线为每个点添加值?,linux,gnuplot,Linux,Gnuplot,我使用这个脚本Gnuplot: set title "df -m command test" set terminal png truecolor size 720,480 background rgb "#eff1f0" set output "/xxx/xxx/xxx/test.png" set grid set style line 1 \ linecolor rgb '#0060ad' \ linetype 1 linewidth 2 \ pointtype 7

我使用这个脚本Gnuplot:

set title "df -m command test"
set terminal png truecolor size 720,480 background rgb "#eff1f0"
set output "/xxx/xxx/xxx/test.png"
set grid
set style line 1 \
    linecolor rgb '#0060ad' \
    linetype 1 linewidth 2 \
    pointtype 7 pointsize 1.5
set offsets 0.5,0.5,0,0.5
set datafile separator ","
set ylabel " MB BLOCK "
set xlabel " Date "
set format y "%g"
plot "/xxxx/xxx/xxx/TEST.txt" using 2:xtic(1) with linespoints linestyle 1 title "MB used"

根据这些数据:

2019-08-28,384.00
2019-08-29,394.00
2019-08-30,354.00
2019-08-31,384.00
2019-09-01,484.00
2019-09-02,324.00
2019-09-03,384.00
要创建此图表,请执行以下操作:


你能告诉我如何在每个点上计算值吗?

这个怎么样?同时检查
帮助标签

代码:

### plot with values as labels at datapoints
reset session

$Data <<EOD
2019-08-28,384.00
2019-08-29,394.00
2019-08-30,354.00
2019-08-31,384.00
2019-09-01,484.00
2019-09-02,324.00
2019-09-03,384.00
EOD

set datafile separator ","
set offsets 0.5,0.5,20,20

myLabel(n) = sprintf("%g",n)
plot $Data u 2:xtic(1) w lp pt 7 lc rgb "blue" title "MB used", \
     $Data u 0:2:(myLabel($2)) w labels offset 0,1.5 notitle
### end of code
###在数据点以值作为标签进行打印
重置会话

$Data下面的答案似乎解决了您的问题,因为您已经在使用它来回答下一个问题。那么,请将答案标记为可接受且已解决。这就是如此运作的方式。