facet¶
Facet multiple plots on the same figure.
- dmslogo.facet.facet_plot(data, *, x_col, show_col, height_per_ax=2.5, gridrow_col=None, gridcol_col=None, draw_line_kwargs=None, draw_logo_kwargs=None, line_titlesuffix='', logo_titlesuffix='', hspace=0.8, wspace=1.1, lmargin=1, rmargin=0.2, tmargin=0.4, bmargin=1.3, share_xlabel=False, share_ylabel=False, share_ylim_across_rows=True, set_ylims=False)[source]¶
Facet together plots of different types on same figure.
Useful for combining multiple instances of the plots you could create with
dmslogo.logo.draw_logo
anddmslogo.line.draw_line
.- Args:
- data (pandas DataFrame)
The data to plot.
- x_col (str)
Column in data with x-axis values, as for
dmslogo.logo.draw_logo
anddmslogo.line.draw_line
.- show_col (str or None)
Column in data with x-axis values to highlight in line plots and to show in logo plots.
- height_per_ax (float)
Height of each axis in the faceted plot.
- gridrow_col (str or None)
Column in data to facet over for rows of plot.
- gridcol_col (str or None)
Column in data to facet over for columns of plot.
- draw_line_kwargs (dict)
All arguments to be passed to
dmslogo.line.draw_line
except x_col, show_col, and title. These are passed separately or come from faceting variables.- draw_logo_kwargs
Like draw_line_kwargs but for
dmslogo.logo.draw_logo
.- line_titlesuffix (str or None)
String suffixed to titles for line plots.
- logo_titlesuffix
String suffixed to titles for logo plots.
- hspace (float)
Vertical space between axes in same units as height_per_ax.
- wspace (float)
Horizontal space between axes.
- lmargin (float)
Left margin in same units as height_per_ax.
- rmargin (float)
Right margin in same units as height_per_ax.
- tmargin (float)
Top margin in same units as height_per_ax.
- bmargin (float)
Bottom margin in same units as height_per_ax.
- share_xlabel (bool)
Share the x-labels across the line and logo plots.
- share_ylabel (bool)
Share the y-labels across the line and logo plots.
- share_ylim_across_rows (bool)
Do we share y-limits across rows?
- set_ylims (False or 2-tuple or dict)
To set y-limits for all axes, specify the 2-tuple (ymin, ymax). To set y-limits differently for each row, specify a dict keyed by the possible values of gridrow_col with the values being 2-tuples (ymin, ymax).
- Returns:
The 2-tuple fig, axes where fig is the matplotlib Figure and axes is a numpy ndarray of the figure axes.
x_col and show_col must have the same unique entries in data for all groups in being faceted over.
- dmslogo.facet.height_params(nrows, height_per_ax, hspace, tmargin, bmargin)[source]¶
Values to set vertical figure subplots parameters.
- Args:
- nrow (int)
Number of rows
- height_per_ax, hspace, tmargin, bmargin
Same meaning as for
facet_plot()
.
- Returns:
- A dict keyed by:
height: height of figure;
hspace, top, bottom: values for subplots_adjust.