dkogan / feedgnuplot

Tool to plot realtime and stored data from the commandline, using gnuplot.
Other
710 stars 37 forks source link

How to embed y-values above the plot points? #47

Closed pvonmoradi closed 2 years ago

pvonmoradi commented 2 years ago

1- Is it possible to also show y-values on the graph itself similar to this? image

2- Is it possible to only print the last data point somewhere on the graph?

Thanks for your awesome tool.

dkogan commented 2 years ago

Hi. Each plot component should be passed-in and interepreted as a separate dataset. For instance, let's say you have a data file:

1 1
2 4
3 9
4 16
5 25

To plot these as only xy data with lines and points:

< /tmp/dat feedgnuplot --domain --lines --points

To plot these as labels only:

< /tmp/dat awk '{print $1,$2,$2}' | feedgnuplot --domain --with labels --tuplesizeall 3

To plot just the last point as a cicle:

wc -l /tmp/dat | awk '{print $1}' | read N; < /tmp/dat awk 'NR=='$N' {print $1,$2}' | feedgnuplot --domain --with 'points pt 7 ps 2'

To do all this at the same time:

wc -l /tmp/dat | awk '{print $1}' | read N; < /tmp/dat awk '{print $1,"lp",$2} {print $1,"text",$2+1,$2} NR=='$N' {print $1,"last",$2}' | feedgnuplot --dataid --domain --style lp 'with linespoints' --style text 'with labels' --style last 'with points pt 7 ps 2' --tuplesize text 3
pvonmoradi commented 2 years ago

Thanks!

(had to substitute N with literal 5 possibly due to some quoting issues)

dkogan commented 2 years ago

Sure. Or tail -n1 or something. I'm going to close this issue. Re-open if something isn't clear.