问题
I have a data frame:
HG44 <- data.frame( gene_symbol = c("sads","sdsds","sdasdad","dfds","sdsdd"), panel = c("big","gr","sm","big","big"), variable = c("x","x","y","z","y") , value = c("normal","over","low","normal","low") , colors = c("red","green","yellow","red","red"))
And I create a heatmap with:
library(plotly)
library(ggplot2)
library(reshape2)
pp <- ggplot(HG44, aes(gene_symbol,variable)) +
geom_tile(aes(fill = value)) +
theme(axis.text.x = element_text(family = "Calibri",
size = 11,angle = 45, hjust = 1,color = as.factor(colors)))
ggplotly(pp)
As you can see I use multiple colours according to the panel
type to color the x-axis names. The problem is that when I use ggplotly()
this disappears. An alternative would be to color the xaxis names according to the colors
instaed of panel. The main issue is still ggplotly()
来源:https://stackoverflow.com/questions/51538933/multiple-axis-text-x-names-coloring-does-not-work-with-ggplotly