I have an application that uses ggplotly
to turn several plots (originally made with ggplot
) into their interactive versions. However, I just can't get geom_tile
borders to render with ggplotly
. It's throwing everything off.
I know that sometimes slight modifications have to be made in the aesthetics when translating ggplot to ggplotly , but I can't seem to get this one working. Any ideas?
library(ggplot2)
library(plotly)
library(reshape2)
#Make a matrix
mymat <- matrix(1:21, nrow = 7, ncol = 7)
#'melt' the matrix using the reshape2 package
mymat_melted <- melt(mymat)
#create a tile plot
p <- ggplot(mymat_melted, aes(x=Var1, y=Var2, fill=value)) +
geom_tile(color="black")
#the borders are correct
p
#convert with ggplotly
#notice the borders disappear
ggplotly(p)