Using gnuplot version 6.1 patchlevel 0 on OpenSuse Leap 15.5. In the Qt terminal (I guess it's similar in other terminals), clicking entries in the legend or issuing the command toggle
disables/enables certain plots. This behaviour does not work if hidden3d
is set. In this case, all plots are shown, and it is not paid attention to whether they are enabled or disabled.
Correct. That is an intrinsic result of the way
hidden3d
andtoggle
are implemented.hidden3d
affects the way plot elements are ordered prior to sending them as a display list to the output device.toggle
is an operation performed by the output device to alter how it processes the display list. Note that gnuplot (the executable program) may be long gone at the time of the toggle operation. For example, a user can toggle the plots on a web page generated elsewhere and at some other time by the gnuplot 'canvas' or 'svg' terminals.In the normal case (no hidden3d processing) the individual components of each plot are generated and rendered together. Thus all the line segments, points, boxes, labels, whatever from plot #1 are drawn first; then the program processes all the lines, points, etc, from plot #2, and draws them; repeat until all plots are completed. That means all the elements making up later plots are visually in front of all the elements of earlier plots - contrary to their "true" depth in the composite. As the display list is generated, each plot is bracketed by a
begin/end
pair. The toggle mechanism works by introducing a conditional jump in the display list at thebegin
mark for each plot. If that plot is toggled off, the corresponding block of the display list is skipped over when the display is refreshed.In the
hidden3d
case all elements from all the plots are first collected into one big list and then the list of component lines, points, etc is sorted by z' (depth) so that the further away items are drawn first. The elements generated by any single plot become scattered throughout the list and thus there is no contiguous block of the display list that can be skipped over to toggled only the elements generated by one of the original plots.Conceptually, one could tag each individual component line segment, point, label, etc with an additional bit of information specifying which plot it came from. This would have to be encoded somehow into the display list sent to the output device from the core code (very terminal dependent!). Then the output device would have to be taught how to render or not render each element based on this additional tag. I can see how this might be possible for Qt, but I am dubious that any of the other gnuplot terminals could support it. Anyhow that's not the way the program is currently designed.
There is a separate issue that
hidden3d
changes the method used to generate and represent 3d gridded surfaces. It would not make sense to apply a toggle operation after the hidden line removal step in this alternative surface representation, since it would change which lines should be hidden.Bottom line: this is a non-fixable consequence of the way the program works.