opendvp.plotting.dual_axis_boxplots

opendvp.plotting.dual_axis_boxplots#

dual_axis_boxplots(adata, feature_1, feature_2, group_by=None, ylabel1=None, ylabel2=None, return_fig=False, ax=None, **kwargs)#

Generates a dual-axis plot with boxplots and stripplots for two features.

Return type:

Figure | None

Parameters#

adataAnnData

AnnData object’s observation metadata (adata.obs) is used.

feature_1str

Column name in adata.obs for the first feature to plot on the left y-axis.

feature_2str

Column name in adata.obs for the second feature to plot on the right y-axis.

group_bystr, optional

Column name in adata.obs to group by. If None, plots features for all samples.

ylabel1str, optional

Label for the left y-axis. If None, feature_1 is used.

ylabel2str, optional

Label for the right y-axis. If None, feature_2 is used.

return_figbool

If True, returns the matplotlib Figure object for further customization.

axmatplotlib.axes.Axes, optional

Axes object to plot on. If None, new axes are created.

**kwargs

Additional keyword arguments passed to matplotlib boxplot/scatter.

Returns:#

figmatplotlib.figure.Figure or None

The figure object if return_fig is True, otherwise None.