Add waterfall plot - #13921
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #13921 +/- ##
==========================================
- Coverage 91.93% 91.67% -0.27%
==========================================
Files 482 484 +2
Lines 33516 33748 +232
==========================================
+ Hits 30813 30938 +125
- Misses 2703 2810 +107
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Screenshots differ from baselines. A baseline update PR has been prepared: equinor/ert-testdata#45 |
| fontweight="bold", | ||
| ) | ||
|
|
||
| figure.tight_layout() |
There was a problem hiding this comment.
The layout engine sets this by default, so not needed. Can lead to unwanted formatting-behaviour when resizing the window
| ax.set_xticks(x) | ||
| ax.set_xticklabels(names, rotation=45, ha="right", fontsize=8) | ||
| ax.set_ylabel("Mean parameter value (standardized)", fontsize=10) | ||
| ax.axhline(0, color="black", linewidth=0.5) | ||
| ax.grid(axis="y", alpha=0.3) | ||
|
|
||
| key = plot_context.key() | ||
| experiment_name = truncate_experiment_name(ensemble.experiment_name) | ||
| n_contrib = int(contrib_mask.sum()) | ||
| ax.set_title( | ||
| f"Expected update for {key}\n" | ||
| f"by top {n_contrib} observation contributions" | ||
| f"\n({experiment_name} : {ensemble.name})", | ||
| fontsize=12, | ||
| fontweight="bold", |
There was a problem hiding this comment.
Some of this could be covered byPlotTools.finalizePlot() and setting the PlotType as BOX or BAR.
That will also allow the user to update the plot, i.e toggle grid/legend, changing title and labels
| COLOR_POSITIVE = "#70AD47" | ||
| COLOR_NEGATIVE = "#ED7D31" |
There was a problem hiding this comment.
I like the idea of having specific color to convey info, I think other plots (especially Everest) could benefit from aligning with these colors, so its consistent across the application.
Could we move this to a central file, maybe in the plot utils or plot_tools, such that we could use this as global palette for positive/improvements and negative/rejected?
There was a problem hiding this comment.
Yes, sounds like a good idea
| _plot_waterfall(figure, plot_context, data, ensemble) | ||
|
|
||
|
|
||
| def _plot_waterfall( |
There was a problem hiding this comment.
Will there be more plot-variants of this plot, e.g _plot_waterfall_with_x_condition()?
If not, could this be moved to the plot-function instead of being its own function?
There was a problem hiding this comment.
No, not at the moment at least.
There was a problem hiding this comment.
We do use the following pattern though: eg. Histogram.plot(...) -> plotHistogram(...)
| va=va, | ||
| fontsize=7, | ||
| ) | ||
|
|
There was a problem hiding this comment.
Could we add the color of positive/negative to the legend to help guide the user?
There was a problem hiding this comment.
Hm, maybe an idea.
I was trying to reproduce the plots used in the assets. I can try to poke some expert users if this would make sense.
| if not ensemble_to_data_map: | ||
| return | ||
|
|
||
| # Find the first ensemble that has non-empty waterfall data |
There was a problem hiding this comment.
What happens if the user re-organizes the ensemble selection? e.g moving iter-0 after iter-1, will the behavior work as intended then?
There was a problem hiding this comment.
if multiple ensembles are selected, (iter-0 - iter-3), would the user know why or how to get the "correct" ensemble to plot?
There was a problem hiding this comment.
I think this plot should be primarily dedicated to show enif (transition between prior to posterior). So if we would select multiple ensembles that would be only to compare two experiments with enif.
I haven't got that far yet :)
There was a problem hiding this comment.
Enif plot will only support one ensemble for the time being.
Use polars instead of pandas Make sure that blob_type==BlobType.MATRIX Add unit test for waterfall data computations Make only one ensemble selecteble
|
Screenshots differ from baselines. A baseline update PR has been prepared: equinor/ert-testdata#86 |
Issue
Resolves #13730
Approach
Short description of the approach
(Screenshot of new behavior in GUI if applicable)
git rebase -i main --exec 'just rapid-tests')When applicable