【发布时间】:2020-09-25 11:33:13
【问题描述】:
我想知道是否可以覆盖使用pd.DataFrame.plot() 方法生成的绘图的标签大小。在the docs 之后,我可以使用fontsize kwarg 轻松地为 xticks 和 yticks 做到这一点:
fontsize int,默认无 xticks 和 yticks 的字体大小。
不幸的是,我没有看到可以改变 xlabel 和 ylabel 大小的类似选项。 这是一个可视化问题的 sn-p:
import pandas as pd
df = pd.DataFrame(
[
{'date': '2020-09-10', 'value': 10},
{'date': '2020-09-10', 'value': 12},
{'date': '2020-09-10', 'value': 13},
]
)
df.plot(x='date', y='value', xlabel='This is the date.', ylabel='This is the value.', fontsize=10)
df.plot(x='date', y='value', xlabel="This is the date.", ylabel="This is the value.", fontsize=20)
我可以用类似的方式改变 xlabel 和 ylabel 的大小吗?
【问题讨论】:
标签: python pandas dataframe matplotlib