ScaleBar¶
lumicks.pylake.ScaleBar
- class ScaleBar(size_x: ~typing.Optional[float] = None, size_y: ~typing.Optional[float] = None, label_x: ~typing.Optional[str] = None, label_y: ~typing.Optional[str] = None, loc: ~typing.Union[str, int] = 'upper right', color: str = 'white', separation: ~typing.Optional[float] = 2.0, barwidth: ~typing.Optional[float] = None, fontsize: ~typing.Optional[float] = None, kwargs: dict = <factory>)¶
Draws a scale legend for the current axis.
- Parameters:
size_x (float or None) – Width of the scale bars in data units.
0
orNone
omits the scale.size_y (float or None) – Width of the scale bars in data units.
0
orNone
omits the scale.label_x (str or None) – Labels for the scale bars. None results in no label on the scale.
label_y (str or None) – Labels for the scale bars. None results in no label on the scale.
loc (position in the containing axis) – Valid locations are ‘upper left’, ‘upper center’, ‘upper right’, ‘center left’, ‘center’, ‘center right’, ‘lower left’, ‘lower center’, ‘lower right’.
color (Matplotlib color) – Color to use for the text and labels.
separation (float) – separation between labels and bars in points.
bar_width (float or None) – Width of the scale bar(s)
fontsize (float or None) – Font size to use for the labels.
**kwargs – additional arguments passed to
matplotlib.offsetbox.AnchoredOffsetBox
.
Examples
import lumicks.pylake as lk # Loading a kymograph. h5_file = pylake.File("example.h5") _, kymo = h5_file.kymos.popitem() # Show default scale bar kymo.plot("green", scale_bar=lk.ScaleBar()) plt.show() # Show scale bar with a scale of 10 seconds on the x axis kymo.plot("green", scale_bar=lk.ScaleBar(size_x=10)) plt.show()