我想用5张正方形图划一排。我现在正在做这个:
import matplotlib.pyplot as plt
fig, axarr = plt.subplots(1, 5)
#code to populate the graphs here
plt.show()然而,这给了我5个非常瘦小和高矩形的图表。如果我用格式子图工具将它们缩小为正方形,那么生成的图像主要是空白。在没有所有空白的情况下,我如何将这些图形生成成一行中的正方形?
发布于 2014-03-12 23:29:58
您需要设置数字大小:
plt.rcParams['figure.figsize'] = (20,5) # width, height
plt.subplot( 151 ) # a fig with 1 row, 5 columns, 1st graph
plt.plot( x,y )
plt.subplot( 152 ) # 2nd graph
plt.plot( ... )
# and similarly for the next ones
plt.show()发布于 2014-03-12 23:29:08
只需改变你的身材。
import matplotlib.pyplot as plt
fig, axarr = plt.subplots(1, 5, figsize=(5, 1))
#code to populate the graphs here
plt.subplots_adjust(hspace=0.0)
plt.show()https://stackoverflow.com/questions/22365923
复制相似问题