When using "splot with circles" to draw filled circles, I find it very helpful that enabling "set hidden3d" allows the circles to properly occlude elements behind them.
However, when "set hidden3d" is enabled, the color specified by the fillcolor
setting for "with circles" appears to be ignored. Without "set hidden3d", the circles are correctly filled with the specified color.
Is there something I might be missing here?
The following script reproduces the issue:
set xrange [-2:2]
set yrange [-2:2]
set zrange [-2:2]
set xyplane 0
set isotropic
$data <<EOD
0 0 0 1
0 0.5 0 1
EOD
#####################################################
#
# The circles are filled in "green" (OK)
#
splot $data using 1:2:3:4 with circles \
fc rgb "green" \
fs solid border lc black, \
-2 with lines lc "blue"
pause -1
#####################################################
#
# The circles are filled in "white" (???)
#
set hidden3d offset 0 front
splot $data using 1:2:3:4 with circles \
fc rgb "green" \
fs solid border lc black, \
-2 with lines lc "blue"
pause -1
#####################################################
#
# The circles are filled in "black" (???)
#
set style fill solid 1
splot $data using 1:2:3:4 with circles \
fc rgb "green", \
-2 with lines lc "blue"
pause -1
I am kind of surprised the circles are drawn at all in hidden3d mode. It was only designed for "splot with lines". Here's what the documentation says:
I guess the individual line segments that make up the circumference of the circle are being treated as if they were part of a hidden surface. That wasn't intentional. The circle interiors are not drawn because hidden3d mode only deals with line segments.
If you add the keyword "nohidden3d" after the circles part of the splot command, does that produce what you wanted? This will cause the circles to be drawn in a separate pass from the hidden3d parts of the plot. There is no way that I know of to include them in the calculation of what is occluded by the hidden3d surface.
Thank you for reply.
I wasn't interested in the behavior when adding
nohidden3d
; the real issue was that thefillcolor
setting wasn’t working as expected. So I found the following workaround:This produced the expected result. I would be satisfied if this behavior could be achieved using the inline option
with circles fc "green" fs solid 1
.That said, like you, I was also surprised that with circles is affected by hidden3d, just like surface plots are. Please, try the following.
To provide some background, what I wanted to achieve with this feature was to hide the rendering of the far side of a sphere, as in the following script. At the same time, I wanted to indicate the extent of the sphere using a color instead of white.
This is a modified version of "world.2" in "world.dem".
I am not sure where fill color fits into this.
In the first two examples you gave, my interpretation was the reason the circles are green without hidden3d and not green with hidden3d is not because of the fillcolor. I think the fillcolor is still green. But in hidden3d mode the interior of the circle is not drawn at all, so the fill color is never looked at. At least that's how I interpret the difference. You can tell it's not white fill by setting a background color for the plot; the background color will show through, not white.
I do see something odd, which may or may not explain the rest of your examples. The global property from
set style fill
seems to be taking precedence over a fillstyle given in the plot command forwith circles
. That is not supposed to happen. And when it does happen, I'm not sure where it is taking the fillcolor from. But more than that I am still confused about why it is drawing an interior for the circle at all, since as I said I before thought the hidden3d code never drew anything but line segments. Evidently I am wrong about that. I will hunt through the hidden3d code to see what is going on.Your work-around gives an impressive result. I did not think the program could do that! And it may give me a clue where to look, since apparently there must be some place in the code where it branches based on whether variable color is present. One side of the choice works while the other side does not.
Please try this patch:
I still do not quite understand how the hidden3d code is managing to occlude circles, but I think this is the reason it fails to recognize that a specific color was requested.
The fact that hidden3d always uses the global fill style rather than a plot-specific fill style is a limitation of the data structures it uses. All of the plots in the splot command are broken down into "edges" and "vertices". Line segments consist of two vertices with a connecting edge. Points consist of a single vertex with no connecting edges. The vertex structure (util3d.h) contains a pointer back to the coordinates of the point it came from, but it does not have a point back to the plot it came from. So it does not have access to a plot-specific fill style.
Thank you for the explanation.
After applying the patch, I was able to set the border color for circles. By combining it with "set style fill", the interior of the circles can also be filled in the specified color. Looking at hidden3d.c, it seems that only the "circles" style is treated specially to allow set style fill to apply a fill style.
I'm fully satisfied with this fix.