Enhancement request for the gnuplot command to automatically order multiple forecast intervals based on their confidence levels (factors) when plotting, ensuring proper visualization of nested intervals.
When plotting multiple forecast intervals using the --bands option, the order of intervals in the bundle array determines their plotting order. This can lead to visualization issues where wider intervals completely cover narrower ones if not manually ordered correctly.
Please find attached a sample script.
# This ordering causes the 80% interval to be invisible
bundles Bands = defarray(FC_INTVAL_CI_80, FC_INTVAL_CI_95)
gnuplot LRY fc --with-lines --time-series --bands=Bands --output=display
Implement automatic ordering of intervals based on their factor values in descending order. This would:
factor values from each bundle in the bands arrayApplies the sorted order when plotting
Example of desired behavior:
# Both orderings would produce identical plots
bundles Bands = defarray(FC_INTVAL_CI_80, FC_INTVAL_CI_95)
# or
bundles Bands = defarray(FC_INTVAL_CI_95, FC_INTVAL_CI_80)
Don't you just need the 'asort' function before passing your stuff to gnuplot?
Personally, I haven't used
asort()before . But yes, it looks like this can handle the sorting part. This, of course, would require an additional step to do by the user. It took me 1,5 days to understand the cause of "hidden" intervals.That's why I suggest an automatic sorting done by Gretl itself in the background.
By the way, let me also provide an alternative which helps somehow: Using gnuplot's option to set the alpha channel (transparency level) which gretl supports since some time.
Try the color strings
color="#99FF8E1E"andcolor="#99F52D12"which avoids the overlapping somehow.I was going to argue some more that it really could be left to the user, but some testing and further digging revealed that this was actually already implemented back in November, see https://sourceforge.net/p/gretl/git/ci/b98556db85d8b3c2a89f07b65232bc045e312b84/.
Artur's test case works in the sense that with gretl 2024d nothing is covered anymore. So I'm closing this.