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:
dfpandas.DataFrame or geopandas.GeoDataFrame

datafrme with columns to plot as violins and a colunn of class labels

columnslist-like

list of columns to plot as violins

cluster_colstr

name of the column in the dataframe that holds class labels

violin_kwargsdict, optional

additional keyword arguments passed to seaborn.violinplot

figsizetuple, optional

size of output figure, by default (12, 8)

nrowsint, optional

number of rows in the violin (nrows * ncols must equal len(columns)), by default None

ncolsint, 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

titleslist, 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

savefigstr, optional

If provided, the figure will be saved at this path

dpiint, optional

dpi of resulting figure when using savefig, by default 200

Returns:
matplotlib.axes.Axes

a matplotlib Axes object with a subplot for each column