Matthew
Matthew

Reputation: 7590

Extra border projection lines in gnuplot surface plot

While trying out things to try to answer this question, I realized that there must be a border option besides set border that I am unaware of.

Suppose that we run the following commands

set border 15
splot sin(x)

The border should draw all of the border lines on the base and no others. However, this produces the following:

enter image description here

Here we have extra lines on the side that extend from the base to the bottom of the surface. Trying with border 1, which should only draw the bottom left front, we see the same.

enter image description here

These are eliminated with border 0

enter image description here

and with border 255, which draws the base and all four sides, we see that the these extra lines were not as long as the actual side lines which extend beyond the surface edge.

enter image description here

The extra lines extend only to the surface, whereas the border lines go all the way. This seems to happen only with surfaces (and with the linked question for some reason), as plotting the following data

1 2 3
3 4 5
6 7 8
9 0 1
2 3 4
5 6 7
8 9 0

with

set border 15
splot datafile w lines

produces the following

enter image description here

where these extra lines do not occur.

This leads me to suspect that there is another option controlling these extra lines, but I am unaware of what it is. What option controls these, and how can it be turned off? Turning off the border altogether gets arid of it, but this isn't desirable.

Looking at this question as well, it seems to me that it occurs anytime gnuplot interpolates a surface from data, but I'd be surprised if it couldn't be turned off in some way.

Edit: one answer linked to this question. The question isn't a duplicate as it deals with datafiles and I am working with a surface function, but it was helpful for finding one possible solution, which I have written up as an answer.

I am still holding out hope that there is a less round about solution.

Upvotes: 2

Views: 710

Answers (2)

Matthew
Matthew

Reputation: 7590

I have one possible solution, but I don't really like it.

We can use the function to generate a data file or data block and then plot it. The question that Sébastien Guarnay linked to in his answer is helpful on determining how to do this.

In gnuplot 5, the following commands can more or less achieve this

set table $k
splot sin(x)
unset table
set border 15
set xrange[-10.1:10.1]
set yrange[-10.1:10.1]
splot $k with lines

Here we use the table output to capture the points to be plotted, and then plot them like a datafile expanding the x and y ranges slightly (this is what ultimately removes those lines) based on the linked questions answer.

This produces

enter image description here

It seems a little roundabout, but does seem to achieve what I want.

Upvotes: 0

Sébastien Guarnay
Sébastien Guarnay

Reputation: 126

It seems to be a duplicate of this question: Remove z axis in gnuplot, which suggests to add a negligible offset to remove theses extra axes.

Upvotes: 1

Related Questions