Resolve "Implement a multiplot that can flexibly call various plot functions"
requested to merge 227-implement-a-multiplot-that-can-flexibly-call-various-plot-functions into master
This MR implements the multiplot
function in the multiplot.py
module.
The multiplot
can apply multiple functions, specified in the _MULTIPLOT_PLOT_KINDS
dict, consecutively on an axis.
Details
Currently, all seaborn
plots having an ax
kwarg, so taking an axis and not creating a figure themselves, are available. They were looked up in the seaborn API.
As a few examples of the plot configuration and capabilities, here is an extract from the test configurations:
multiplots:
simple_scatter:
plot_func: multiplot
to_plot:
- function: sns.scatterplot
data: !dag_result data
x: dim_0
y: dim_1
marker: x
multiple_funcs:
plot_func: multiplot
to_plot:
- function: sns.lineplot
data: !dag_result data
- function: sns.scatterplot
data: !dag_result data
- function: sns.despine
# Try to plot all different plot kinds.
# All plot functions should be available, but single plots are allowed
# to fail. The plot should succeed.
all_succeeding_sns_funcs:
plot_func: multiplot
to_plot:
- function: sns.scatterplot
data: !dag_result data
- function: sns.lineplot
data: !dag_result data
- function: sns.histplot
data: !dag_result data
- function: sns.kdeplot
data: !dag_result data
- function: sns.ecdfplot
data: !dag_result data
- function: sns.rugplot
data: !dag_result data
- function: sns.stripplot
data: !dag_result data
- function: sns.swarmplot
data: !dag_result data
- function: sns.boxplot
data: !dag_result data
- function: sns.violinplot
data: !dag_result data
- function: sns.boxenplot
data: !dag_result data
- function: sns.pointplot
data: !dag_result data
- function: sns.barplot
data: !dag_result data
- function: sns.countplot
data: !dag_result data
- function: sns.heatmap
data: !dag_result data
- function: sns.despine
- function: sns.regplot
data: !dag_result data
- function: sns.residplot
data: !dag_result data
Extensions
- There should be a follow-up issue allowing for multi-axis support enabling plotting multiple functions on multiple axis.
- Possibly, we could enable animation support.
- Integrate plots from more plotting libraries? If yes, which ones?
- Extend the documentation entry by an example plot showing an example plot configuration and Ipython to load one of seaborn's example datasets and show the resulting plot in the documentation.
Anything to double-check?
-
seaborn
required version ok in the dependencies? -
matplotlib
plot function selection ok? Reference link ok (I could not find an overview page of all available plot functions)? -
Include multi-axis documentation already or rather remove it?
Can this MR be accepted?
-
Implementation ready -
Add seaborn
to the dependencies -
Add a _MULTIPLOT_PLOT_KINDS
dict containing all available function name -> plot function mappings-
Inlcude seaborn
plot functions -
Include common matplotlib.pyplot
plot functions
-
-
Implement the multiplot
function in themultiplot.py
module.
-
-
Tests added or adjusted -
Documentation extended or updated
-
Code quality -
Changes follow coding guidelines -
Checked code coverage on new and adjusted code
-
-
Ready for merging -
Pipeline passes without warnings -
History cleaned-up or squash option set -
Changelog entry added -
Version number bumped -
Reviewed & approved by @blsqr
-
Related issues
Closes #227 (closed)
Edited by Utopia Developers