A toolkit for working with phylogenetic data.
v0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ColorNormalizationDiverging Class Reference

#include <genesis/utils/tools/color/norm_diverging.hpp>

Inherits ColorNormalizationLinear.

Detailed Description

Color normalization for a diverging scale.

The min() and max() values determine the boundaries of the range of allowed values; they map to the first and last entry of the palette, respectively. The mid() value is used as the "neutral" value in the range of allowed values, that is, it maps to the central color of the palette.

In other words, values in [ min, mid ] are mapped to the first half of the palette, and values in [ mid, max ] to the second half:

     palette
   |----|----|
  /      \    \
 /        \    \
 |---------|---|
min      mid  max

Values outside of the allowed range [ min, max ], as well as non-finite values, are treated according to the settings clip_under(), clip_over(), mask_value(), mask_color(), under_color(), over_color().

Definition at line 71 of file norm_diverging.hpp.

Public Member Functions

 ColorNormalizationDiverging ()
 Constructor that sets min == -1.0, mid = 0.0 and max == 1.0. More...
 
 ColorNormalizationDiverging (double min, double max)
 Constructor that sets min() and max() to the provided values, and mid() to their midpoint. More...
 
 ColorNormalizationDiverging (double min, double mid, double max)
 Constructor that sets min(), mid() and max() to the provided values, in that order. More...
 
 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 midpoint. More...
 
template<class ForwardIterator >
 ColorNormalizationDiverging (ForwardIterator first, ForwardIterator last)
 Constructor that sets min() and max() to the min and max of the provided range, and mid() to their midpoint. More...
 
 ColorNormalizationDiverging (ColorNormalizationDiverging const &)=default
 
 ColorNormalizationDiverging (ColorNormalizationDiverging &&)=default
 
virtual ~ColorNormalizationDiverging ()=default
 
virtual bool is_valid_ () const override
 Return whether the ranges are correct. More...
 
ColorNormalizationDivergingmake_centric (double center=0.0)
 Make the range symmetric around a center value. More...
 
double mid_value () const
 Mid-point value, that is, where the middle value of a diverging_color() is. More...
 
ColorNormalizationDivergingmid_value (double value)
 
ColorNormalizationDivergingoperator= (ColorNormalizationDiverging const &)=default
 
ColorNormalizationDivergingoperator= (ColorNormalizationDiverging &&)=default
 
- Public Member Functions inherited from ColorNormalizationLinear
 ColorNormalizationLinear ()=default
 Constructor that sets min == 0.0 and max == 1.0. More...
 
 ColorNormalizationLinear (double min, double max)
 Constructor that sets min() and max() to the provided values. More...
 
 ColorNormalizationLinear (std::vector< double > const &values)
 Constructor that sets min() and max() to the min and max of the provided values. More...
 
template<class ForwardIterator >
 ColorNormalizationLinear (ForwardIterator first, ForwardIterator last)
 Constructor that sets min() and max() to the min and max of the provided range. More...
 
 ColorNormalizationLinear (ColorNormalizationLinear const &)=default
 
 ColorNormalizationLinear (ColorNormalizationLinear &&)=default
 
virtual ~ColorNormalizationLinear ()=default
 
ColorNormalizationLinearautoscale (std::vector< double > const &values)
 
template<class ForwardIterator >
ColorNormalizationLinearautoscale (ForwardIterator first, ForwardIterator last)
 Set the min and max of the Palette so that they reflect the min and max valid values that are found in the range [ first, last ). More...
 
ColorNormalizationLinearautoscale_max (std::vector< double > const &values)
 
template<class ForwardIterator >
ColorNormalizationLinearautoscale_max (ForwardIterator first, ForwardIterator last)
 Same as autoscale(), but only updates the max_value(). More...
 
ColorNormalizationLinearautoscale_min (std::vector< double > const &values)
 
template<class ForwardIterator >
ColorNormalizationLinearautoscale_min (ForwardIterator first, ForwardIterator last)
 Same as autoscale(), but only updates the min_value(). More...
 
double max_value () const
 Minimum value, that is, where to end the color scale. More...
 
ColorNormalizationLinearmax_value (double value)
 
double min_value () const
 Minimum value, that is, where to begin the color scale. More...
 
ColorNormalizationLinearmin_value (double value)
 
ColorNormalizationLinearoperator= (ColorNormalizationLinear const &)=default
 
ColorNormalizationLinearoperator= (ColorNormalizationLinear &&)=default
 
ColorNormalizationLinearscale (double min, double max)
 
- Public Member Functions inherited from ColorNormalization
 ColorNormalization ()=default
 
 ColorNormalization (ColorNormalization const &)=default
 
 ColorNormalization (ColorNormalization &&)=default
 
virtual ~ColorNormalization ()=default
 
bool is_valid () const
 Return whether ranges and other values are correct. More...
 
double mask_value () const
 Mask value that identifies invalid values. More...
 
ColorNormalizationmask_value (double value)
 Mask value that identifies invalid values. More...
 
double operator() (double value) const
 Normalize a value into range [ 0.0, 1.0 ]. More...
 
std::vector< double > operator() (std::vector< double > const &values) const
 Return the normalized values for a vector of values. More...
 
template<class ForwardIterator >
std::vector< double > operator() (ForwardIterator first, ForwardIterator last) const
 Return the normalized values for a range of values. More...
 
ColorNormalizationoperator= (ColorNormalization const &)=default
 
ColorNormalizationoperator= (ColorNormalization &&)=default
 

Protected Member Functions

virtual void is_valid_or_throw_ () const override
 Throw if the ranges are incorrect. More...
 
virtual double normalize_ (double value) const override
 Normalization function. More...
 
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 values. More...
 

Constructor & Destructor Documentation

Constructor that sets min == -1.0, mid = 0.0 and max == 1.0.

Definition at line 83 of file norm_diverging.hpp.

ColorNormalizationDiverging ( double  min,
double  max 
)
inline

Constructor that sets min() and max() to the provided values, and mid() to their midpoint.

Definition at line 92 of file norm_diverging.hpp.

ColorNormalizationDiverging ( double  min,
double  mid,
double  max 
)
inline

Constructor that sets min(), mid() and max() to the provided values, in that order.

Definition at line 99 of file norm_diverging.hpp.

ColorNormalizationDiverging ( std::vector< double > const &  values)
inline

Constructor that sets min() and max() to the min and max of the provided values, and mid() to their midpoint.

Definition at line 110 of file norm_diverging.hpp.

ColorNormalizationDiverging ( ForwardIterator  first,
ForwardIterator  last 
)
inline

Constructor that sets min() and max() to the min and max of the provided range, and mid() to their midpoint.

Definition at line 120 of file norm_diverging.hpp.

virtual ~ColorNormalizationDiverging ( )
virtualdefault

Member Function Documentation

virtual bool is_valid_ ( ) const
inlineoverridevirtual

Return whether the ranges are correct.

Reimplemented from ColorNormalizationLinear.

Definition at line 185 of file norm_diverging.hpp.

virtual void is_valid_or_throw_ ( ) const
inlineoverrideprotectedvirtual

Throw if the ranges are incorrect.

Reimplemented from ColorNormalizationLinear.

Definition at line 195 of file norm_diverging.hpp.

ColorNormalizationDiverging& make_centric ( double  center = 0.0)
inline

Make the range symmetric around a center value.

For example, if autoscale() yielded min == -0.89 and max == 0.95, then calling this function with center == 0.0 sets min == -0.95 and mid == 0.0;

Definition at line 155 of file norm_diverging.hpp.

double mid_value ( ) const
inline

Mid-point value, that is, where the middle value of a diverging_color() is.

Definition at line 140 of file norm_diverging.hpp.

ColorNormalizationDiverging& mid_value ( double  value)
inline

Definition at line 172 of file norm_diverging.hpp.

virtual double normalize_ ( double  value) const
inlineoverrideprotectedvirtual

Normalization function.

Return a value in range [ 0.0, 1.0 ]. Derived classes can override this to provide their specific normalization.

Reimplemented from ColorNormalizationLinear.

Definition at line 208 of file norm_diverging.hpp.

ColorNormalizationDiverging& operator= ( ColorNormalizationDiverging const &  )
default
virtual void update_hook_ ( double  min,
double  max 
)
inlineoverrideprotectedvirtual

Called whenever the min and max are set automatically. Gives derived classes a chance to update their values.

Reimplemented from ColorNormalizationLinear.

Definition at line 227 of file norm_diverging.hpp.


The documentation for this class was generated from the following file: