Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot: Plot file with linespoints but with fewer points

Tags:

plot

gnuplot

I want to plot a file with linespoints in Gnuplot but the line using all the data samples and the points using fewer data samples. For example the following file plots the data but the line is not visible at all.

set terminal png
set out "plot_sample.png"
plot [t=-1000:1000] t w linespoints pt 64 lt 10 ps 1.5

How to do it if I want to define a custom sampling interval for the points but use all the data samples for the line? I could do two separate plots in the same figure but then the key will show both of them separately.

like image 433
asm_nerd1 Avatar asked Dec 19 '22 17:12

asm_nerd1


2 Answers

Use pointinterval to reduce the number of plotted points, but keep all points for drawing the line:

set samples 100
plot x**2 w linespoints pointinterval 10
like image 187
Christoph Avatar answered Mar 04 '23 02:03

Christoph


  • Use every to reduce the samples taken from file!
  • Plot the line and the points in two part, and use notitle at one of them!
  • Don't forget to 'synchronize' the color of the 2 plots!

Something like:

plot [t=-1000:1000] 'data.dat' w l lt 10 lc 10 t 'something', '' every 10 w p pt 64 ps 1.5 lc 10 notitle

NOTES

Usage of every: plot 'alma.dat' every A:B:C:D:E:F

where

  • A is the data increment (every Ath)
  • B is the datablock increment (datablocks are separated by empty lines)
  • C/D is the first data/datablock (start from C/D)
  • E/F is the last data/datablock (end at E/F)

You can use all the features described above, but if you don't need, just leave it empty, eg. ...every 2 or every 2::1 or every 2::1:0 ect...

like image 34
Tom Solid Avatar answered Mar 04 '23 02:03

Tom Solid