I was using ggplot for some time until I came across the Plotly library and started to use it for my plots. I still use ggplot functions to create the plot and at the end the ggplotly function to transform it.
I'm using a geom_tile and a geom_text layer in my plot to create a heatmap. I set the "text" property in the geom_tile to the text I want to display in the tooltip and pass tooltip="text" in the ggplotly function. The text I want to show inside the rectangle is the one set in the geom_text layer using "label" property.
When the plot is rendered I can see both tooltips, separately, one with the text I set in the text property in geom_tile, and the other one repeating the text in the label property in the geom_text layer.
How can I get rid of this last tooltip?
Thanks in advance!
Here's my code:
gg<-ggplot(dataframe, aes(x=varX,y=varY))+
geom_tile(aes(fill=cm,text=paste("#",casos)))+
geom_text(aes(label=cm,size=casos),family = "arial", color="#111111")+
scale_fill_gradient2(low="#DD3333",mid="#EEEE99",high="#00AA00")+
labs(x="varX",y="varY",fill="CM")+ scale_size(range = c(2.5, 5),guide='none') +
theme(text=element_text(family = "arial", color="#666666", size=11) ,title=element_text(family = "arial", color="#666666", face="bold", size=12), axis.text=element_text(family = "arial", color="#666666", size=9),axis.text.x=element_text(angle=330))
ggplotly(gg, tooltip="text")