|
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_DIVERGING_H_
2 #define GENESIS_UTILS_COLOR_NORM_DIVERGING_H_
112 autoscale( values.begin(), values.end() );
119 template <
class ForwardIterator>
158 auto const dist = std::max(
198 throw std::runtime_error(
"Invalid Color Normalization with min >= max." );
201 throw std::runtime_error(
"Invalid Color Normalization with min >= mid." );
204 throw std::runtime_error(
"Invalid Color Normalization with mid >= max." );
216 if( value < mid_value_ ) {
220 pos = ( value - mid_value_ ) / (
max_value() - mid_value_ );
229 mid_value_ = ( min + max ) / 2.0;
238 double mid_value_ = 0.0;
245 #endif // include guard
virtual void update_hook_(double min, double max) override
Called whenever the min and max are set automatically. Gives derived classes a chance to update their...
ColorNormalizationDiverging(ForwardIterator first, ForwardIterator last)
Constructor that sets min() and max() to the min and max of the provided range, and mid() to their mi...
Color normalization for a diverging scale.
ColorNormalizationDiverging(double min, double max)
Constructor that sets min() and max() to the provided values, and mid() to their midpoint.
ColorNormalizationDiverging()
Constructor that sets min == -1.0, mid = 0.0 and max == 1.0.
ColorNormalizationDiverging & make_centric(double center=0.0)
Make the range symmetric around a center value.
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.
Color operators and functions.
double mid_value() const
Mid-point value, that is, where the middle value of a diverging_color() is.
ColorNormalizationDiverging & operator=(ColorNormalizationDiverging const &)=default
virtual void is_valid_or_throw_() const override
Throw if the ranges are incorrect.
virtual ~ColorNormalizationDiverging() override=default
ColorNormalizationDiverging(double min, double mid, double max)
Constructor that sets min(), mid() and max() to the provided values, in that order.
double max_value() const
Minimum value, that is, where to end the color scale.
ColorNormalizationLinear & autoscale(std::vector< double > const &values)
ColorNormalizationDiverging & mid_value(double value)
Mid-point value, that is, where the middle value of a diverging_color() is.
virtual double normalize_(double value) const override
Normalization function.
ColorNormalizationDiverging(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...