Using this example from the plot, I am trying to build two vertical lines to represent the middle and middle.
Playable code
library(plotly) # data df1 <- data.frame(cond = factor( rep(c("A","B"), each=200) ), rating = c(rnorm(200),rnorm(200, mean=.8))) df2 <- data.frame(x=c(.5,1),cond=factor(c("A","B"))) # graph ggplot(data=df1, aes(x=rating, fill=cond)) + geom_vline(aes(xintercept=mean(rating, na.rm=T)) , color="red", linetype="dashed", size=1, name="average") + geom_vline(aes(xintercept=median(rating, na.rm=T)) , color="blue", linetype="dashed", size=1, name="median") + geom_histogram(binwidth=.5, position="dodge") ggplotly()
Problem
I want to suppress the y-value of -2.2, which is displayed next to the red text βaverageβ. However, I want the text βmediumβ to be displayed as shown in the screenshot below. That is, I just want to suppress the label that I put with a black cross. The same problem applies to the median line.

My inoperative attempt
#plot gg <- ggplot(data=df1, aes(x=rating, fill=cond)) + geom_vline(aes(xintercept=mean(rating, na.rm=T)) , color="red", linetype="dashed", size=1, name="average")+ geom_vline(aes(xintercept=median(rating, na.rm=T)) , color="blue", linetype="dashed", size=1, name="median") + geom_histogram(binwidth=.5, position="dodge") p <- plotly_build(gg)
This attempt still displays 0 (screenshot below):
