|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_UTILS_COLOR_NORM_LOGARITHMIC_H_
2 #define GENESIS_UTILS_COLOR_NORM_LOGARITHMIC_H_
81 autoscale( values.begin(), values.end() );
88 template <
class ForwardIterator>
148 throw std::runtime_error(
"Invalid Color Normalization with min >= max" );
151 throw std::runtime_error(
"Invalid Color Normalization with min <= 0.0" );
173 assert( 0.0 < value );
176 auto const lg_min = std::log(
min_value() ) / std::log( base_ );
177 auto const lg_max = std::log(
max_value() ) / std::log( base_ );
178 auto const lg_val = std::log( value ) / std::log( base_ );
179 return ( lg_val - lg_min ) / ( lg_max - lg_min );
189 bool exp_labels_ =
false;
196 #endif // include guard
Color normalization for a logarithmic scale.
ColorNormalizationLogarithmic(double min, double max)
Constructor that sets min() and max() to the provided values.
ColorNormalizationLogarithmic(ForwardIterator first, ForwardIterator last)
Constructor that sets min() and max() to the min and max of the provided range, and mid() to their mi...
ColorNormalizationLogarithmic & exponential_labels(bool value)
ColorNormalizationLogarithmic(std::vector< double > const &values)
Constructor that sets min() and max() to the min and max of the provided values, and mid() to their m...
virtual ~ColorNormalizationLogarithmic() override=default
bool exponential_labels() const
ColorNormalizationLogarithmic & base(double value)
ColorNormalizationLogarithmic & operator=(ColorNormalizationLogarithmic const &)=default
virtual void is_valid_or_throw_() const override
Throw if the ranges are incorrect.
double min_value() const
Minimum value, that is, where to begin the color scale.
Default Color normalization, using a sequential linear scaling in the range [ min,...
virtual bool is_valid_() const override
Return whether the ranges are correct.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
virtual double normalize_(double value) const override
Normalization function.
double max_value() const
Minimum value, that is, where to end the color scale.
ColorNormalizationLinear & autoscale(std::vector< double > const &values)
ColorNormalizationLogarithmic()
Constructor that sets min == 1.0 and max == 100.0.