I'm making an interactive plot with ggplotly, where I have text on each bar. However, when I use ggplotly some of the text disappears, even though it is present in ggplot. Any help?
p8<-ggplot(full4, aes(x=rank, group = Employer,
fill = as.factor(Employer), frame = Year)) +
geom_tile(aes(y=Employees/2,height = Employees,
width = 0.9, text=Employer,text2=Employees), alpha = 0.8, color = NA) +
geom_text(aes(y=0, label = Employer), color="black", hjust=0) +
coord_flip(clip = "off", expand = FALSE) +
scale_y_continuous(labels = scales::comma) +
scale_x_reverse() +
guides(color = FALSE, fill = FALSE) +
labs(title='Top 10 Employers of Rice Students', x = "", y = "Number of Graduates") +
theme_bw()+
theme(plot.title = element_text(hjust = 0, size = 22),
axis.ticks.y = element_blank(), # These relate to the axes post-flip
axis.text.y = element_blank(), # These relate to the axes post-flip
plot.margin = margin(1,1,1,4, "cm"),
legend.position = "none")
ggplotly(p8, tooltip = c("text","text2")) %>%
style(textposition = "right")
Ggplot object: (very overlapping due to the animation, sorry)