asm_nerd1
asm_nerd1

Reputation: 455

gnuplot: Plot file with linespoints but with fewer points

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.

Upvotes: 4

Views: 10441

Answers (2)

Christoph
Christoph

Reputation: 48390

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

Upvotes: 10

Tom Solid
Tom Solid

Reputation: 2344

  • 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...

Upvotes: 2

Related Questions