iqplot.striphistogram
- iqplot.striphistogram(data=None, q=None, cats=None, q_axis='x', palette=None, order=None, p=None, show_legend=None, legend_location='right', legend_orientation='vertical', legend_click_policy='hide', top_level='strip', color_column=None, parcoord_column=None, tooltips=None, marker='circle', spread=None, cat_grid=True, marker_kwargs=None, jitter_kwargs=None, swarm_kwargs=None, parcoord_kwargs=None, bins='freedman-diaconis', style=None, mirror=True, hist_height=0.75, conf_int=False, ptiles=(2.5, 97.5), n_bs_reps=10000, line_kwargs=None, fill_kwargs=None, conf_int_kwargs=None, kind=None, jitter=None, horizontal=None, val=None, click_policy=None, **kwargs)
Make a strip plot with a histogram as annotation.
- Parameters:
data (Pandas DataFrame, 1D Numpy array, or xarray) – DataFrame containing tidy data for plotting. If a Numpy array, a single category is assumed and a strip plot generated from data.
q (hashable) – Name of column to use as quantitative variable if data is a Pandas DataFrame. Otherwise, q is used as the quantitative axis label.
cats (hashable or list of hashables) – Name of column(s) to use as categorical variable(s).
q_axis (str, either 'x' or 'y', default 'x') – Axis along which the quantitative value varies.
palette (list of strings of hex colors, or single hex string) – If a list, color palette to use. If a single string representing a hex color, all glyphs are colored with that color. Default is colorcet.b_glasbey_category10 from the colorcet package.
order (list or None) – If not None, must be a list of unique group names when the input data frame is grouped by cats. The order of the list specifies the ordering of the categorical variables on the categorical axis and legend. If None, the categories appear in the order in which they appeared in the inputted data frame.
p (bokeh.plotting.Figure instance, or None (default)) – If None, create a new figure. Otherwise, populate the existing figure p.
top_level (str, default 'strip') – If ‘histogram’, the histogram is overlaid. If ‘strip’, the strip plot is overlaid.
show_legend (bool, default False) – If True, display legend.
legend_location (str, default 'right') – Location of legend. If one of “right”, “left”, “above”, or “below”, the legend is placed outside of the plot area. If one of “top_left”, “top_center”, “top_right”, “center_right”, “bottom_right”, “bottom_center”, “bottom_left”, “center_left”, or “center”, the legend is placed within the plot area. If a 2-tuple, legend is placed according to the coordinates in the tuple.
legend_orientation (str, default 'vertical') – Either ‘horizontal’ or ‘vertical’.
legend_click_policy (str, default 'hide') – Either ‘hide’, ‘mute’, or None; how the glyphs respond when the corresponding category is clicked in the legend.
color_column (hashable, default None) – Column of data to use in determining color of glyphs. The data in the color_column are assumed to be categorical. If the data in color_column consist entirely of hex colors, then those colors are directly used to color the glyphs. If None, then cats is used.
parcoord_column (hashable, default None) – Column of data to use to construct a parallel coordinate plot. Data points with like entries in the parcoord_column are connected with lines in the strip plot.
tooltips (list of 2-tuples) – Specification for tooltips as per Bokeh specifications. For example, if we want col1 and col2 tooltips, we can use tooltips=[(‘label 1’: ‘@col1’), (‘label 2’: ‘@col2’)].
marker (str, default 'circle') – Name of marker to be used in the plot (ignored if formal is False). Must be one of[‘asterisk’, ‘circle’, ‘circle_cross’, ‘circle_x’, ‘cross’, ‘dash’, ‘diamond’, ‘diamond_cross’, ‘hex’, ‘inverted_triangle’, ‘square’, ‘square_cross’, ‘square_x’, ‘triangle’, ‘x’]
jitter (bool, default False) – If True, apply a jitter transform to the glyphs.
cat_grid (bool, default True) – If True, display grid line for categorical axis.
marker_kwargs (dict) – Keyword arguments to pass when adding markers to the plot. [“x”, “y”, “source”, “marker”, “cat”, “legend”] are note allowed because they are determined by other inputs.
jitter_kwargs (dict) – Keyword arguments to be passed to bokeh.transform.jitter(). If not specified, default is {‘distribution’: ‘normal’, ‘width’: 0.1}. If the user specifies {‘distribution’: ‘uniform’}, the ‘width’ entry is adjusted to 0.4. Only active if spread is ‘jitter’.
swarm_kwargs (dict) –
Keyword arguments for use in generating swarm. Only active if spread is ‘swarm’. Keys with allowed values are:
’corral’: Either ‘gutter’ (default) or ‘wrap’. This
specifies how points that are moved too far out are dealt with. Using ‘gutter’, points are overlayed at the maximum allowed distance. Using ‘wrap’, points are reflected inwards form the maximal extent and possibly overlayed with other points.
’priority’: Either ‘ascending’ (default) or ‘descending’.
Sort order when determining which points get moved in the y-direction first.
marker_pad_px : Gap between markers in units of pixels,
default 0.
parcoord_kwargs (dict) – Keyword arguments to be passed to p.line() when making lines for kwargs. Default is to have one-pixel gray lines.
bins (int, array_like, or str, default 'freedman-diaconis') – If int or array_like, setting for bins kwarg to be passed to np.histogram(). If ‘exact’, then each unique value in the data gets its own bin. If ‘integer’, then integer data is assumed and each integer gets its own bin. If ‘sqrt’, uses the square root rule to determine number of bins. If freedman-diaconis, uses the Freedman-Diaconis rule for number of bins.
style (None or one of ['step', 'step_filled']) – Default for overlayed histograms is ‘step’ and for stacked histograms ‘step_filled’. The exception is when cont_int is True, in which case style must be ‘step’.
mirror (bool, default True) – If True, reflect the histogram through zero.
hist_height (float, default 0.75) – Maximal height of histogram of its confidence interval as a fraction of available height along categorical axis. Only active when arrangement is ‘stack’.
conf_int (bool, default False) – If True, display confidence interval of ECDF.
ptiles (list, default (2.5, 97.5)) – The percentiles to use for the confidence interval of the histogram. Ignored if conf_int is False.
n_bs_reps (int, default 10,000) – Number of bootstrap replicates to do to compute confidence interval of histogram. Ignored if conf_int is False.
line_kwargs (dict) – Keyword arguments to pass to p.line() in constructing the histograms. By default, {“line_width”: 2}.
fill_kwargs (dict) – Keyword arguments to pass to p.patch() when making the fill for the step-filled histogram or confidence intervals. Ignored if style = ‘step’ and conf_int is False. By default {“fill_alpha”: 0.3, “line_alpha”: 0}.
horizontal (bool or None, default None) – Deprecated. Use q_axis.
val (hashable) – Deprecated, use q.
click_policy (str, default 'hide') – Deprecated. Use legend_click_policy.
conf_int_kwargs (dict) – Deprecated. Use fill_kwargs.
kind (str, default 'step_filled') – Deprecated. Use style.
kwargs – Any kwargs to be passed to bokeh.plotting.figure() when instantiating the figure.
- Returns:
output – Plot populated with a strip-histogram plot.
- Return type:
bokeh.plotting.Figure instance
Notes