A library for working with phylogenetic and population genetic data.
v0.27.0
color_bar.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_UTILS_FORMATS_SVG_COLOR_BAR_H_
2 #define GENESIS_UTILS_FORMATS_SVG_COLOR_BAR_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2020 Lucas Czech and HITS gGmbH
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lucas.czech@h-its.org>
23  Exelixis Lab, Heidelberg Institute for Theoretical Studies
24  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
25 */
26 
36 
37 #include <map>
38 #include <string>
39 #include <utility>
40 #include <vector>
41 
42 namespace genesis {
43 namespace utils {
44 
45 // =================================================================================================
46 // Forward Declarations
47 // =================================================================================================
48 
49 class ColorMap;
50 class ColorNormalization;
51 class ColorNormalizationDiverging;
52 class ColorNormalizationLinear;
53 class ColorNormalizationLogarithmic;
54 
55 // =================================================================================================
56 // Svg Color Bar
57 // =================================================================================================
58 
60 {
61 public:
62 
63  // -------------------------------------------------------------
64  // Typedefs and Enums
65  // -------------------------------------------------------------
66 
67  enum class Direction
68  {
73  };
74 
75  // -------------------------------------------------------------
76  // Properties
77  // -------------------------------------------------------------
78 
80 
81  double width = 20;
82  double height = 200;
83 
84  bool with_tickmarks = true;
85  bool with_labels = true;
86 
87  size_t num_ticks = 5;
88  double text_size = 12.0;
89 
90 };
91 
92 std::pair<SvgGradientLinear, SvgGroup> make_svg_color_bar(
93  SvgColorBarSettings const& settings,
94  ColorMap const& map,
95  ColorNormalization const& norm,
96  std::string const& id = ""
97 );
98 
100  ColorMap const& map,
101  std::vector<std::string> const& labels
102 );
103 
105  std::vector<Color> const& colors,
106  std::vector<std::string> const& labels
107 );
108 
109 } // namespace utils
110 } // namespace genesis
111 
112 #endif // include guard
genesis::utils::SvgColorBarSettings::Direction::kTopToBottom
@ kTopToBottom
genesis::utils::ColorMap
Store a list of colors and offer them as a map for values in range [ 0.0, 1.0 ].
Definition: map.hpp:61
genesis::utils::make_svg_color_bar
std::pair< SvgGradientLinear, SvgGroup > make_svg_color_bar(SvgColorBarSettings const &settings, ColorMap const &map, ColorNormalization const &norm, std::string const &id)
Definition: color_bar.cpp:324
genesis::utils::SvgColorBarSettings::Direction::kRightToLeft
@ kRightToLeft
genesis::utils::ColorNormalization
Base class for color normalization.
Definition: normalization.hpp:52
genesis::utils::SvgColorBarSettings::direction
Direction direction
Definition: color_bar.hpp:79
genesis::utils::SvgColorBarSettings::with_labels
bool with_labels
Definition: color_bar.hpp:85
genesis::utils::SvgColorBarSettings::Direction::kLeftToRight
@ kLeftToRight
genesis::utils::SvgColorBarSettings::height
double height
Definition: color_bar.hpp:82
genesis::utils::SvgColorBarSettings::num_ticks
size_t num_ticks
Definition: color_bar.hpp:87
group.hpp
genesis::sequence::labels
std::unordered_set< std::string > labels(SequenceSet const &set)
Return a set of all labels of the SequenceSet.
Definition: labels.cpp:64
genesis::utils::SvgColorBarSettings::Direction
Direction
Definition: color_bar.hpp:67
gradient.hpp
genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Definition: placement/formats/edge_color.cpp:42
genesis::utils::SvgColorBarSettings
Definition: color_bar.hpp:59
genesis::utils::SvgColorBarSettings::Direction::kBottomToTop
@ kBottomToTop
genesis::utils::SvgGroup
Definition: group.hpp:50
genesis::utils::make_svg_color_list
SvgGroup make_svg_color_list(ColorMap const &map, std::vector< std::string > const &labels)
Definition: color_bar.cpp:375
genesis::utils::SvgColorBarSettings::with_tickmarks
bool with_tickmarks
Definition: color_bar.hpp:84
genesis::utils::SvgColorBarSettings::width
double width
Definition: color_bar.hpp:81
genesis::utils::SvgColorBarSettings::text_size
double text_size
Definition: color_bar.hpp:88