[Tutor] Matplotlib Slider Widget and changing colorbar threshold

Alan Gauld alan.gauld at btinternet.com
Tue Mar 12 16:44:35 CET 2013


On 12/03/13 14:10, Kevin Khan wrote:
> I am currently trying to work on a program that will allow the user to
> display their dataset in the form of a colormap and through the use of
> sliders, it will also allow the user to adjust the threshold of the
> colormap and thus update the colormap accordingly.


> Now I am mainly using matplotlib and I found that matplotlib does
> support some widgets, such as a slider.  However the area I need help in
> is devising a piece of code which will update the colorbar and colormap

Matplotlib usually just reflects the underlying data so you need to 
adjust the data values that control the colours and matplotlib will 
change the display (you may need to force a refresh).

I've not done exactly what you are asking but I have done conceptually 
similar things with network maps where nodes change color depending on 
the numbers of alarms they have generated (usually, red, amber, green).

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list