splot always generates isolines for function plots, which can be undesireable e.g. for contour generation, where you just want to have a uniform grid. The setting
set sample 200; set isosample 200
generates every datapoint twice, which slows down plotting considerably.
gnuplot> set samp f,f; set isos f,f; t=time(.1); splot x**2+y**2 w p; pr time(.0)-t 1.39414000511169 gnuplot> set samp f,2; set isos 2,f; t=time(.1); splot x**2+y**2 w p; pr time(.0)-t 0.716070890426636
The second command above is nearly twice as fast, but a bit cumbersome to enter, and looks a bit stupid if you plot it "with lines"
I'd like to be able to give an option "none" to set isosamples
, which then just creates a grid (matrix) of evenly spaced datapoints, with sampling density as given by set sample
.
One additional observation: With set table
, splot only generates horizontal isolines. Bug or feature? If you actually just want an evenly spaced matrix, that of course solves the above problem.
I do not understand the samples/isosamples usage in the current code so I would hesitate to touch it myself. Any changes to "set sample" or "set isosample" have to reconcile two contradictory goals:
1) If there is a new variant of the commands that reduces both time and space used by 50% that clearly should become the new default
2) If there is a new variant that does not act as the program as done historically then for backwards compatibility the old behaviour should be the default
But maybe we could side-step this conflict by leaving the two existing commands alone. Instead we could introduce a new command, something on the order of
set gridsamples <N>
unset gridsamples
If gridsamples is unset, the current action of samples and isosamples is maintained.
After "set gridsamples N", both samples and isosamples are ignored and N is used instead.
It might turn out that some contexts should always ignore the new parameter (e.g. hidden3d?).
Backwards compatibility is maintained because no old script will use "set gridsample".
New scripts or one's preferences file ~/.gnuplot can include "set gridsample 100" and all scripts benefit from reduced overhead.