我正在尝试使用熊猫绘制一些直方图。这是一些示例代码,其功能与我正在执行的操作类似:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
ts = pd.Series(np.random.randn(1000), index=pd.date_range('2018-10-14', periods=1000))
df = pd.DataFrame(np.random.randn(1000, 6), index=ts.index, columns=['A', 'B', 'C', 'D', 'E', 'F'])
df = df.cumsum()
df.hist()
数据以直方图显示,但有一个小问题:
我的顶部直方图标签与下一行底部的X轴标签重叠。
我希望能够在这些之间添加一些间距,但是我还没有找到有关如何执行此操作的信息。
如何使用pandas和matplotlib增加绘图之间的填充?
答案 0 :(得分:2)
答案 1 :(得分:1)