trackc.pl.scale_track#

trackc.pl.scale_track(ax: Axes | None = None, region: str | None = None, tick_pos: str = 'bottom', ratio2ax: float = 0.5, label_fontsize: int | None = 10, scale_adjust: str | None = 'kb', tick_fl: str | None = '%0.2f', tick_fontsize: int | None = 8, tick_rotation: int | None = 0, space: float = 0.1)[source]#

Plot one region scale bar track

Parameters:
  • ax (matplotlib.axes.Axes object) –

  • region (str) –

    one genome region, format: chrom:start-end. e.g. "chr18:45000000-78077248"

    if the start is bigger than end, the genome region will be reversed

  • tick_pos (str) – ticks position, can be one of [‘top’, ‘bottom’]

  • ratio2ax (float) – the height ratio refer to the given ax’s height

  • label_fontsize (int) – the region text fontsize

  • scale_adjust (str) – adjust the scale unit to make it pretty, can be one of [‘kb’, ‘Mb’]

  • tick_fl (str) – ticks retains a few decimal places

  • tick_fontsize (int) – ticks text fontsize

  • tick_rotation (int) – ticks text rotation

  • space (float) – space relative to the ax

Example

>>> import trackc as tc
>>> region = 'chr7:153000000-151000000'
>>> ten = tc.tenon(figsize=(8,1))
>>> ten.add(pos='bottom', height=0.5)
>>> ten.axs(0).axis('off')
>>> tc.pl.scale_track(ax=ten.axs(0), region=region, scale_adjust='Mb', tick_pos='bottom', ratio2ax=1.2)
>>> tc.pl.scale_track(ax=ten.axs(0), region=region, scale_adjust='Mb', tick_pos='top', ratio2ax=1.2)
>>> tc.savefig('trackc_scalebar_track.pdf')