[英]Is it possible to create a subplot from existing matplotlib figure objects?
我有一個具有相同x軸的現有圖形的列表,我想將它們堆疊在一個畫布上。 例如,在這里我分別生成兩個圖形-如何將它們放在一個圖上?
import matplotlib.pyplot as plt
time = [0, 1, 2, 3, 4]
y1 = range(10, 15)
y2 = range(15, 20)
## Plot figure 1
fig1 = plt.figure()
plt.plot(time, y1)
## plot figure 2
fig2 = plt.figure()
plt.plot(time, y2)
## collect in a list
figs = [fig1, fig2]
plt.subplot(1, 1, 1)
## code to put fig1 here
plt.subplot(1, 1, 2)
## code to put fig2 here
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.