gpt4 book ai didi

python-ggplot - 如何在 Python Ggplot 上格式化 x 轴?

转载 作者:行者123 更新时间:2023-12-02 03:35:13 26 4
gpt4 key购买 nike

我需要在 python 条形图的 x 轴 ggplot 上格式化日期。

我该怎么做?

最佳答案

使用 scale_x_date() 格式化 x 轴上的日期。

p = ggplot(aes(x='date'), data) + geom_bar() + scale_x_date(labels='%m-%Y')

这给出了月份和年份,例如 01-1990您可以尝试其他格式。

关于python-ggplot - 如何在 Python Ggplot 上格式化 x 轴?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23939025/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com