我可以在11个图形和1个图形中绘制11个系列:
NG = [1,2,3,4,5,6,7,8,9,10,11]
serieslist = []
for n in NG:
l = [1,2,3,4,5,6]
df = pd.DataFrame(l)
serieslist.append(df)
df = pd.concat(serieslist, axis = 1)
df.plot(grid = 1, subplots = True, layout = (6,2), sharey = True)
如何在1个图中绘制22个系列(其中2个应始终在一个图中)?这意味着11个图中的22个图。以下代码仅提供22个图表:
NG = [1,2,3,4,5,6,7,8,9,10,11]
serieslist = []
for n in NG:
l = [1,2,3,4,5,6]
df = pd.DataFrame(l)
serieslist.append(df)
serieslist.append(df)
df = pd.concat(serieslist, axis = 1)
df.plot(grid = 1, subplots = True, layout = (12,2), sharey = True)
编辑: 这不是我想要的解决方案的100%,但它看起来更漂亮:
import pandas as pd
NG = [1,2,3,4,5,6,7,8,9,10,11]
dflist1 = []
dflist2 = []
l = [1,2,3,4,5,6]
b = [6,5,4,3,2,1]
for n in NG:
df = pd.DataFrame(l)
dflist1.append(df)
df = pd.concat(dflist1, axis = 1)
df2 = pd.DataFrame(b)
dflist2.append(df2)
df2 = pd.concat(dflist2, axis = 1)
df.plot(grid = 1, subplots = True, layout = (12,1), sharey = True)
df2.plot(grid = 1, subplots = True, layout = (12,1), sharey = True)
输出:2位数。现在如何将这些图组合成1个数字?
答案 0 :(得分:1)
您可以使用此matplotlib.pyplot.subplot
。
import matplotlib.pyplot as plt
在一个单元格中:
i in range(11)
plt.subplot(6, 2, i + 1)
i
和i +