votesim.plots¶
Function Summary¶
|
|
|
Custom bar plot with values on bars |
|
|
|
Custom heatmap for either categorical or numeric data. |
|
Put labels on seaborn bar chart from stack overflow https://stackoverflow.com/questions/43214978/seaborn-barplot-displaying-values |
|
|
|
|
|
|
|
|
|
Set votesim preferred matplotlib global options |
Module Functions¶
bar¶
-
votesim.plots.
bar
(x, y, data=None, fmt='g', **kwargs)¶ Custom bar plot with values on bars
- Parameters
x (str) – data column name for x-axis
y (str) – data column name for y-axis
array, or list of arrays, optional (dataDataFrame,) – Dataset for plotting.
- Returns
ax – Returns the Axes object with the plot drawn onto it.
- Return type
matplotlib Axes
heat_pivot¶
-
votesim.plots.
heat_pivot
(data, x, y, hue, func='mean', xbin=None, ybin=None, sort=True)¶
heatmap¶
-
votesim.plots.
heatmap
(x, y, hue, data, func='mean', xbin=None, ybin=None, annot=True, fmt='.1f', xfmt='g', yfmt='g', cbar=False, linewidths=0.5, cmap='viridis_r', sort=True, xsortkey=None, ysortkey=None, **kwargs)¶ Custom heatmap for either categorical or numeric data.
- Parameters
x (str) – column name of data plotted on x-axis
y (str) – Column name of data plotted on y-axis
hue (str) – Column name of data values plotted on heatmap.
data (Pandas DataFrame) – Data used in plot
func (str or function) –
aggregation function for data.agg, for example
’min’, ‘mean’, ‘max’, ‘sum’
np.mean
ybin (xbin,) –
If x or y is not categorical data, bin
None (default) – if x or y is categorical data, do nothing.
int – Set to number of bins to divide data using pandas.cut
array – User defined bins to divide data using pandas.cut
yfmt (xfmt,) – Formatting string for x and y axes, default ‘.2f’.
sort (bool) – Sort the results by their average across the x-axis. Default True.
**kwargs – Additional arguments passed into seaborn.heatmap.
- Returns
ax (matplotlib Axes) – Axes object with the heatmap.
dfp (pandas DataFrame) – Pivot table used to construct heatmap
show_values_on_bars¶
-
votesim.plots.
show_values_on_bars
(axs, height=0.2, fmt='g')¶ Put labels on seaborn bar chart from stack overflow https://stackoverflow.com/questions/43214978/seaborn-barplot-displaying-values