45 #include <unordered_map> 58 std::vector<float> m_matrix;
61 std::vector<std::set<std::string>> m_string_data;
64 std::vector<float> m_tmp;
71 int cols()
const {
return m_cols; };
74 int rows()
const {
return m_rows; };
78 template <
typename T>
void add_column(T new_col_begin, T new_col_end);
82 template <
typename T>
void add_row(T new_row_begin, T new_row_end);
86 template <
typename T>
void add_column(
const std::vector<T> &new_col);
90 template <
typename T>
void add_row(
const std::vector<T> &new_row);
94 template <
typename T>
void set_column(
int i,
const std::vector<T> &new_col);
105 const std::set<std::string> &
string_data(
int i)
const;
112 template <
typename T>
113 std::map<T, std::shared_ptr<RawData>>
facet(
const std::vector<T> &data)
const;
120 template <
typename T1,
typename T2>
121 std::map<std::pair<T1, T2>, std::shared_ptr<RawData>>
122 facet(
const std::vector<T1> &data1,
const std::vector<T2> &data2)
const;
132 static const int N = 9;
140 static const int index = 0;
141 static const char *name;
142 static float to_display(
float data,
const Limits &data_lim,
144 static float from_display(
float display,
const Limits &data_lim,
150 static const int index = 1;
151 static const char *name;
152 static float to_display(
float data,
const Limits &data_lim,
154 static float from_display(
float display,
const Limits &data_lim,
160 static const int index = 2;
161 static const char *name;
163 static float to_display(
float data,
const Limits &data_lim,
165 static float from_display(
float display,
const Limits &data_lim,
172 static const int index = 3;
173 static const char *name;
175 static float to_display(
float data,
const Limits &data_lim,
177 static float from_display(
float display,
const Limits &data_lim,
183 static const int index = 4;
184 static const char *name;
186 static float to_display(
float data,
const Limits &data_lim,
188 static float from_display(
float display,
const Limits &data_lim,
197 static const int index = 5;
198 static const char *name;
199 static float to_display(
float data,
const Limits &data_lim,
201 static float from_display(
float display,
const Limits &data_lim,
207 static const int index = 6;
208 static const char *name;
209 static float to_display(
float data,
const Limits &data_lim,
211 static float from_display(
float display,
const Limits &data_lim,
217 static const int index = 7;
218 static const char *name;
219 static float to_display(
float data,
const Limits &data_lim,
221 static float from_display(
float display,
const Limits &data_lim,
227 static const int index = 8;
228 static const char *name;
229 static float to_display(
float data,
const Limits &data_lim,
231 static float from_display(
float display,
const Limits &data_lim,
245 std::shared_ptr<RawData> m_data;
248 std::unordered_map<int, int> m_map;
257 : m_data(std::move(data)) {}
260 const std::unordered_map<int, int> &map,
262 : m_data(std::move(data)), m_map(map), m_limits(limits) {}
276 template <
typename Aesthetic,
typename T>
277 void set(
const std::vector<T> &data);
283 template <
typename Aesthetic>
void set(
float min,
float max);
286 template <
typename Aesthetic>
bool has()
const;
295 const Limits &limits()
const;
329 template <
typename T>
330 std::map<T, DataWithAesthetic>
facet(
const std::vector<T> &data)
const;
337 template <
typename T1,
typename T2>
339 facet(
const std::vector<T1> &data1,
const std::vector<T2> &data2)
const;
342 template <
typename Aesthetic,
typename T>
343 void calculate_limits(T begin, T end);
int cols() const
return the number of columns
Definition: Data.hpp:71
Contains the minimum and maximum extents of a hypercube in D dimensional space.
Definition: BBox.hpp:54
the color of each plotting element, scaled from 0 -> 1
Definition: Data.hpp:159
void add_column(T new_col_begin, T new_col_end)
add a new column to the matrix using begin/end iterators.
ColumnIterator end(int i) const
return a ColumnIterator to the end of column i
Definition: Data.cpp:57
bbox< float, N - 4 > Limits
all aethetics except for xmin,ymin,xmax,ymax have their own min/max bounds
Definition: Data.hpp:136
ColumnIterator begin(int i) const
return a ColumnIterator to the beginning of column i
Definition: Data.cpp:50
Aesthetics are a collection of tag classes that represent each aesthetic Each aesthetic has a name...
Definition: Data.hpp:130
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
const std::set< std::string > & string_data(int i) const
return the set of strings for column i
Definition: Data.cpp:64
the fill color of each plotting element, scaled from 0 -> 1
Definition: Data.hpp:182
the maximum y coordinate of the data
Definition: Data.hpp:226
the maximum x coordinate of the data
Definition: Data.hpp:216
the size of each plotting element, scaled from 1 pixel to 1/20 size of y-axis
Definition: Data.hpp:171
void add_row(T new_row_begin, T new_row_end)
add a new row to the matrix using begin/end iterators.
the minimum y coordinate of the data
Definition: Data.hpp:206
std::map< T, std::shared_ptr< RawData > > facet(const std::vector< T > &data) const
facets the data based on the input data column
the minimum x coordinate of the data
Definition: Data.hpp:196
void set_column(int i, const std::vector< T > &new_col)
set a column in the matrix.
the data to display on the y-axis of the plot
Definition: Data.hpp:149
Raw data class, impliments a matrix with row major order.
Definition: Data.hpp:56
A const iterator that iterates through a single column of the raw data class Impliments an random acc...
Definition: ColumnIterator.hpp:45
Definition: Backend.cpp:39
the data to display on the x-axis of the plot
Definition: Data.hpp:139
int rows() const
return the number of rows
Definition: Data.hpp:74