开发者

drawing just half of a matrix in matplotlib with python

How can I draw only half of a matrix, e.g. the开发者_StackOverflow upper / lower part of a matrix, with pcolor for example?

Suppose I have a n x n matrix and I draw it using pcolor(my_matrix). I want only the lower half to be shown since other values are redundant. How can this be done?

thanks.


Is it OK to plot zeros in the other half?

pcolor(mat*tri(*shape(mat)))


Use set_ylim:

X = scipy.rand(10,10)
f = pylab.figure()
ax = f.add_subplot(1,1,1)
ax.pcolor(X)
ax.set_ylim([0,5])
f.show()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜