On Fri, 2014-10-10 at 12:54 +0200, Riccardo (Jack) Lucchetti wrote:
On Fri, 10 Oct 2014, Giuseppe Vittucci wrote:
> Instead, I do not like too much the idea of the plot environment cause
> it seems half in between the full control given by the foreign block and
> the clean and simple control for ready-to-use plots given by the gnuplot
> command.
Well, I kind of changed my mind on this. We still have a large user base
who would like to adjust graphs by using the GUI widget, which I use quite
often myself. It's absolutely impossible to have this possibility with
graphs generated by arbitrary gnuplot syntax. So, you have to accept a few
constraints; but, given this, why not work directly with a sublanguage
that is closer to hansl and easier to grasp than gnuplot (and, BTW, could
use other backends if needed, like Sven said)?
Ok, I see the point.
And besides, like I said in my previous message: if you really want
to use
gnuplot to its full potential, create a tempfile, have gnuplot read it and
produce output. A simple proof-of-concept follows:
<hansl>
function string cool_gnuplot_pic(scalar angle, scalar resolution)
string fname = sprintf("(a)dotdir/%d.gp", floor(randgen1(u,1000,9999)))
outfile @fname --write
printf "set border 4095 front linetype -1 linewidth 1.000\n"
printf "set view %d, 10, 1, 1\n", angle
printf "set samples %d, %d\n", resolution, resolution
printf "set isosamples %d, %d\n", resolution, resolution
printf "unset surface\n"
printf "set title \"Cool, no?\" \n"
printf "set pm3d implicit at s\n"
printf "set pm3d scansbackward\n"
printf "splot sin(sqrt(x**2+y**2))/sqrt(x**2+y**2)\n"
outfile --close
return fname
end function
pic_1 = cool_gnuplot_pic(125, 200)
pic_2 = cool_gnuplot_pic(100, 400)
gnuplot --input=@pic_1 --output=display
gnuplot --input=@pic_2 --output=display
</hansl>
That's a very nice example on the possible interactions between gretl
and gnuplot.
Something I couldn't have figured out by myself starting from scratch...
In fact, this proves that what is really needed is probably just to
improve the guide to show users how they can interact with gnuplot using
hansl.
You should include in the gnuplot section of the hansl guide examples
like this that cover a bunch of common needs, so gretl users can start
getting familiar with the code and build on it according to their own
needs.
Giuseppe