|
From: Geoff K. <ge...@ka...> - 2026-09-23 22:03:18
|
Thank you! I added 'w linesp' to the splot command. I found that in my
case 'nocontours' was not needed. The main missing setting was
'nonuniform matrix'.
So Ethan, thank you very much for the help.
Geoff
On 23/09/2026 21:44, Ethan Merritt wrote:
> You were close. The 'missing' corner of the input matrix data is
> ignored but must be present (i.e. non-blank).
>
> Here is an example showing both the data format and the addition of
> contour lines on the surface. For clarity I draw the surface and the
> contours in separate clauses of the splot command. This also allows me
> to specify thicker lines for the contours.
>
> On Wed, Sep 23, 2026 at 11:48 AM Geoff Kaniuk <ge...@ka...
> <mailto:ge...@ka...>> wrote:
>
> Yes, today the plane was in the right position with no change in code.
>
> Regarding the matrix format, I have seen examples in "Gnuplot in
> Action"
> and web searches, which I copied. I have now added the Y coordinate row
> and X coordinate column - but this still left an empty surface.
>
> In my example, x and y start at the same value, so I was able to set
> M00
> to -19.0. But there seems to be an issue if the ranges have different
> start points: eg y in [1.0,4.0], x in [0.2,0.6]
> ?? 1.0 2.0 3.0 4.0
> 0.2 a b c d
> 0.4 b c d a
> 0.6 c d a b
>
> What value would ?? be? I tried omotting it and then get the 'data is
> not a matrix message'
>
> I was hoping to find a show command which tells me what gnuplot decides
> its zrange is, but show zrange says numeric.
>
> Why should Gnuplot think I want to do anything other than plot the
> surface showing coordinate lines?
> I noticed in my code that I had omiited 'set surface'. I have now
> added
> that to no effect.
>
> Is there anything I should be setting to display the surface?
>
> You, of course, are right that I do actually want to see the contour
> map. That is how I started with all the settings that are needed for
> that. When I got nowhere, I decided to simplify and just plot the
> surface, then the cotour could follow.
>
> In the meantime I really do want to get this surface map working.
>
> There must be some basic setting I am missing?
>
> Geoff
>
> On 23/09/2026 04:40, Ethan Merritt wrote:
> > 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...
> <mailto:ge...@ka...>
> > <mailto:ge...@ka... <mailto: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 <http://plot-xy-surface.gp> <http://plot-
> xy-surface.gp <http://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 <http://plot-xy-surface.gp>
> <http://plot-xy-surface.gp <http://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... <mailto:gnuplot-
> in...@li...> <mailto:gnuplot- <mailto:gnuplot->
> > in...@li... <mailto:in...@li...>>
> > Membership management via: https://lists.sourceforge.net/
> lists/ <https://lists.sourceforge.net/lists/>
> > listinfo/gnuplot-info <https://lists.sourceforge.net/lists/
> listinfo/ <https://lists.sourceforge.net/lists/listinfo/>
> > gnuplot-info>
> >
>
|