-
-
Notifications
You must be signed in to change notification settings - Fork 434
Improve pair_plot
's reference_values
compatibility, flexibility, and documentation
#2438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2438 +/- ##
==========================================
+ Coverage 86.75% 86.78% +0.02%
==========================================
Files 124 124
Lines 12941 12915 -26
==========================================
- Hits 11227 11208 -19
+ Misses 1714 1707 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I have further refactored and simplified the logic, especially for some of the consistency checks. Now, this is much more flexible. Consider the following example, where we use a mix of import arviz as az
import numpy as np
from arviz.labels import MapLabeller
print(az.__version__)
datadict = {
"a": np.random.randn(1, 100),
"b": np.random.randn(1, 100),
"c": np.random.randn(1, 100, 2),
"d": np.random.randn(1, 100, 2),
"x": np.random.randn(1, 100, 2, 1),
"y": np.random.randn(1, 100, 2, 1),
}
trace = az.convert_to_inference_data(datadict)
reference_values = {
"a": 0.0,
"b": 0.0,
"c": [-0.5, 0.5],
"d": [-0.5, 0.5],
"x": np.array([[-0.5], [0.5]]),
"y": np.array([[-0.5], [0.5]]),
}
var_name_map = {
"a": r"$\alpha$ ($\mu$m)",
"b": r"$\beta$ ($\mu$m)",
"x": "x (cm)",
"y": "y (cm)",
}
labeller = MapLabeller(var_name_map)
az.plot_pair(
trace,
var_names=["a", "b"],
reference_values=reference_values,
labeller=labeller,
show=True,
)
az.plot_pair(
trace,
var_names=["c", "d"],
reference_values=reference_values,
labeller=labeller,
show=True,
)
az.plot_pair(
trace,
var_names=["x", "y"],
reference_values=reference_values,
labeller=labeller,
combine_dims={"x_dim_0", "y_dim_0"},
show=True,
) |
I have updated the tests and documentation, as well as provided an example in the gallery. This should be ready to review once the checks have completed! @aloctavodia @amaloney |
pair_plot
reference values by var_name
instead of labeled var_name
pair_plot
's reference_values
compatibility, flexibility, and documentation
Thanks for the PR and clear description! I'll try and take a look soonish, sorry about the slow responses. |
Description
This PR addresses #2437 by refactoring the
reference_values
handling inpair_plot
.reference_values
is much more flexible, as demonstrated below, and now properly works when combined withlabeller
andcombine_dims
. It also adds newreference_values
documentation and examples.Checklist
📚 Documentation preview 📚: https://arviz--2438.org.readthedocs.build/en/2438/