forked from alandefreitas/matplotplusplus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror_bar.h
More file actions
90 lines (69 loc) 路 3.13 KB
/
Copy patherror_bar.h
File metadata and controls
90 lines (69 loc) 路 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//
// Created by Alan Freitas on 09/07/20.
//
#ifndef MATPLOTPLUSPLUS_ERROR_BAR_H
#define MATPLOTPLUSPLUS_ERROR_BAR_H
#include <matplot/axes_objects/line.h>
namespace matplot {
class axes_type;
class error_bar : public line {
public:
enum class type { vertical, horizontal, both };
public:
explicit error_bar(class axes_type *parent);
/// Construct with x and y error
error_bar(class axes_type *parent, const std::vector<double> &x,
const std::vector<double> &y,
const std::vector<double> &y_neg_delta,
const std::vector<double> &y_pos_delta,
const std::vector<double> &x_neg_delta,
const std::vector<double> &x_pos_delta,
std::string_view line_spec = "");
/// Construct with y error only
error_bar(class axes_type *parent, const std::vector<double> &x_data,
const std::vector<double> &y_data,
const std::vector<double> &error,
error_bar::type type = error_bar::type::vertical,
std::string_view line_spec = "");
/// If we receive an axes_handle, we can convert it to a raw
/// pointer because there is no ownership of the xlim
template <class... Args>
error_bar(const axes_handle &parent, Args&&... args)
: error_bar(parent.get(), std::forward<Args>(args)...) {}
public /* override the plotting function for error_bar */:
std::string set_variables_string() override;
std::string plot_string() override;
std::string data_string() override;
bool requires_colormap() override;
std::string unset_variables_string() override;
enum axes_object::axes_category axes_category() override;
public /* methods for error_bar only */:
const std::vector<double> &x_negative_delta() const;
class error_bar &
x_negative_delta(const std::vector<double> &x_negative_delta);
const std::vector<double> &x_positive_delta() const;
class error_bar &
x_positive_delta(const std::vector<double> &x_positive_delta);
const std::vector<double> &y_negative_delta() const;
class error_bar &
y_negative_delta(const std::vector<double> &y_negative_delta);
const std::vector<double> &y_positive_delta() const;
class error_bar &
y_positive_delta(const std::vector<double> &y_positive_delta);
float filled_curve_alpha() const;
class error_bar &filled_curve_alpha(float filled_curve_alpha);
bool filled_curve() const;
class error_bar &filled_curve(bool filled_curve);
float cap_size() const;
class error_bar &cap_size(float cap_size);
protected:
std::vector<double> x_negative_delta_{};
std::vector<double> x_positive_delta_{};
std::vector<double> y_negative_delta_{};
std::vector<double> y_positive_delta_{};
bool filled_curve_{false};
float filled_curve_alpha_{0.9f};
float cap_size_{3.};
};
} // namespace matplot
#endif // MATPLOTPLUSPLUS_ERROR_BAR_H