簡體   English   中英

將圖例和標簽放入dtwclust圖

[英]Put legend and labels to dtwclust plot

我在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

使用labs.arg參數。 您可以在此處找到更多詳細信息dtwclust文檔

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")

希望這是有用的

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM