The world famous 2D/3D plotting software Gnuplot has a function that you can plot a data with a line and some of the points on the line (after version 4 or so).
plot "data.txt" using 1:2 w lp pi 20
This plots column 1 and 2 data for x and y axes with lines and points, while the points appear once in every 20 data points.
However, ususally you do not know total number of the data contained in a file and just want 20 points appearing on the line drawn from the left end to the right end of the plot.
For this purpose, I wrote a patch (many years ago :-) containing a function called "pointnumber" that specifies the total number of points appearing on a line.
This works like this:
plot "data.txt" using 1:2 with linespoints pointnumber 20
plot "data.txt" using 1:2 w lp pn 20
Then, the line is drawn using all the data points, while only 20 points appear along the line.
The patch is available for download at the following link.
Enjoy plotting :-)
- Correction: Nov. 19, 2016: "set pointnumber .." does not work. "pointnumber" option is applicable only in the "plot ..." command as same as the "pointinterval".
- Patched and compiled binaries (executables) are also available for Linux Mint (*.deb) and Windows (*.zip) at the download link above. The windows version is not an installer. Extract in any place and add the path of "gnuplot/bin" to the $PATH environmental variable, or put the link of wgnuplot.exe to the start menu.
- Correction of the patch: Jan. 28, 2017: now it does not use random number to fluctuate the offset of the first drawn point.
- Correction of the patch: Jan. 30, 2017: I changed the algorithm for the shifting of the starting offset of the points; now, it looks much better, while the number of points actually drawn can change by missing a point the the edge; it should be no problem; also, fixes were made for consistency in lines/points style handling. (Thanks to comments by Ethan!)
adding an image to make this page look a bit better :-)
Finally, this "pointnumber" function was added in the new version 5.2! Now, the first release candidate RC1 is available. (as of June 1, 2017)
Bug in 5.2 RC1: When your initialization file .gnuplot includes "set style ..." before definition of terminal (e.g. "set term unknown"), it dies with "Segmentation fault". If it happens, just add "set terminal unknown" at the beginning of .gnuplot.