【问题标题】:Put legend and labels to dtwclust plot将图例和标签放入 dtwclust 图
【发布时间】:2019-06-14 22:02:42
【问题描述】:

我使用R中的dtwclust包来获取图中的簇。

dtw_cluster2 = tsclust(transdatawide2, type="partitional",k=4,preproc = zscore,
                  distance="dtw_basic",centroid = "pam",trace=T)

plot(dtw_cluster2)

我想更改标签 x,其中数字显示真实日期,并添加图例以了解哪个时间序列对应于什么。 你知道怎么做吗?

head(transdatawide2)

     2015-01-06  2015-02-03  2015-03-02  2015-03-03
 A    0.00000    0.00000        0.0      0.00000
 B    0.10000    0.10000        0.1      0.00000

【问题讨论】:

    标签: r plot cluster-analysis legend dtw


    【解决方案1】:

    使用 labs.arg 参数。你可以在这里找到更多细节dtwclust documentation

    plot(dtw_cluster2) + labs(title = "New plot title", x = "New x label")

    或者你也可以使用plot(dtw_cluster2) + xlab("New x label")+ ylab("New x label") + ggtitle("New plot title")

    希望对你有用

    【讨论】:

    • 请注意,链接的文档是一个非常旧的版本,该网站已经有一段时间没有更新了。 This one 是最新的,您可以随时通过 CRAN 查看最新的。
    猜你喜欢
    • 1970-01-01
    • 2021-10-04
    • 1970-01-01
    • 2011-07-17
    • 1970-01-01
    • 2013-08-17
    • 2016-12-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多