A library for working with phylogenetic and population genetic data.
v0.32.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-2024 Lucas Czech
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 <lczech@carnegiescience.edu>
23
Department of Plant Biology, Carnegie Institution For Science
24
260 Panama Street, Stanford, CA 94305, USA
25
*/
26
34
#include "
genesis/utils/formats/svg/gradient.hpp
"
35
#include "
genesis/utils/formats/svg/group.hpp
"
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
59
struct
SvgColorBarSettings
60
{
61
public
:
62
63
// -------------------------------------------------------------
64
// Typedefs and Enums
65
// -------------------------------------------------------------
66
67
enum class
Direction
68
{
69
kTopToBottom
,
70
kBottomToTop
,
71
kLeftToRight
,
72
kRightToLeft
73
};
74
75
// -------------------------------------------------------------
76
// Properties
77
// -------------------------------------------------------------
78
79
Direction
direction
=
Direction::kBottomToTop
;
80
81
double
width
= 20;
82
double
height
= 200;
83
double
line_width
= 1;
84
85
bool
with_tickmarks
=
true
;
86
bool
with_labels
=
true
;
87
88
size_t
num_ticks
= 5;
89
double
text_size
= 10.0;
90
91
};
92
93
std::pair<SvgGradientLinear, SvgGroup>
make_svg_color_bar
(
94
SvgColorBarSettings
const
& settings,
95
ColorMap
const
& map,
96
ColorNormalization
const
& norm,
97
std::string
const
&
id
=
""
98
);
99
100
SvgGroup
make_svg_color_list
(
101
ColorMap
const
& map,
102
std::vector<std::string>
const
&
labels
103
);
104
105
SvgGroup
make_svg_color_list
(
106
std::vector<Color>
const
& colors,
107
std::vector<std::string>
const
&
labels
108
);
109
110
}
// namespace utils
111
}
// namespace genesis
112
113
#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:325
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:86
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:88
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::SvgColorBarSettings::line_width
double line_width
Definition:
color_bar.hpp:83
genesis::utils::make_svg_color_list
SvgGroup make_svg_color_list(ColorMap const &map, std::vector< std::string > const &labels)
Definition:
color_bar.cpp:376
genesis::utils::SvgColorBarSettings::with_tickmarks
bool with_tickmarks
Definition:
color_bar.hpp:85
genesis::utils::SvgColorBarSettings::width
double width
Definition:
color_bar.hpp:81
genesis::utils::SvgColorBarSettings::text_size
double text_size
Definition:
color_bar.hpp:89
lib
genesis
utils
formats
svg
color_bar.hpp
Generated on Mon Aug 5 2024 16:57:51 for genesis by
1.8.17