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()
精彩评论