INNER CODE UNIT · Python
add_colorscale
widdowquinn/pyani · pyani/pyani_graphics/mpl/__init__.py:265
def add_colorscale(fig, heatmap_gs, ax_map, params, title=None):
"""Add colour scale to heatmap.
:param fig:
:param heatmap_gs:
:param ax_map:
:param params:
:param title:
"""
# Set tick intervals
cbticks = [params.vmin + e * params.vdiff for e in (0, 0.25, 0.5, 0.75, 1)]
if params.vmax > 10:
exponent = int(floor(log10(params.vmax))) - 1
cbticks = [int(round(e, -exponent)) for e in cbticks]
scale_subplot = gridspec.GridSpecFromSubplotSpec(
1, 3, subplot_spec=heatmap_gs[0, 0], wspace=0.0, hspace=0.0
)