Original df1
has 3 columns: Dia
, Visita
, Hora
. In order to make a heatmap, i needed to reshape it from long
to wide
.
Once having the wide df2
(from df1
). I've made a heatmap with:
d3heatmap(df2, scale = "column", colors = "Blues")
But: I need to
1) order the rownames from: "Domingo", "Lunes" ... to "Sábado". And put them to the left of the graphic.
2) order the X axis from 0 to 24 hours.
*I would also like to remove the "deograms"? (I don't know how to name those squares, up and left)
I've tried converting the df1
columns: Dia
and Horas
to factor. But that didn't help me after with the ordering of the rows and x axis.
df1$Dia <- factor(df$Dia,
levels = c("Domingo", "Lunes",
"Martes","Miércoles",
"Jueves","Viernes",
"Sábado"),
ordered = T)
df1$Hora <- factor(df1$Hora,
levels = c(0,1,2,3,4,5,6,
7,8,9,10,11,12,
13,14,15,16,17,
18,19,20,21,22,
23,24),
ordered = T)
You can turn off the dendrogramming by including dendrogram="none"
in your call to d3heatmap()
.
To leave the cells in the original order, also include Rowv=FALSE, Colv=FALSE
in that call.
So:
d3heatmap(df2, scale = "column", colors = "Blues",
dendrogram = "none", Rowv = FALSE, Colv = FALSE)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.