matplotlib-cpp icon indicating copy to clipboard operation
matplotlib-cpp copied to clipboard

how to use colorbar?

Open gaopeng-nreal opened this issue 3 years ago • 1 comments

Thanks a lot for your work, I'm new to c++ and ran into this problem. When I draw a heat map, using colorbar, I get an error like this: what(): Must call colorbar with PyObject* returned from an image, contour, surface, etc.

this is my code: matplotlibcpp::imshow((float*)a,20,27,1); matplotlibcpp::colorbar(); matplotlibcpp::show();

gaopeng-nreal avatar May 12 '22 02:05 gaopeng-nreal

solved PyObject* mat; matplotlibcpp::imshow((float*)a,20,27,1,{},&mat); matplotlibcpp::colorbar(mat);

gaopeng-nreal avatar May 12 '22 02:05 gaopeng-nreal