I am playing with matplotlib – I have a bar chart, and I want to highlight the bar which user clicks. I have a callback that goes through a rect collection (the one I got from self.axis.bar(…)) and finds out which one was clicked (looking at the coordinates). At this point I want to call something to change the colour of the current bar. Is it possible? How do I do that?
Edited: I guess the answer I am really looking for is if it’s possible to make bars to have different colours.
You can set the color of individual bars using the Artist properties. Here’s an example: