A library for working with phylogenetic and population genetic data.
v0.32.0
ColorNormalizationDiverging Class Reference

#include <genesis/utils/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 (ColorNormalizationDiverging &&)=default
 
 ColorNormalizationDiverging (ColorNormalizationDiverging const &)=default
 
 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...
 
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 (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...
 
virtual ~ColorNormalizationDiverging () override=default
 
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)
 Mid-point value, that is, where the middle value of a diverging_color() is. More...
 
ColorNormalizationDivergingoperator= (ColorNormalizationDiverging &&)=default
 
ColorNormalizationDivergingoperator= (ColorNormalizationDiverging const &)=default
 
- Public Member Functions inherited from ColorNormalizationLinear
 ColorNormalizationLinear ()=default
 Constructor that sets min == 0.0 and max == 1.0. More...
 
 ColorNormalizationLinear (ColorNormalizationLinear &&)=default
 
 ColorNormalizationLinear (ColorNormalizationLinear const &)=default
 
 ColorNormalizationLinear (double min, double max)
 Constructor that sets min() and max() to 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 (std::vector< double > const &values)
 Constructor that sets min() and max() to the min and max of the provided values. More...
 
virtual ~ColorNormalizationLinear () override=default
 
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 (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_max (std::vector< double > const &values)
 
template<class ForwardIterator >
ColorNormalizationLinearautoscale_min (ForwardIterator first, ForwardIterator last)
 Same as autoscale(), but only updates the min_value(). More...
 
ColorNormalizationLinearautoscale_min (std::vector< double > const &values)
 
double max_value () const
 Minimum value, that is, where to end the color scale. More...
 
ColorNormalizationLinearmax_value (double value)
 Minimum value, that is, where to end the color scale. More...
 
double min_value () const
 Minimum value, that is, where to begin the color scale. More...
 
ColorNormalizationLinearmin_value (double value)
 Minimum value, that is, where to begin the color scale. More...
 
ColorNormalizationLinearoperator= (ColorNormalizationLinear &&)=default
 
ColorNormalizationLinearoperator= (ColorNormalizationLinear const &)=default
 
ColorNormalizationLinearscale (double min, double max)
 
- Public Member Functions inherited from ColorNormalization
 ColorNormalization ()=default
 
 ColorNormalization (ColorNormalization &&)=default
 
 ColorNormalization (ColorNormalization const &)=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...
 
template<class ForwardIterator >
std::vector< double > operator() (ForwardIterator first, ForwardIterator last) const
 Return the normalized values for a range of values. More...
 
std::vector< double > operator() (std::vector< double > const &values) const
 Return the normalized values for a vector of values. More...
 
ColorNormalizationoperator= (ColorNormalization &&)=default
 
ColorNormalizationoperator= (ColorNormalization const &)=default
 

Protected Member Functions

virtual bool is_valid_ () const override
 Return whether the ranges are correct. More...
 
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...
 
- Protected Member Functions inherited from ColorNormalizationLinear
template<class ForwardIterator >
ColorNormalizationLinearautoscale_ (ForwardIterator first, ForwardIterator last, bool set_min, bool set_max)
 

Constructor & Destructor Documentation

◆ ColorNormalizationDiverging() [1/7]

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

Definition at line 83 of file norm_diverging.hpp.

◆ ColorNormalizationDiverging() [2/7]

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() [3/7]

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() [4/7]

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

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() [5/7]

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.

◆ ~ColorNormalizationDiverging()

virtual ~ColorNormalizationDiverging ( )
overridevirtualdefault

◆ ColorNormalizationDiverging() [6/7]

◆ ColorNormalizationDiverging() [7/7]

Member Function Documentation

◆ is_valid_()

virtual bool is_valid_ ( ) const
inlineoverrideprotectedvirtual

Return whether the ranges are correct.

Reimplemented from ColorNormalizationLinear.

Definition at line 187 of file norm_diverging.hpp.

◆ is_valid_or_throw_()

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.

◆ make_centric()

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.

◆ mid_value() [1/2]

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.

◆ mid_value() [2/2]

ColorNormalizationDiverging& mid_value ( double  value)
inline

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

Definition at line 172 of file norm_diverging.hpp.

◆ normalize_()

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.

◆ operator=() [1/2]

◆ operator=() [2/2]

ColorNormalizationDiverging& operator= ( ColorNormalizationDiverging const &  )
default

◆ update_hook_()

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: