Hi,

I have been using matplotlib for about 2 weeks now. I thought it would be
good to try plotting heatmaps to show some data.

The idea:

I have 100 values all ranging from 0.00 to 1.00, I would like to create a
graph with a 10 by 10 grid. Therefore each value has 1 section of the grid.

So, for example if the value was 0.10, the colour would be blue, or if 0.95,
the colour red.

Now the problem is I do not know how to access each individual grid
position, I guess I would have some form of counter system to count 0 -> 9
on the X axis and 0 -> 9 on the Y also.

Here is my pseudo code:

##########################################

Count1 = 0   ## For the X axis
Count2 = 0   ## For the Y axis
Max = 0       ## To count 0 - 99

ListValues = [0.11, 0.09, 0.34, 0.44, 0.29,.... all the way to 100 values]

while Max < 100:

        if Count1 == 10:                   
                Count2 = Count2 + 1     ## Increase the Y axis by one
                Count1 = 0                  ## If X axis counter = 10, reset it 
to 0
        else:
                GridPosition = []
                GridPosition.append(Count1)
                GridPosition.append(Count2)
                GridValue = ListValues[Max]
                
                # Now armed with the GridPosition and GridValue, im stuck on
how to plot the square...

##########################################

So as you can see from above, I have the data ready to fill the relevant
grid position, just unsure on how to actually do it!

Just to clarify, this is a heatmap, so the GridValue should correspond to a
colour and fill that particular square with the colour from the colorbar
i.e.

levels = arange(0.0, 1.0, 0.025)

Thank you in advance for any help.
-- 
View this message in context: 
http://www.nabble.com/Contour-Contourf-Plot-Heatmap---Grid---Multiple-Items-tp18872991p18872991.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to