I have data with 2 categorical and 1 numerical column. I built marikemo chart in ggplot, and in order to make it interactive, I used ggplotly().
However, when I move a cursor, hover shows the same information twice:
# create a dataset
specie <- c(rep("sorgho" , 3) , rep("poacee" , 3) , rep("banana" , 3) , rep("triticum" , 3) )
condition <- rep(c("normal" , "stress" , "Nitrogen") , 4)
value <- abs(rnorm(12 , 0 , 15))
data <- data.frame(specie,condition,value)
library(tidyverse)
library(plotly)
plt <- data %>%
group_by(specie) %>%
mutate(value = value / sum(value)) %>%
ggplot(aes(fill=condition, y=value, x=specie)) +
geom_col(position="fill", width = 1, color = "white") +
geom_text(aes(label = scales::percent(value, accuracy = 0.1)),
position = position_fill(vjust = 0.50),
color = "white") +
scale_y_continuous(labels = scales::percent) +
scale_fill_brewer(palette = "Set1")
ggplotly(plt)

