dot_plot(points, intervals=None, lines=None, sections=None, styles=None, marker_props=None, line_props=None, split_names=None, section_order=None, line_order=None, stacked=False, styles_order=None, striped=False, horizontal=True, show_names='both', fmt_left_name=None, fmt_right_name=None, show_section_titles=None, ax=None)¶
Dot plotting (also known as forest and blobbogram).
Produce a dotplot similar in style to those in Cleveland’s “Visualizing Data” book (). These are also known as “forest plots”.
The quantitative values to be plotted as markers.
The intervals to be plotted around the points. The elements of intervals are either scalars or sequences of length 2. A scalar indicates the half width of a symmetric interval. A sequence of length 2 contains the left and right half-widths (respectively) of a nonsymmetric interval. If None, no intervals are drawn.
A grouping variable indicating which points/intervals are drawn on a common line. If None, each point/interval appears on its own line.
A grouping variable indicating which lines are grouped into sections. If None, everything is drawn in a single section.
A grouping label defining the plotting style of the markers and intervals.
A dictionary mapping style codes (the values in styles) to dictionaries defining key/value pairs to be passed as keyword arguments to plot when plotting markers. Useful keyword arguments are “color”, “marker”, and “ms” (marker size).
A dictionary mapping style codes (the values in styles) to dictionaries defining key/value pairs to be passed as keyword arguments to plot when plotting interval lines. Useful keyword arguments are “color”, “linestyle”, “solid_capstyle”, and “linewidth”.
If not None, this is used to split the values of lines into substrings that are drawn in the left and right margins, respectively. If None, the values of lines are drawn in the left margin.
The section labels in the order in which they appear in the dotplot.
The line labels in the order in which they appear in the dotplot.
If True, when multiple points or intervals are drawn on the same line, they are offset from each other.
If stacked=True, this is the order in which the point styles on a given line are drawn from top to bottom (if horizontal is True) or from left to right (if horizontal is False). If None (default), the order is lexical.
If True, every other line is enclosed in a shaded box.
If True (default), the lines are drawn horizontally, otherwise they are drawn vertically.
Determines whether labels (names) are shown in the left and/or right margins (top/bottom margins if horizontal is True). If both, labels are drawn in both margins, if ‘left’, labels are drawn in the left or top margin. If right, labels are drawn in the right or bottom margin.
The left/top margin names are passed through this function before drawing on the plot.
The right/bottom marginnames are passed through this function before drawing on the plot.
- show_section_titlesbool or
If None, section titles are drawn only if there is more than one section. If False/True, section titles are never/always drawn, respectively.
The axes on which the dotplot is drawn. If None, a new axes is created.
The figure given by ax.figure or a new instance.
points, intervals, lines, sections, styles must all have the same length whenever present.
Cleveland, William S. (1993). “Visualizing Data”. Hobart Press.
Jacoby, William G. (2006) “The Dot Plot: A Graphical Display for Labeled Quantitative Values.” The Political Methodologist 14(1): 6-14.
This is a simple dotplot with one point per line:
This dotplot has labels on the lines (if elements in label_values are repeated, the corresponding points appear on the same line):
>>> dot_plot(points=point_values, lines=label_values)