Hello,
ggplot has the option of displaying a text next to the displayed values.
In a bar plot it can be for example the displayed values:
SampleData <- data.frame(Name = c("Peter", "Andrew"), Result = c(6, 9))
SamplePlot <- ggplot(SampleData, aes(Name, Result)) + geom_bar(stat = "identity") +
geom_text(aes(label=Result), color = "white", vjust = 4)
By default that text is placed at the top border of the bar, although with vjust it can be set above / below.
When I use the plotly_build function that vertical alignement is lost:
plotly_build(SamplePlot)
How should I make the ggplot or the plotly_build so that the geom_text keeps a good alignement?
Thanks!