欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

plot vertical line with gnuplot

程序员文章站 2022-03-29 18:40:25
...

  The vertical line can be plotted with gnuplot with vector.
plotvector.sh

#! /bin/sh  
file_in=data.txt 
gnuplot<<!
set xlabel "n" 
set ylabel "time/s"
set xrange [0:5]
set yrange [0:10]
set label 1 "arrowstyle 1:" at -520, -100, 0 right norotate back nopoint
set label 2 "arrowstyle 2:" at -520, -110, 0 right norotate back nopoint
set label 3 "arrowstyle 3:" at -520, -120, 0 right norotate back nopoint
set label 4 "arrowstyle 4:" at -520, -130, 0 right norotate back nopoint
set label 5 "arrowstyle 5:" at -520, -140, 0 right norotate back nopoint
set label 6 "arrowstyle 6:" at -520, -150, 0 right norotate back nopoint
set label 7 "arrowstyle 7:" at -520, -160, 0 right norotate back nopoint
set label 8 "arrowstyle 8:" at -520, -170, 0 right norotate back nopoint
set arrow 1 from -500, -100, 0 to 500, -100, 0  back filled linetype 1 linewidth 2.000 size screen 0.025,30.000,45.000
set arrow 2 from -500, -110, 0 to 500, -110, 0  back nofilled linetype 3 linewidth 2.000 size screen 0.030,15.000,90.000
set arrow 3 from -500, -120, 0 to 500, -120, 0  back filled linetype 1 linewidth 2.000 size screen 0.030,15.000,45.000
set arrow 4 from -500, -130, 0 to 500, -130, 0  back filled linetype 3 linewidth 2.000 size screen 0.030,15.000,90.000
set arrow 5 from -500, -140, 0 to 500, -140, 0  back filled linetype 1 linewidth 2.000 size screen 0.030,15.000,135.000
set arrow 6 from -500, -150, 0 to 500, -150, 0  back empty linetype 3 linewidth 2.000 size screen 0.030,15.000,135.000
set arrow 7 from -500, -160, 0 to 500, -160, 0  nohead back nofilled linetype 1 linewidth 2.000
set arrow 8 from -500, -170, 0 to 500, -170, 0  back nofilled linetype 3 linewidth 2.000 size screen 0.008,90.000,90.000
set style line 1 linetype 1 linewidth 2.000 pointtype 1 pointsize 1.000
set style line 2 linetype 3 linewidth 2.000 pointtype 2 pointsize 1.000
set style arrow 1  back filled linetype 1 linewidth 2.000 size screen 0.025,30.000,45.000
set style arrow 2  back nofilled linetype 3 linewidth 2.000 size screen 0.030,15.000,90.000
set style arrow 3  back filled linetype 1 linewidth 2.000 size screen 0.030,15.000,45.000
set style arrow 4  back filled linetype 3 linewidth 2.000 size screen 0.030,15.000,90.000
set style arrow 5  back filled linetype 1 linewidth 2.000 size screen 0.030,15.000,135.000
set style arrow 6  back empty linetype 3 linewidth 2.000 size screen 0.030,15.000,135.000
set style arrow 7  nohead back nofilled linetype 1 linewidth 2.000
set style arrow 8  back nofilled linetype 3 linewidth 2.000 size screen 0.008,90.000,90.000
set term "pdf"
set output "test.pdf"
plot "${file_in}" u 1:2:3:4 title "rtt1" with vectors arrowstyle 7
set output
exit
!

 u 1:2:3:4 means x,y,x+Δx,y+Δy.
 the data.txt I use in plot

1   2   0   1
1   5   0   1
2   3   1   2

 Of course, the arrow style cam be configured: plot “${file_in}” u 1:2:3:4 title “rtt1” with vectors arrowstyle 7.Result:
plot vertical line with gnuplot
  The array style of 5:plot “${file_in}” u 1:2:3:4 title “rtt1” with vectors arrowstyle 5. Results:
plot vertical line with gnuplot
Reference
[1]gnuplot demo script