|
From: Ethan M. <eam...@gm...> - 2026-09-23 03:40:32
|
The easy part first.
The "set xyplane" command has two forms.
"set xyplane <foo>" interprets <foo> as some fraction of the current
z-range and places the plane at that fraction of the zrange (I never use
this and may have described it slightly wrong)
"set xyplane at <zval>" does exactly what it looks like - places the plane
at z=zval.
Now the matrix.
You have provided a matrix that contains only z values, no x or y.
The program plots it assuming x = column_number, y = row_number.
See "help matrix".
So your surface is drawn in the area bounded by x=[0:8] and y=[0:8]
I am assuming that you want to map it instead onto the x and y ranges you
have specified, but it is not clear to me (or to the program) how you want
to do that. Without additional information about the eventual use case
and data source, it's hard to given specific suggestions on how to proceed.
One option is to accept that the program will use xrange [0:8], as in your
example, but manually adjust the labels on the x axis:
set xtics ("-18.5" 0, "-13.5" 8)
And so on for the y axis labels. That puts the burden on you to sort out
what the labels should be, so it's probably not the best solution.
Another option is to reformat the data so that it is contains x and y
coordinates as well as z. There are at least two different formats
accepted by gnuplot that should work. See "help matrix uniform" "help
matrix nonuniform".
- Ethan
On Tue, Sep 22, 2026 at 4:08 PM Geoff Kaniuk <ge...@ka...> wrote:
> I am attempting to plot a surface from data in a file. The plot produced
> shows the correct X,Y, Z axes and key. But no surface and the base plane
> is not where I expect it to be.
>
> For simplicity I am testing with the data inline using:
> splot [X_min:X_max][Y_min:Y_max] '-' matrix
> 0.0046 -0.067 -0.1375 -0.2081 -0.2587 -0.3094 -0.3702 -0.4311 -0.495
> 0.097 0.026 -0.043 -0.1129 -0.1617 -0.2087 -0.2577 -0.3123 -0.3891
> 0.1774 0.0877 0.0226 -0.0425 -0.1011 -0.1598 -0.2069 -0.254 -0.3127
> 0.2578 0.1498 0.0882 0.0278 -0.0405 -0.1085 -0.1561 -0.1989 -0.2363
> 0.3034 0.2022 0.1448 0.0875 0.0233 -0.0408 -0.0947 -0.1486 -0.1892
> 0.3491 0.2587 0.2015 0.1438 0.0872 0.0285 -0.0333 -0.0951 -0.1421
> 0.4093 0.3214 0.256 0.1905 0.1377 0.085 0.0251 -0.0349 -0.0886
> 0.4695 0.3912 0.3104 0.2381 0.1883 0.1378 0.0834 0.0263 -0.0351
> 0.47660 0.4624 0.3798 0.2972 0.2372 0.1772 0.1293 0.0814 0.0225
>
> The preamble and splot call is contained in a gp script file like so:
> [plot-xy-surface.gp]
> #!/usr/bin/gnuplot -persist
> reset session
> set terminal wxt 1 persist enhanced
>
> X_min=-18.5; X_max=-13.5; Y_min=-18.5; Y_max=-13.5;
> Z_min=-0.6; Z_max=0.6
>
> unset xtics;
> set xrange [X_min:X_max]; set xtics X_min,0.5,X_max; set xlabel "X"
> unset ytics;
> set yrange [Y_min:Y_max]; set ytics Y_min,0.5,Y_max; set ylabel "Y"
> set zrange [Z_min:Z_max]; set ztics Z_min,0.1,Z_max; set zlabel "Z"
>
> unset key; set key outside
>
> set xyplane 0.0
> set grid; set cntrparam levels 13; set isosamples 100
> splot ....
>
> The terminal session is:
> gnuplot> call "plot-xy-surface.gp"
> gnuplot> show surface
> surface is drawn
>
> I have tried many variations, and have now drawn a blank! As mentioned
> above there is no surface, and the base plane is set at Z_min rather
> than 0.0 as requested!
>
> Is there any option that I should be turning on or indeed off?
>
> For reference:
> GNUPLOT: gnuplot 5.4 patchlevel 4
> OS: Debian 12 bookworm
> DESKTOP Mate 1.26.0
>
> I have no problem using splot with functions.
>
> Any input much appreciated.
>
> --
> Geoff
>
>
>
> _______________________________________________
> gnuplot-info mailing list
> gnu...@li...
> Membership management via:
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>
|