opendvp.plotting.dual_axis_boxplots

opendvp.plotting.dual_axis_boxplots#

opendvp.plotting.dual_axis_boxplots(adata_obs, feature_key='RCN', feature_1='Proteins.Identified', feature_2='Precursors.Identified', ylabel1='Proteins Identified', ylabel2='Precursors Identified', offset=0.1, width=0.2, point_alpha=0.2, box1_color='skyblue', box2_color='lightcoral', median_color='black', scatter_color='black', tick1_color='blue', tick2_color='red', figsize=(6, 6), return_fig=False, show_plot=True, ax1=None, ax2=None, **kwargs)#

Generates a dual-axis plot with boxplots and stripplots for two features grouped by a specified feature key.

Return type:

Figure | None

Parameters#

adata_obspd.DataFrame

DataFrame typically derived from an AnnData object’s observation metadata (adata.obs).

feature_keystr

Column name to group by (e.g., “RCN”).

feature_1str

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

feature_2str

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

ylabel1str

Label for the left y-axis.

ylabel2str

Label for the right y-axis.

offsetfloat

Offset for positioning the boxplots side-by-side.

widthfloat

Width of the boxplots.

point_alphafloat

Alpha transparency for the scatter plot points.

box1_colorstr

Face color for the boxplots of feature_1.

box2_colorstr

Face color for the boxplots of feature_2.

median_colorstr

Color of the median line in boxplots.

scatter_colorstr

Color of the points in stripplots.

tick1_colorstr

Color of the left y-axis tick labels and axis label.

tick2_colorstr

Color of the right y-axis tick labels and axis label.

figsizetuple

Figure size (width, height).

return_figbool

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

show_plotbool

If True, displays the plot. Otherwise, only returns the figure/axes.

ax1, ax2matplotlib.axes.Axes, optional

Axes objects 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.