Skip to content

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

Open
@ianyepan

Description

@ianyepan

Bug category

  • bug - compilation error
  • bug - compilation warning
  • bug - runtime error
  • bug - runtime warning
  • bug - logic error

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

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<T>, Args&& ...) [with T1 = std::vector<long unsigned int>; Args = {std::vector<double, std::allocator<double> >&, int}; matplot::NotAxesHandle<T> = std::vector<long unsigned int>]’:
/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<long unsigned int> >&, std::vector<double>&, int)’
  303 |         return gca()->scatter(x, std::forward<Args>(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<class T1, class T2, class T3, class T4> matplot::line_handle matplot::axes_type::scatter(matplot::IterableValues<T1>&, matplot::IterableValues<T2>&, matplot::IterableValues<T3>&, matplot::IterableValues<T4>&)’
 2168 |         line_handle scatter(const IterableValues<T1> &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>(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<class T1, class T2, class T3> matplot::line_handle matplot::axes_type::scatter(matplot::IterableValues<T1>&, matplot::IterableValues<T2>&, double, matplot::IterableValues<T3>&)’
 2177 |         line_handle scatter(const IterableValues<T1> &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>(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<double>&, const std::vector<double>&, const std::vector<double>&, const std::vector<double>&)’
 1136 |         line_handle scatter(const std::vector<double> &x,
      |                     ^~~~~~~
/usr/include/matplot/core/axes_type.h:1136:56: note:   no known conversion for argument 1 from ‘matplot::NotAxesHandle<std::vector<long unsigned int> >’ {aka ‘std::vector<long unsigned int>’} to ‘const std::vector<double>&’
 1136 |         line_handle scatter(const std::vector<double> &x,
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/usr/include/matplot/core/axes_type.h:1142:21: note: candidate: ‘matplot::line_handle matplot::axes_type::scatter(const std::vector<double>&, const std::vector<double>&, double, const std::vector<double>&)’
 1142 |         line_handle scatter(const std::vector<double> &x,
      |                     ^~~~~~~
/usr/include/matplot/core/axes_type.h:1142:56: note:   no known conversion for argument 1 from ‘matplot::NotAxesHandle<std::vector<long unsigned int> >’ {aka ‘std::vector<long unsigned int>’} to ‘const std::vector<double>&’
 1142 |         line_handle scatter(const std::vector<double> &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

  • cross-platform issue - linux
  • cross-platform issue - windows
  • cross-platform issue - macos

Environment Details:

  • OS: Arch Linux (Windows 11 WSL2)
  • OS Version: KERNEL: Linux 5.10.60.1-microsoft-standard-WSL2
  • Compiler: g++
  • Compiler version: g++ (GCC) 11.2.0

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions