You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I noticed two possible issues with plot_kde when plotting 2D data:
1- it seems levels (hdi_probs) are only applied to filled contours (contourf) and not line contours (contour). However I am not sure if this is an expected behavior and my misunderstanding, as it seems prevalent in examples.
2- filled contour seems not to apply the passed transparency keyword alpha, while contour lines do.,
To Reproduce
Both of these issues are visible in the examples on the plot_kdedocumentation page and reproducible by the example provided there. Particularly:
# Example from the documentation pageimportarvizasaznon_centered=az.load_arviz_data('non_centered_eight')
mu_posterior=np.concatenate(non_centered.posterior["mu"].values)
tau_posterior=np.concatenate(non_centered.posterior["tau"].values)
# Not applying `hdi_probs`:az.plot_kde(mu_posterior, values2=tau_posterior, hdi_probs=[0.393, 0.865, 0.989])
# Ignoring alpha for contourfaz.plot_kde(mu_posterior, values2=tau_posterior, hdi_probs=[0.393, 0.865, 0.989], contourf_kwargs={'alpha':0.0})
Expected behavior
Regarding issue 1: I expected the contour lines to match the edge of filled contours. I wonder if I'm misunderstanding how it should behave.
Regarding issue 2: As indicated in the documentation, I expected the resulting plot with contourf_kwargs={'alpha':0.0} to only have contour lines and no contour filling.
Additional context
Encountered with Arviz 0.21.0 and matplotlib 3.10.0. Presence of this issue in the online examples may suggest I have misunderstood expected behavior or that the issues are perhaps unlikely to be caused by my specific system setup.
Thanks!
The text was updated successfully, but these errors were encountered:
Thanks for reporting. IIRC, hdi_probs gets converted to contour values and added to the contour and contourf kwarg dicts. From the behaviour I am guessing this update step is somehow broken and only has an effect on contourf kwarg dict while at the same time instead of being added they overwrite the existing dict for contourf kwargs so it ends up containing only the requested hdi_probs as contour levels.
Describe the bug
I noticed two possible issues with
plot_kde
when plotting 2D data:1- it seems levels (
hdi_probs
) are only applied to filled contours (contourf
) and not line contours (contour
). However I am not sure if this is an expected behavior and my misunderstanding, as it seems prevalent in examples.2- filled contour seems not to apply the passed transparency keyword
alpha
, while contour lines do.,To Reproduce
Both of these issues are visible in the examples on the
plot_kde
documentation page and reproducible by the example provided there. Particularly:Expected behavior
Regarding issue 1: I expected the contour lines to match the edge of filled contours. I wonder if I'm misunderstanding how it should behave.
Regarding issue 2: As indicated in the documentation, I expected the resulting plot with
contourf_kwargs={'alpha':0.0}
to only have contour lines and no contour filling.Additional context
Encountered with Arviz 0.21.0 and matplotlib 3.10.0. Presence of this issue in the online examples may suggest I have misunderstood expected behavior or that the issues are perhaps unlikely to be caused by my specific system setup.
Thanks!
The text was updated successfully, but these errors were encountered: