geosnap.visualize.plot_violins_by_cluster¶
- geosnap.visualize.plot_violins_by_cluster(df, columns, cluster_col, violin_kwargs=None, figsize=(12, 8), nrows=None, ncols=None, titles=None, savefig=None, dpi=200)[source]¶
Create matrix of violin plots categorized by a discrete class variable
- Parameters:
- df
pandas.DataFrame
orgeopandas.GeoDataFrame
datafrme with columns to plot as violins and a colunn of class labels
- columnslist-like
list of columns to plot as violins
- cluster_col
str
name of the column in the dataframe that holds class labels
- violin_kwargs
dict
, optional additional keyword arguments passed to seaborn.violinplot
- figsize
tuple
, optional size of output figure, by default (12, 8)
- nrows
int
, optional number of rows in the violin (nrows * ncols must equal len(columns)), by default None
- ncols
int
, optional number of columns in the violin (nrows * ncols must equal len(columns)), by default None If both ncols and nrows are none, they will be set to the miminmum bounding square
- titles
list
, optional list of titles to set on each subplot. If None (default) the title of each axes will be set to the name of the column being plotted
- savefig
str
, optional If provided, the figure will be saved at this path
- dpi
int
, optional dpi of resulting figure when using savefig, by default 200
- df
- Returns:
matplotlib.axes.Axes
a matplotlib Axes object with a subplot for each column