【问题标题】:My code is not generating a monthly trend line graph我的代码没有生成每月趋势线图
【发布时间】:2019-05-22 08:46:41
【问题描述】:

我有一个日期列和值列。我在互联网上进行了研究并尝试了所有可能的方法,但它没有显示我的趋势线图。我对我的数据中发生的事情感到非常困惑。我在下面分享了我的代码:

ggplot(data = New, aes(x = OrderDate, y = TotalAmountWithGST))+
geom_line(color = "#00AFBB", size = 2) + scale_x_date(date_labels = "%b/%Y")

ggplot(x, aes(x = OrderDate, y = TotalAmountWithGST)) + 
geom_line()+
theme_minimal()

我正在尝试绘制显示月度趋势的折线图,但不知何故,我得到的图类似于条形图,但不是折线图。

【问题讨论】:

    标签: r ggplot2 linegraph timeserieschart


    【解决方案1】:

    您需要在 ggplot 代码中添加 geom_smooth。

    如果没有样本数据,很难复制一个工作示例,但这应该会让您走上正确的道路。

    【讨论】:

    • 不。那不是我要找的。我需要一个简单的折线图。我有两列金额和日期。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-20
    • 1970-01-01
    • 2018-09-09
    • 1970-01-01
    相关资源
    最近更新 更多