Reputation: 29556
I am new to gnuplot, I need to plot my data and display a small circle or an arrow at each end of the line chart. how can I do that? I use this command to display the line chart:
plot 'data.txt' with lines
Upvotes: 1
Views: 595
Reputation: 15920
I don't know if there is a way to make lines have something at the end automatically, but I found a workaround. With this data file:
1 1
2 3
3 2
and the following script:
set term png
set out 'plot.png'
stats 'data.dat' name 'a'
# plot line, then circle only if it is the last data point
plot 'data.dat' t 'data', \
'' u ($0==(a_records-1)?$1:1/0):2 with points pt 7 ps 2 t 'end'
I can make a plot like this:
The stats
command is to find the number of data points, then the dual plot command draws the line connecting the data points, then a circle only on the last data point (determined with the a_records
variable. An arrow would be trickier to draw...
To find more info about different point/line style options, the test
command at the gnuplot command line is your friend.
Upvotes: 1