颜色绘制不同的颜色matplotlib

颜色绘制不同的颜色matplotlib

问题描述:

Matrix I have created颜色绘制不同的颜色matplotlib

我使用self.ax.imshow(arr,cmap=plt.cm.Greys_r, interpolation = 'none')正如你所看到的情节都是一样的颜色矩阵我在matplotlib绘制。 我怎样才能让情节,不同的颜色,而不是只有黑

+0

更改颜色映射到不是灰色的东西?颜色地图的概述可以在这里找到:http://www.loria.fr/~rougier/teaching/matplotlib/#id49 – Robbert 2013-03-12 15:59:48

+1

@Robbert你可以张贴评论作为一个答案,如何做到这一点? – tacaswell 2013-03-12 16:08:52

+0

可能的重复[颜色某些不同的颜色矩阵matplotlib点](http://*.com/questions/15343923/color-certain-points-a-different-color-matrix-matplotlib) – tacaswell 2013-03-12 16:12:37

正确的链接颜色的地图是:http://www.loria.fr/~rougier/teaching/matplotlib/#colormaps 您指定的春天彩色图是这样的:

self.ax.imshow(arr, cmap = plt.cm.spring, interpolation = 'none')

@ tcaswell当然是正确的,如果你的数据是二进制的,颜色也是二元的。颜色图给不同的z值有不同的颜色。如果你想让右下角的部分与左下角部分不同(或其他),你需要一个不同的解决方案。我猜想有一个散点图。

+0

您也可以在绘图之前将数据弄糟,即。 'tmp_arr = arr * np.arange(np.prod(arr.shape))。reshape(arr.shape)',但是颜色不再具有物理意义,这只是我的错误。 – tacaswell 2013-03-12 16:31:44

+0

与其他问题不同,它不是一个完全不同的解决方案。 – Robbert 2013-03-12 16:57:34