A toggleable linear/log scale and axis with minor ticks for bqplot
Project Links
Meta
Author: Thomas Robitaille
Requires Python: >=3.10
Classifiers
Development Status
- 3 - Alpha
Framework
- IPython
Intended Audience
- Developers
- Science/Research
Programming Language
- Python :: 3 :: Only
bqplot-linlog
Note: this package is experimental and the API may change.
A toggleable linear/log scale and axis with minor ticks for bqplot, and with improved labels.
Features
- LinLogScale: A scale that can switch between linear and log modes without replacing scale objects
- LinLogAxis: An axis with minor tick support — log mode shows powers-of-10 labels with 10ⁿ notation and standard minor ticks; linear mode shows minor ticks subdividing major intervals
Installation
pip install bqplot-linlog
Usage
from bqplot import Figure, Lines
from bqplot_linlog import LinLogScale, LinLogAxis
scale_x = LinLogScale(mode='linear')
scale_y = LinLogScale(mode='log')
axis_x = LinLogAxis(scale=scale_x, side='bottom')
axis_y = LinLogAxis(scale=scale_y, side='left')
line = Lines(x=x, y=y, scales={'x': scale_x, 'y': scale_y})
figure = Figure(axes=[axis_x, axis_y], marks=[line])
# Toggle at any time:
scale_y.mode = 'linear'