plt.ylim((20,34))
python
1import matplotlib.pyplot as plt
2import numpy as np
3
4def samplemat(dims, shift=0):
5 """Make a matrix with all zeros and increasing elements on the diagonal"""
6 aa = np.zeros(dims)
7 for i in range(min(dims)):
8 aa[i, i] = i
9 aa = np.vstack((np.zeros((shift, aa.shape[-1])), aa))
10 return aa
11
12shift = 20
13size = (15, 35)
14# Display matrix
15fig, ax = plt.subplots(dpi=200)
16ax.matshow(samplemat(size, shift=shift-1))
17ax.set_ylim((size[0]+shift-1.5,shift-0.5))
18plt.show()
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/12/15 12:13
2017/12/15 12:17
2017/12/16 05:21
2017/12/16 05:49
2017/12/16 05:51