0
我的數據幀是這樣的:如何用r繪製修改座標軸名稱?
plot_ly(z = ~df$MonetaryClass, x = ~df$RecencyClass , y = ~df$FrequencyClass,
type = "heatmap") %>%
colorbar(limits = c(1,5)) %>%
layout(title = "RFM Analyse")
結果看起來是這樣的:
但我想修改該地塊。起初我希望z尺度上的不平整數字是隱藏的。然後,我希望在xasis和yasis的數字下「1」,「min」,在「5」下寫上「max」。至少改變xasis和yasis的名字。 結果應該是這樣的:
對於我的問題,我想這第三部分,但它不工作:
plot_ly(z = ~df$MonetaryClass, x = ~df$RecencyClass , y = ~df$FrequencyClass,
type = "heatmap") %>%
colorbar(limits = c(1,5)) %>%
layout(title = "RFM Analyse",
scene = list(
x = list(title = "Recency"),
y = list(title = "Frequency"),
z = list(title = "Monetary")))
對於前兩個問題,我不沒有解決方法。
它的我的數據幀的100樣本:
structure(list(RecencyClass = structure(c(3L, 1L, 5L, 2L, 4L,
2L, 1L, 4L, 4L, 2L, 4L, 4L, 4L, 1L, 4L, 3L, 5L, 5L, 5L, 2L, 2L,
3L, 1L, 5L, 5L, 3L, 5L, 4L, 2L, 2L, 2L, 4L, 1L, 5L, 3L, 3L, 4L,
5L, 5L, 4L, 2L, 2L, 5L, 1L, 3L, 2L, 2L, 4L, 2L, 4L, 1L, 5L, 2L,
3L, 1L, 4L, 4L, 1L, 1L, 1L, 2L, 3L, 2L, 2L, 1L, 5L, 5L, 3L, 4L,
3L, 2L, 4L, 5L, 1L, 2L, 2L, 3L, 1L, 5L, 3L, 1L, 3L, 1L, 1L, 2L,
5L, 2L, 1L, 4L, 4L, 2L, 3L, 2L, 4L, 3L, 1L, 4L, 5L, 5L, 1L), .Label = c("1",
"2", "3", "4", "5"), class = "factor"), FrequencyClass = structure(c(3L,
1L, 3L, 3L, 5L, 4L, 2L, 5L, 2L, 3L, 4L, 5L, 2L, 1L, 4L, 1L, 5L,
5L, 1L, 3L, 1L, 5L, 1L, 5L, 5L, 2L, 5L, 2L, 2L, 1L, 4L, 2L, 2L,
5L, 4L, 4L, 5L, 3L, 5L, 5L, 1L, 1L, 5L, 1L, 5L, 1L, 3L, 4L, 3L,
4L, 4L, 5L, 2L, 1L, 1L, 4L, 4L, 1L, 2L, 2L, 3L, 3L, 3L, 2L, 2L,
4L, 3L, 1L, 1L, 3L, 3L, 5L, 4L, 1L, 1L, 1L, 3L, 3L, 5L, 3L, 2L,
2L, 1L, 1L, 3L, 5L, 2L, 2L, 5L, 5L, 3L, 2L, 1L, 4L, 3L, 1L, 5L,
5L, 4L, 1L), .Label = c("1", "2", "3", "4", "5"), class = "factor"),
MonetaryClass = c(3, 1, 4, 3, 5, 5, 2, 5, 3, 3, 5, 5, 4,
2, 1, 1, 5, 4, 2, 2, 1, 5, 2, 5, 4, 3, 5, 3, 1, 2, 3, 2,
2, 3, 4, 4, 4, 3, 5, 4, 1, 3, 5, 1, 1, 4, 3, 4, 2, 4, 4,
5, 2, 3, 1, 3, 3, 2, 2, 4, 3, 4, 3, 3, 2, 2, 3, 3, 2, 5,
2, 5, 3, 1, 3, 1, 2, 2, 5, 2, 2, 4, 1, 1, 3, 5, 3, 2, 4,
5, 3, 4, 1, 2, 3, 1, 5, 5, 4, 1)), .Names = c("RecencyClass",
"FrequencyClass", "MonetaryClass"), row.names = c(21905L, 3384L,
37826L, 15776L, 34715L, 16079L, 6656L, 33920L, 29071L, 14429L,
32553L, 35034L, 28436L, 1327L, 33075L, 19364L, 44108L, 41976L,
36220L, 14489L, 10100L, 26309L, 397L, 44059L, 43615L, 21125L,
43154L, 28203L, 13461L, 9720L, 17104L, 29200L, 6704L, 42277L,
25339L, 25013L, 35174L, 38928L, 42665L, 34659L, 10300L, 10132L,
44827L, 3405L, 25523L, 11189L, 15357L, 33415L, 14023L, 33246L,
8733L, 42276L, 13381L, 18459L, 3390L, 32937L, 31867L, 5118L,
7311L, 6536L, 13771L, 23489L, 14375L, 11987L, 6584L, 41619L,
38854L, 18188L, 27675L, 23360L, 14335L, 33970L, 41305L, 5429L,
9262L, 10655L, 22696L, 8186L, 41769L, 22566L, 6008L, 21076L,
3123L, 5359L, 14213L, 43481L, 12594L, 7364L, 34879L, 35302L,
14190L, 20604L, 10801L, 32840L, 23387L, 29L, 34714L, 44049L,
39741L, 5467L), class = "data.frame")
我們可以有一些樣本數據一起工作呢?用dput(df)' – GGamba