-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance and safety improvements #429
base: master
Are you sure you want to change the base?
Changes from all commits
4761ab1
b5906e2
1f5d92c
29460e0
86b1dc7
c7e74d5
93a0ff5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -426,7 +426,7 @@ namespace matplot { | |
run_command("set polar"); | ||
} | ||
auto set_or_unset_axis = [this](class axis_type &ax, | ||
std::string axis_name, | ||
const std::string &axis_name, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If that was your concern about breaking the API, both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No concerns here: that is just a lambda expression - internal stuff. |
||
bool minor_ticks = false) { | ||
// cb is the only axis we don't unset if tics are empty | ||
// r-axis labels should still be handled even if axis is invisible since we use the grid | ||
|
@@ -694,10 +694,7 @@ namespace matplot { | |
// Gnuplot version needs to be 5.2.6+ for keyentry | ||
bool ok = true; | ||
if (parent_->backend_->consumes_gnuplot_commands()) { | ||
if (backend::gnuplot::gnuplot_version() < | ||
std::tuple<int, int, int>{5, 2, 6}) { | ||
ok = false; | ||
} | ||
ok = backend::gnuplot::gnuplot_supports_keyentry(); | ||
} | ||
if (legend_ == nullptr || !legend_->visible() || !ok) { | ||
run_command("set key off"); | ||
|
@@ -916,9 +913,7 @@ namespace matplot { | |
static bool msg_shown_once = false; | ||
// Gnuplot version needs to be 5.2.6+ for keyentry | ||
if (parent_->backend_->consumes_gnuplot_commands()) { | ||
std::tuple<int, int, int> v = | ||
backend::gnuplot::gnuplot_version(); | ||
if (v < std::tuple<int, int, int>{5, 2, 6}) { | ||
if (backend::gnuplot::gnuplot_includes_legends()) { | ||
if (!msg_shown_once) { | ||
std::cerr | ||
<< "You need gnuplot 5.2.6+ to include legends" | ||
|
@@ -2745,9 +2740,9 @@ namespace matplot { | |
} | ||
|
||
std::vector<function_line_handle> | ||
axes_type::fplot(std::vector<function_line::function_type> equations, | ||
std::array<double, 2> x_range, | ||
std::vector<std::string> line_specs) { | ||
axes_type::fplot(const std::vector<function_line::function_type> &equations, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. All these API changes are OK. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's OK if the thing is recompiled, but I am not sure at ABI level, and I do not know if anyone cares. |
||
const std::array<double, 2> &x_range, | ||
const std::vector<std::string> &line_specs) { | ||
axes_silencer temp_silencer_{this}; | ||
std::vector<function_line_handle> res; | ||
auto it_line_specs = line_specs.begin(); | ||
|
@@ -2764,9 +2759,9 @@ namespace matplot { | |
} | ||
|
||
std::vector<function_line_handle> | ||
axes_type::fplot(std::vector<function_line::function_type> equations, | ||
std::vector<double> x_range, | ||
std::vector<std::string> line_specs) { | ||
axes_type::fplot(const std::vector<function_line::function_type>& equations, | ||
const std::vector<double>& x_range, | ||
const std::vector<std::string>& line_specs) { | ||
return this->fplot(equations, to_array<2>(x_range), line_specs); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -633,9 +633,7 @@ namespace matplot { | |
void figure_type::run_window_color_command() { | ||
// In gnuplot 5.5 we have the wall function to set the axes color | ||
// with a rectangle workaround, which does not work well for 3d. | ||
static const auto v = backend::gnuplot::gnuplot_version(); | ||
const bool has_wall_option = | ||
std::get<0>(v) > 5 || (std::get<0>(v) == 5 && std::get<1>(v) >= 5); | ||
Comment on lines
-637
to
-638
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was my trigger :-) |
||
const bool has_wall_option = backend::gnuplot::gnuplot_has_wall_option(); | ||
// So we only plot the default background if it's not 3d or version is | ||
// higher than 5.5. Otherwise, gnuplot won't be able to set the axes | ||
// colors. | ||
|
@@ -895,4 +893,4 @@ namespace matplot { | |
|
||
bool figure_type::should_close() { return backend_->should_close(); } | ||
|
||
} // namespace matplot | ||
} // namespace matplot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh... Great! :)