[英]Adding a matplotlib plot to an existing plot saved as an image
[英]Adding a layer of polygons to an existing plot in Python Matplotlib
可以使用PolyCollection在圖形上添加形狀。
import matplotlib.pyplot as plt
from matplotlib import collections
import numpy as np; np.random.seed(17)
b = np.random.rand(100,3)
fig, ax = plt.subplots()
ax.tripcolor(b[:,0],b[:,1],b[:,2], shading='gouraud')
polys = [np.random.rand(4,2)*.3+np.random.rand(1,2)*((2*i+1)/6.) for i in range(3)]
pc = collections.PolyCollection(polys, color="crimson")
ax.add_collection(pc)
plt.show()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.