Add legend symbol for confidence lines #6890
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
Both plot and plot3d can plot lines with build-in confidence bands. This is done via the option -L+b|d|D that reads extra column(s) to build the envelope around the line (drawn with -Wpen) and the envelope is painted via -Gfill. The envelope may also take an outline pen via -L's +ppen modifier. However, we had no way to handle this in a legend. The sad and painful process was to draw them as two separate things, then struggle a bit with a manual legend setup to draw a line on top of the rectangle for the envelope fill.
This PR detects the -L situation and basically issues to auto calls for legend entries, the first using the special symbol L for a rectangle that should not see a legend position change after it, and then the line as the second symbol which then overprints the rectangle. With this PR, simple examples like this:
will give a legend entry like this: