alandefreitas / matplotplusplus

Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
https://alandefreitas.github.io/matplotplusplus/
MIT License
4.11k stars 313 forks source link

[Bug] scatter( ) can only take 4 arguments, not less #240

Open ianyepan opened 2 years ago

ianyepan commented 2 years ago

Bug category

Describe the bug

According to the documentation, scatter( ) should be able to take either 2, 3, or 4 arguments (size and colors should be optional). However, the compiler tells me that there's no matching function call if I don't pass in all 4 arguments.

Steps to Reproduce

Install matplotplusplus with yay -S matplotplusplus. Inside CMakeLlists.txt, use find_package to find this external package.

# Your steps go here
mkdir build
cd build
cmake ..
make
./a.out

Output

```console Consolidate compiler generated dependencies of target a.out [ 50%] Building CXX object CMakeFiles/a.out.dir/hw5.cpp.o In file included from /usr/include/matplot/matplot.h:49, from /home/yep808/Homework (Arch WSL)/C++/vector_list/hw5.cpp:1: /usr/include/matplot/freestanding/plot.h: In instantiation of ‘auto matplot::scatter(matplot::NotAxesHandle, Args&& ...) [with T1 = std::vector; Args = {std::vector >&, int}; matplot::NotAxesHandle = std::vector]’: /home/yep808/Homework (Arch WSL)/C++/vector_list/hw5.cpp:114:10: required from here /usr/include/matplot/freestanding/plot.h:303:30: error: no matching function for call to ‘matplot::axes_type::scatter(matplot::NotAxesHandle >&, std::vector&, int)’ 303 | return gca()->scatter(x, std::forward(args)...); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/matplot/matplot.h:22, from /home/yep808/Homework (Arch WSL)/C++/vector_list/hw5.cpp:1: /usr/include/matplot/core/axes_type.h:2168:21: note: candidate: ‘template matplot::line_handle matplot::axes_type::scatter(matplot::IterableValues&, matplot::IterableValues&, matplot::IterableValues&, matplot::IterableValues&)’ 2168 | line_handle scatter(const IterableValues &x, | ^~~~~~~ /usr/include/matplot/core/axes_type.h:2168:21: note: template argument deduction/substitution failed: In file included from /usr/include/matplot/matplot.h:49, from /home/yep808/Homework (Arch WSL)/C++/vector_list/hw5.cpp:1: /usr/include/matplot/freestanding/plot.h:303:30: note: couldn’t deduce template parameter ‘T4’ 303 | return gca()->scatter(x, std::forward(args)...); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/matplot/matplot.h:22, from /home/yep808/Homework (Arch WSL)/C++/vector_list/hw5.cpp:1: /usr/include/matplot/core/axes_type.h:2177:21: note: candidate: ‘template matplot::line_handle matplot::axes_type::scatter(matplot::IterableValues&, matplot::IterableValues&, double, matplot::IterableValues&)’ 2177 | line_handle scatter(const IterableValues &x, | ^~~~~~~ /usr/include/matplot/core/axes_type.h:2177:21: note: template argument deduction/substitution failed: In file included from /usr/include/matplot/matplot.h:49, from /home/yep808/Homework (Arch WSL)/C++/vector_list/hw5.cpp:1: /usr/include/matplot/freestanding/plot.h:303:30: note: couldn’t deduce template parameter ‘T3’ 303 | return gca()->scatter(x, std::forward(args)...); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/matplot/matplot.h:22, from /home/yep808/Homework (Arch WSL)/C++/vector_list/hw5.cpp:1: /usr/include/matplot/core/axes_type.h:1136:21: note: candidate: ‘matplot::line_handle matplot::axes_type::scatter(const std::vector&, const std::vector&, const std::vector&, const std::vector&)’ 1136 | line_handle scatter(const std::vector &x, | ^~~~~~~ /usr/include/matplot/core/axes_type.h:1136:56: note: no known conversion for argument 1 from ‘matplot::NotAxesHandle >’ {aka ‘std::vector’} to ‘const std::vector&’ 1136 | line_handle scatter(const std::vector &x, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ /usr/include/matplot/core/axes_type.h:1142:21: note: candidate: ‘matplot::line_handle matplot::axes_type::scatter(const std::vector&, const std::vector&, double, const std::vector&)’ 1142 | line_handle scatter(const std::vector &x, | ^~~~~~~ /usr/include/matplot/core/axes_type.h:1142:56: note: no known conversion for argument 1 from ‘matplot::NotAxesHandle >’ {aka ‘std::vector’} to ‘const std::vector&’ 1142 | line_handle scatter(const std::vector &x, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ make[2]: *** [CMakeFiles/a.out.dir/build.make:76: CMakeFiles/a.out.dir/hw5.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/a.out.dir/all] Error 2 make: *** [Makefile:91: all] Error 2 ```

Platform

Environment Details:

Additional context

I suspect that the AUR holds an outdated version of the package, that's why there's no variation flexibility in function arguments. Please consider updating the package in AUR.