A library for working with phylogenetic and population genetic data.
v0.32.0
axis.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_UTILS_FORMATS_SVG_AXIS_H_
2 #define GENESIS_UTILS_FORMATS_SVG_AXIS_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2023 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 
36 
37 #include <map>
38 #include <string>
39 #include <utility>
40 #include <vector>
41 
42 namespace genesis {
43 namespace utils {
44 
45 // =================================================================================================
46 // Svg Axis
47 // =================================================================================================
48 
50 {
51 public:
52 
53  // -------------------------------------------------------------
54  // Typedefs and Enums
55  // -------------------------------------------------------------
56 
57  enum class Position
58  {
59  kLeft,
60  kRight,
61  kTop,
62  kBottom
63  };
64 
65  // -------------------------------------------------------------
66  // Properties
67  // -------------------------------------------------------------
68 
73 
80  double length = 1.0;
81 
88  double offset = 10.0;
89 
93  double tick_size = 8.0;
94 
98  double label_text_size = 10.0;
99 
103  double axis_text_size = 10.0;
104 };
105 
114  SvgAxisSettings const& settings,
115  std::map<double, std::string> const& labels,
116  std::string const& name = ""
117 );
118 
128  SvgAxisSettings const& settings,
129  std::vector<Tickmarks::LabeledTick> const& labels,
130  std::string const& name = "",
131  bool round_labels = true
132 );
133 
134 } // namespace utils
135 } // namespace genesis
136 
137 #endif // include guard
group.hpp
genesis::utils::SvgAxisSettings::Position::kLeft
@ kLeft
genesis::utils::SvgAxisSettings
Definition: axis.hpp:49
genesis::utils::SvgAxisSettings::Position::kRight
@ kRight
genesis::utils::SvgAxisSettings::offset
double offset
Offset from the origin for the axis.
Definition: axis.hpp:88
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::SvgAxisSettings::Position
Position
Definition: axis.hpp:57
genesis::utils::SvgAxisSettings::tick_size
double tick_size
Length of the tick lines drawn from the axis to mark the tick labels.
Definition: axis.hpp:93
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::SvgAxisSettings::position
Position position
Position of the axis, relative to the plot that it is describing.
Definition: axis.hpp:72
genesis::utils::SvgAxisSettings::axis_text_size
double axis_text_size
Size of the text of the axis name.
Definition: axis.hpp:103
genesis::utils::SvgAxisSettings::Position::kBottom
@ kBottom
genesis::utils::make_svg_axis
SvgGroup make_svg_axis(SvgAxisSettings const &settings, std::map< double, std::string > const &labels, std::string const &name)
Simple helper to make an axis.
Definition: axis.cpp:52
genesis::utils::SvgAxisSettings::length
double length
Length of the axis.
Definition: axis.hpp:80
tickmarks.hpp
genesis::utils::SvgAxisSettings::label_text_size
double label_text_size
Size of the text of the tick labels.
Definition: axis.hpp:98
genesis::utils::SvgGroup
Definition: group.hpp:50
genesis::utils::SvgAxisSettings::Position::kTop
@ kTop