56 std::vector<float> x_val;
57 std::vector<float> y_val;
58 std::vector<float> x_pos;
59 std::vector<float> y_pos;
102 std::string m_xlabel;
105 std::string m_ylabel;
123 virtual ~
Axis() =
default;
125 TRASE_DISPATCH_BACKENDS
134 void xlim(std::array<float, 2> xlimits) {
135 m_limits.
bmin[Aesthetic::x::index] = xlimits[0];
136 m_limits.
bmax[Aesthetic::x::index] = xlimits[1];
140 void ylim(std::array<float, 2> ylimits) {
141 m_limits.
bmin[Aesthetic::y::index] = ylimits[0];
142 m_limits.
bmax[Aesthetic::y::index] = ylimits[1];
146 void xlabel(
const char *
string) { m_xlabel.assign(
string); }
149 void ylabel(
const char *
string) { m_ylabel.assign(
string); }
152 void title(
const char *
string) { m_title.assign(
string); }
155 std::shared_ptr<Legend> legend();
161 std::shared_ptr<Geometry>
169 std::shared_ptr<Geometry>
177 std::shared_ptr<Geometry>
185 std::shared_ptr<Geometry>
193 std::shared_ptr<Geometry> plot(
int n);
195 template <
typename AnimatedBackend>
void draw(
AnimatedBackend &backend);
196 template <
typename Backend>
void draw(
Backend &backend,
float time);
201 return Aesthetic::from_display(i, m_limits, m_pixels);
206 template <
typename Aesthetic>
float to_display(
float i)
const {
207 return Aesthetic::to_display(i, m_limits, m_pixels);
233 std::shared_ptr<Geometry> plot_impl(
const std::shared_ptr<Geometry> &plot,
237 void update_tick_information();
239 void add_geometry_to_legend(
const std::shared_ptr<Geometry> &geometry);
240 std::shared_ptr<Legend> add_legend();
242 template <
typename Backend>
void draw_common(
Backend &backend);
243 template <
typename Backend>
void draw_common_axis_box(
Backend &backend);
244 template <
typename Backend>
void draw_common_ticks(
Backend &backend);
245 template <
typename Backend>
void draw_common_gridlines(
Backend &backend);
246 template <
typename Backend>
void draw_common_title(
Backend &backend);
247 template <
typename Backend>
void draw_common_xlabel(
Backend &backend);
248 template <
typename Backend>
void draw_common_ylabel(
Backend &backend);
253 #include "frontend/Axis.tcc" a base class for all the backends that support drawing a single frame
Definition: Backend.hpp:50
Contains the minimum and maximum extents of a hypercube in D dimensional space.
Definition: BBox.hpp:54
vector_t bmin
minimum point in the box (i.e.
Definition: BBox.hpp:60
An 2D axis that can contain zero or more Geometry objects.
Definition: Axis.hpp:85
float from_display(float i) const
convert from display coordinates to data coordinates, using the given Aesthetic
Definition: Axis.hpp:200
Vector< int, 2 > get_ticks() const
gets the number of ticks on this axis
Definition: Axis.hpp:220
void ylim(std::array< float, 2 > ylimits)
a helper function to set the y Aesthetic limits manually
Definition: Axis.hpp:140
Combination of the RawData class and Aesthetics, this class points to a RawData object, and contains a mapping from aesthetics to RawData column numbers.
Definition: Data.hpp:243
Base class for drawable objects in a figure.
Definition: Drawable.hpp:99
void xlim(std::array< float, 2 > xlimits)
a helper function to set the x Aesthetic limits manually
Definition: Axis.hpp:134
Contains classes and functions for handling data and aesthetics.
Limits & limits()
returns the current Aesthetic limits, allowing them to be set manually
Definition: Axis.hpp:131
bin x coordinates
Definition: Transform.hpp:56
float to_display(float i) const
convert from data coordinates to display coordinates, using the given Aesthetic
Definition: Axis.hpp:206
void xlabel(const char *string)
set the label on the x axis
Definition: Axis.hpp:146
a base class for all the backends that support animation over time
Definition: Backend.hpp:62
Identity transform, just pass through...
Definition: Transform.hpp:47
vector_t bmax
maximum point in the box (i.e.
Definition: BBox.hpp:65
void set_ticks(Vector< int, 2 > arg)
set the number of ticks on this axis
Definition: Axis.hpp:214
void ylabel(const char *string)
set the label on the y axis
Definition: Axis.hpp:149
TRASE_DISPATCH_BACKENDS const Limits & limits() const
returns the current Aesthetic limits
Definition: Axis.hpp:128
A helper struct for Axis that holds tick-related information.
Definition: Axis.hpp:55
Definition: Backend.cpp:39
available geometry types are Points, Line.
void title(const char *string)
set the title of the Axis
Definition: Axis.hpp:152