How would I create a specific cmap, which would have a separate color value for each matrix value? For example, could I make a cmap that specifies 0:'red', 1:'green', 2:'yellow', etc? The linear interpolation cmaps don't work as I want them to because they normalize to the given range of the matrix.
I seem to recall once having a slick workaround for this but for the life of me I can't find it now. Anyway, something like this should get the job done:
This should generate one very ugly graph: one red cell, two green cells, three yellow cells, four orange cells, and a brown cell at (6,6) in a purple sea. It's easy to bundle this into a function if you find yourself doing it frequently.
[update: modified to make it slightly more general: now you don't need any ordering relation defined on the matrix elements]
Well, after writing this, I finally found out that we have this capability, though there are no examples in the
This relies on
Still, I'll put some other interesting resources I found below, in case that is too easy, or you need more direction for how to create good colormaps..
Now, these don't do exactly what you want, because the colormaps seem to mostly operate on the principle of the interval $(0,1)$. If we do
So here is something that might work:
posted Dec 20 '10kcrisman
7457 ● 17 ● 76 ● 167
You might check out the
Asked: Dec 19 '10
Seen: 280 times
Last updated: Dec 22 '10
powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.