line

Draw line plots of site-level properties.

dmslogo.line.data_units_from_linewidth(linewidth, ax, reference)[source]

Convert linewidth in points to data units.

Args:
linewidth (float)

Linewidth in points.

ax (matplotlib axis)

The axis used to extract the relevant transformation (data limits and size must not change afterwards).

reference (str)

The axis that is taken as a reference for the data width. Possible values: ‘x’ and ‘y’.

Returns

Linewidth in data units.

Function is the inverse of the one defined here: https://stackoverflow.com/a/35501485

dmslogo.line.draw_line(data, *, x_col, height_col, height_col2=None, xtick_col=None, show_col=None, xlabel=None, ylabel=None, title=None, color='black', color2='gray', show_color='#E69F00', linewidth=1, widthscale=1, heightscale=1, axisfontscale=1, hide_axis=False, ax=None, ylim_setter=None, fixed_ymin=None, fixed_ymax=None)[source]

Draw line plot.

Args:
data (pandas DataFrame)

Holds data to plot. If there are duplicate rows for the columns of interest, removes duplicates.

height_col (str)

Column in data with line height.

height_col2 (str or None)

Optional second column in data giving second line height. This is typically useful when height_col has positive values and you also want to plot negative values: those can be in height_col2.

x_col (str)

Column in data with integer site numbers. Must be full set of sequential numbers, gaps in numbering not allowed.

xtick_col (None or str)

Column in data used to label sites if not using x_col.

show_col (None or str)

Underline sites where this column is True. Useful for marking selected sites that are zoomed in logo plots.

xlabel (None or str)

Label for x-axis if not using xtick_col or x_col.

ylabel (None or str)

Label for y-axis if not using height_col.

title (None or str)

Title to place above plot.

color (str)

Color of line plotting data in height_col.

color2 (str)

Color of line plotting any data in height_col2.

show_color (str or None)

Color of underlines specified by show_col, or None if you don’t want to show underlines.

linewidth (float)

Width of line.

widthscale (float)

Scale width by this much.

heightscale (float)

Scale height by this much.

axisfontscale (float)

Scale size of font for axis ticks and labels by this much.

hide_axis (bool)

Do we hide the axis and tick labels?

ax (None or matplotlib axes.Axes object)

Use to plot on an existing axis.

ylim_setter (None or dmslogo.utils.AxLimSetter)

Object used to set y-limits. If None, a dmslogo.utils.AxLimSetter is created using default parameters). If fixed_ymin and/or fixed_ymax are set, they override the limits from this setter.

fixed_ymin (None or float)

If not None, then fixed y-axis minimum.

fixed_ymax (None or float)

If not None, then fixed y-axis maximum.

Returns:

The 2-tuple (fig, ax) giving the figure and axis.