onclick method on a colorbar matplotlib python
问题 I have a colorbar and a graph. I was wondering if you can use the onclick method on a colorbar that will then do something on the graph. So click on a particular color portion of the colorer then something happens I know how to do the bit that i want to happen. I just want to know how to set the colorbar to allow on click 回答1: Sure! Just do something like cbar.ax.set_picker(tolerance) . As a quick example, this will highlight values in the image near the value you click on the colorbar: