暂无分类
暂无标签
发布于2021-04-03 19:56 阅读(312) 评论(0) 点赞(3) 收藏(5)
0
1
2
3
4
5
6
7
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(19860801)
Z = np.random.rand(3, 5) # C is a parameter in the pcolormesh, it should at least smaller than the len of x, y.
# there is a problem i can't solve.
# x = np.arange(-0.5, 10, 1) # len = 11
# y = np.arange(4.5, 11, 1) # len = 7
x = np.arange(-0.5, 10, 2) # len = 6
y = np.arange(4.5, 11, 2) # len = 4
plt.pcolormesh(x, y, Z)
fig, ax = plt.subplots()
x1, y1 = np.meshgrid(x, y)
x1 = x1 + (0.2 * y1)
y1 = y1 + (.3 * x1)
plt.pcolormesh(x1, y1, Z)
plt.show()
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.ticker import MaxNLocator
from matplotlib.colors import BoundaryNorm
import numpy as np
np.random.seed(19860801)
Z = np.random.rand(6, 10)
x = np.arange(-0.5, 10, 1)
y = np.arange(4.5, 11, 1)
plt.pcolormesh(x, y, Z)
x1, y1 = np.meshgrid(x, y)
x1 = x1 + (y1*0.2)
y1 = y1 + (x1 * 0.2)
plt.pcolormesh(x1, y1, Z)
Z = np.random.rand(6, 10)
fig, ax = plt.subplots(2, 1, sharex=True, sharey=True)
x = np.arange(10)
y = np.arange(6)
x2, y2 = np.meshgrid(x, y)
ax[1].pcolormesh(x2, y2, Z, vmin=np.min(Z), vmax=np.max(Z), shading='auto')
ax[1].set_title('auto')
ax[0].pcolormesh(x2, y2, Z[:-1, :-1], vmin=np.min(Z), vmax=np.max(Z), shading='flat')
ax[0].set_title('flat')
plt.show()
0
1
2
3
4
5
6
7
8
9
作者:丸子
链接: https://www.pythonheidong.com/blog/article/915674/fd3d95f2e6628c1fbd42/
来源: python黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
Copyright © 2018-2021 python黑洞网 All Rights Reserved 版权所有,并保留所有权利。 京ICP备18063182号-1
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!