【发布时间】:2021-06-18 08:33:27
【问题描述】:
我正在尝试使用 pandas 和 matplotlib 绘制直方图数据。我正在使用dataframe.plot() 函数。问题是,这会生成一个在 x 轴上显示大量刻度的图表。
histogram plot
数据框的索引用作刻度。 代码如下:
fig, axes = plt.subplots(figsize=(12,12))
PLOT_CONFIG_HISTOGRAM={
"subplots":True,
"title":"cyclictest wakeup latency",
"legend":True,
"xlabel":"latency/us",
"ylabel":"cycles",
"logy":True,
"kind":"bar",
}
my_dataframe.plot(ax=axes,**PLOT_CONFIG_HISTOGRAM)
matplotlib 或 pandas 中有没有办法减少显示的刻度?还是显示直方图数据的更好方法?
最后应该是这样的:
| | | | |
| |
1 5
或者像这样:
| |
1 5
提前感谢您的任何意见。
【问题讨论】:
标签: python pandas matplotlib