Open
Description
This collects information regarding changes in the cabinetry
visualization API, and is a follow-up to #251.
- feat: make matplotlib core dependency and refactor visualization code #250 made
matplotlib
a core dependency and refactored the plotting code. - feat: return figures from visualizations #264 made functions in the
visualize
module return figures (or a list of dictionaries with figures) - feat: model prediction API and yield table changes #267 changed
visualize.data_mc
to take a model prediction object instead of a model, and added a newchannels
keyword argument - feat: close single figures by default #271 fixed duplicate display of figures from functions returning figures (instead of lists of dicts) in notebooks (see also Visualization API changes #265 (comment) below)
- feat: support custom colors for data/MC plots #399 added support for custom histogram colors for data/MC plots
Outstanding items and open questions (including pieces from #381):
- allow injecting axes into plotting functions #142 (aiming at v0.4)
- The natural target for this seems to be
visualize.plot_model
andvisualize.plot_result
, and those functions should then likely return artists. Calling these functions directly comes with a loss in convenience, e.g. the correlation matrix pruning threshold. Could consider factoring out the convenience functions? Handing axes to thevisualize
-level functions is more challenging, since several of these can return multiple figures (and the exact number is not easily known forvisualize.templates
).
- The natural target for this seems to be
- Consider supporting callbacks as suggested in feature request: matplotlib visualize log scale #113 (comment).
- Consider making return of figures optional to avoid keeping too many figures in memory for
visualize.templates
(figures still kept around even withclose_figure=True
as long as reference to them exists). - In addition to this it seems useful to not override custom rcParams set by users via the mpl.style.use calls in cabinetry but instead only update values that correspond to the matplotlib default. Then users could do something like
to get a custom color scheme. (from Histogram colors in stacks - user interface creation #381)
import matplotlib as mpl mpl.rcParams['axes.prop_cycle'] = mpl.cycler(color=["salmon", "tan", "mediumseagreen"])
- this may actually not override everything as initially expected, see fix: add axis labels and binning to cabinetry config file iris-hep/analysis-grand-challenge#117 (comment)
- Another idea: new setting style with default style="cabinetry" that will apply the mpl.style.use call, and the option style=None that will skip it. That allows users to set rcParams in any way they want. Some other styling operations like tick label design and such can probably also be factored from the code and put into a style sheet gathering everything. (from Histogram colors in stacks - user interface creation #381)