View Source Contex.ContinuousLogScale (ContEx v0.5.0)
A logarithmic scale to map continuous numeric data to a plotting coordinate system.
This works like Contex.ContinuousLinearScale
, and the
settings are given as keywords.
ContinuousLogScale.new(
domain: {0, 100},
tick_positions: [0, 5, 10, 15, 30, 60, 120, 240, 480, 960],
log_base: :base_10,
negative_numbers: :mask,
linear_range: 1
)
Logarithm
log_base
is the logarithm base. Defaults to 2. Can be set to:base_2
,:base_e
or:base_10
.negative_numbers
controls how negative numbers are represented. It can be::mask
: always return 0:clip
: always returns 0:sym
: logarithms are drawn symmetrically, that is, the log of a number n when n < 0 is -log(abs(n))
linear_range
is a range -if any- where results are not logarithmical
Data domain
Unfortunately, a domain must be given for all custom scales. To make your life easier, you can either:
domain: {0, 27}
will set an explicit domain, ordataset
andaxis
let you specify a Dataset and one or a list of axes, and the domain will be computed out of them all.
Ticks
interval_count
divides the interval inn
linear slices, ortick_positions
can receive a list of explicit possible ticks, that will be displayed ony if they are within the domain area.custom_tick_formatter
is a function to be applied to the ticks.
Link to this section Summary
Functions
Computes the correct domain {a, b}.
Translates a value into its logarithm, given the mode and an optional linear part.
Creates a new scale with defaults.
Fixes inconsistencies and scales.
Link to this section Types
Link to this section Functions
Link to this function
get_domain(requested_domain, requested_dataset, requested_columns)
View SourceComputes the correct domain {a, b}.
- If it is explicitly passed, we use it.
- If there is a dataset and a column or a list of columns, we use that
- If all else fails, we use {0, 1}
Translates a value into its logarithm, given the mode and an optional linear part.
Creates a new scale with defaults.
Fixes inconsistencies and scales.