vishelper.plots package¶
Submodules¶
vishelper.plots.bar module¶
- vishelper.plots.bar.bar(x, y, ax=None, color=None, label=None, stacked=False, grouped=False, groups=None, width=0.8, spacing=0.2, **kwargs)[source]¶
vishelper.plots.boxplot module¶
- vishelper.plots.boxplot.boxplot(x, y, hue=None, data=None, orient='v', ax=None, palette='Set3', edge_color='black', face_color=None, color_map=None, xrotation=None, yrotation=None, **kwargs)[source]¶
Draws boxplots to compare distributions of numerical variables for a set of categories.
- Parameters
x – If orient=’v’, categorical values. If orient=’h’, numerical values. List of values or column name of values if data is provided.
y – If orient=’v’, numerical values. If orient=’h’, categorical values. List of values or column name of values if data is provided.
hue – Categorical values to group box vishelper by. List of values or column name of values if data is provided.
data – Optional, dataframe containing data to plot. Default: None
orient – ‘v’ to plot box vishelper vertically, ‘h’ to plot horizontally. Default: ‘v’
ax (
matplotlib.axes._subplots.AxesSubplot, optional) – Matplotlib axes handle. Default is None and a new ax is generated along with the fig.palette – Colors to use for the different levels of the hue variable. Should be something that can be interpreted by color_palette(), or a dictionary mapping hue levels to matplotlib colors.
edge_color – Color for edges of box plot. Default: ‘black’. Used if color_map or pallet are provided.
face_color – Color for boxes in box plot. Default: None. pallet or color_map is used if not provided.
color_map – Dictionary of mapping between unique categorical values and colors. Default None. pallet or face_color used if not provided.
xrotation (int) – Degree to rotate x-label. Default: None
yrotation (int) – Degree to rotate y-label. Default None.
**kwargs – Any additional keyword arguments that seaborn.boxplot() can take
- Returns
Matplotlib figure object. Only returned if ax is not provided as an argument. ax (
matplotlib.axes._subplots.AxesSubplot): Axes object with the plot(s)- Return type
fig (matplotlib.figure.Figure)
vishelper.plots.heatmap module¶
vishelper.plots.hist module¶
vishelper.plots.line module¶
- vishelper.plots.line.add_dline(ax, m=1, b=0, **kwargs)[source]¶
Adds a diagonal line with slope, m, and y-intercept, b, between x_min and x_max
- vishelper.plots.line.add_hline(ax, y, **kwargs)[source]¶
Adds a horizontal line to the axis ax at the provided y value.
vishelper.plots.scatter module¶
- vishelper.plots.scatter.scatter(x, y, ax=None, color=None, size=None, alpha=None, logx=False, logy=False, **kwargs)[source]¶
Creates a scatter plot of (x, y)
- Parameters
x (list or
numpy.ndarray) – x-coordinates for plotting. Must be same size as yy (list or
numpy.ndarray) – y-coordinates for plotting. Must be same size as xax (
matplotlib.axes._subplots.AxesSubplot) – Matplotlib axes handlecolor –
The marker color. Can be a olor, sequence, or sequence of color, optional. Defaults to the first value in `formatting[“color.darks”]. Possible values:
A single color format string. A sequence of color specifications of length n. A sequence of n numbers to be mapped to colors using cmap and norm.
alpha (float, optional) – The alpha blending value, between 0 (transparent) and 1 (opaque). Defaults to formatting[‘alpha.single’]
logx (bool) – If True, the x-axis will be transformed to log scale
logy (bool) – If True, the y-axis will be transformed to log scale
**kwargs – Additional keyword arguments are passed to ax.scatter()
- Returns
Matplotlib axes handle with scatter plot on it
- Return type
ax (
matplotlib.axes._subplots.AxesSubplot)