読者です 読者をやめる 読者になる 読者になる

風来坊@真幸福知

出雲市 福知寺 行事ご案内 坐禅会 日記 テクノロジー English Zazen session Korean 한국어 참선 뮥조선

Gnuplot: a patch to enable "pointnumber" function

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

 

or,

 

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.

=> Gnuplot "pointnumber" patch [DOWNLOAD] (patch, Linux (*.deb) and Windows binaries are available)

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!)

f:id:cheonghongsa:20170130150816p:plain

adding an image to make this page look a bit better :-)