matplotlib-cpp
matplotlib-cpp copied to clipboard
named_plot: template parameter Numeric
I run into a minor problem using named_plot (https://github.com/lava/matplotlib-cpp/blob/master/matplotlibcpp.h#L1370):
Is it intentional that the function has only one template parameter Numeric that is used for both vectors (X and Y)? In many cases I would prefer to use different types on the X- and Y-axis, e.g., uint32_t on the x-axis and double on the y-axis.
I replaced the lines 1370 and 1371
template<typename Numeric>
bool named_plot(const std::string& name, const std::vector<Numeric>& x, const std::vector<Numeric>& y, const std::string& format = "")
in my version by
template<typename NumericX, typename NumericY>
bool named_plot(const std::string& name, const std::vector<NumericX>& x, const std::vector<NumericY>& y, const std::string& format = "")
This change seems to resolve the issue.