Two issues in ggplot2 => plotly => shiny

I am trying to generate interactive plot (using plotly) from ggplot2, and render it to shiny. The code is like below:


shinyServer(function(input, output) {
  output$someplot <- renderPlotly({
    g <- dd %>%
      ggplot(aes(x=x, y=y, fill=group)) +
      geom_bar(stat="identity", position=position_dodge(0.9))+
      geom_text(aes(label=y ), vjust=1.6, size=6,position = position_dodge(0.9))+
      #annotate(geom = "text", x = dd$x, y = dd$y - 1.3, label = round(dd$y, 1)) +
      theme(axis.text=element_text(size = 15),
            axis.title = element_text(size = 30)) 


The generated figure looks okay, except for two issues:

  1. Can not set the font of label and axis (by the theme). The output from ggplot looks good, but the generated plot in shiny does have font.
  2. Can not adjust position of text for barplot in dodge position (vjust does not work). I can use the annotate as in the commented line to adjust position of text of simple bar, but it does not work when the bars are in dodge.

Hi there,

Do these problems occur even with ggplot2 => plotly, without Shiny? If so, the place to report it is

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.