嗨我在R中有以下代码。
我想提供例如轴刻度X轴为0:10
,Y轴为seq(from=1000, to=4000, length.out=11)
。你能帮帮我吗?
set.seed(0)
#Sample matrix
bitmap<-matrix(rnorm(150000,mean=1:500),nrow = 300, ncol = 500)
plot_ly(z=bitmap) %>% add_heatmap()
答案 0 :(得分:3)
library(plotly)
library(magrittr)
set.seed(0)
#Sample matrix
nrows <- 300
ncols <- 500
bitmap<-matrix(rnorm(150000 ,mean = 1:500),nrow = nrows, ncol = ncols)
plot_ly(z=bitmap) %>%
add_heatmap() %>%
layout(xaxis=list(tickvals = seq(from = 0,
to = ncols,
length.out = 10),
ticktext = c(0:9)),
yaxis=list(tickvals = seq(from = 0,
to = nrows,
length.out = 11),
ticktext = seq(from = 1000,
to = 4000,
length.out = 11)
)
)