lib5c.plotters.extendable.ruler_extendable_heatmap module

Module for the RulerExtendableHeatmap class, which adds ruler track plotting functionality for the extendable heatmap system.

class lib5c.plotters.extendable.ruler_extendable_heatmap.RulerExtendableHeatmap(array, grange_x, grange_y=None, colorscale=None, colormap='obs', norm=None)[source]

Bases: lib5c.plotters.extendable.base_extendable_heatmap.BaseExtendableHeatmap

ExtendableHeatmap mixin class providing ruler track plotting functionality.

add_ruler(loc='bottom', size='5%', pad=0.0, new_ax_name='ruler', axis_limits=(1, 0), ruler_tick_height=0.3, ruler_text_baseline=0.5, no_ticks=False, fontsize=7, no_tick_precision=2)[source]

Adds one ruler track along either the x- or y-axis of the heatmap.

Parameters:
  • loc ({'top', 'bottom', 'left', 'right'}) – Which side of the heatmap to add the new ruler track to.
  • size (str) – The size of the new axis as a percentage of the main heatmap width. Should be passed as a string ending in ‘%’.
  • pad (float) – The padding to use between the existing parts of the figure and the newly added axis.
  • new_ax_name (str) – The name for the newly created axis.
  • axis_limits (tuple of float) – Axis limits for the non-genomic axis of the ruler track.
  • ruler_tick_height (float) – The height of the ruler ticks.
  • ruler_text_baseline (float) – Controls how far away from the top of the new axis the text elements (chromosome name and region size) will be drawn.
  • no_ticks (bool) – Pass True to skip plotting ruler ticks, and instead write the start and end coordinate of the plotted region in units of megabase pairs.
  • fontsize (float) – The font size to use for adding labels to the ruler axis.
  • no_tick_precision (int) – When no_ticks is True, round the start and end coordinates of the plotted region to this many digits after the decimal.
Returns:

The newly added ruler track axis.

Return type:

pyplot axis

add_rulers(size='5%', pad=0.0, axis_limits=(1, 0), ruler_tick_height=0.3, ruler_text_baseline=0.5, no_ticks=False, fontsize=7, no_tick_precision=2)[source]

Adds a ruler track to both the bottom and left side of the heatmap by calling add_ruler() twice.

Parameters:
  • size (str) – The size of the new axis as a percentage of the main heatmap width. Should be passed as a string ending in ‘%’.
  • pad (float) – The padding to use between the existing parts of the figure and the newly added axis.
  • axis_limits (tuple of float) – Axis limits for the non-genomic axis of the ruler track.
  • ruler_tick_height (float) – The height of the ruler ticks.
  • ruler_text_baseline (float) – Controls how far away from the top of the new axis the text elements (chromosome name and region size) will be drawn.
  • no_ticks (bool) – Pass True to skip plotting ruler ticks, and instead write the start and end coordinate of the plotted region in units of megabase pairs.
  • fontsize (float) – The font size to use for adding labels to the ruler axis.
  • no_tick_precision (int) – When no_ticks is True, round the start and end coordinates of the plotted region to this many digits after the decimal.
Returns:

The newly added gene ruler axes.

Return type:

list of pyplot axes