1

I have a line chart within my shiny app. As you can see in the below image, the labels are not readable enough because Adams county's labels messed with Ohio's labels. How can I fix this?

enter image description here

    linedataPlot <- reactive ({
    ggplot(linedata(),
           aes(
             x = Year,
             y = Percentage,
             colour = interaction (County.y, Age_Group),
             group = interaction(County.y, Age_Group)
           )) + geom_line(size = 2)+ #ylim(0,30)+
      geom_point(size = 1,
                 shape = 21,
                 fill = "white" ) +
      geom_text(
        aes(label = Percentage),
        colour = "BLACk",
        fontface = "bold",
        hjust = 0.5,
        vjust=-0.6,
        size = 3.2
      ) +
      #geom_dl(aes(label = County), method = list(dl.trans(x = x +2), "first.points"),colour="Black") +
      # geom_dl(aes(label = County), method = list(dl.trans(x = x - 0), "last.points"), colour="Blue")+
      labs(
        x = "Year",
        y = "Percentage",
        caption = (""),
        face = "bold"
      ) +
      theme_bw() + #scale_y_continuous(labels = scales::comma) +
      theme(legend.title=element_blank(),legend.text = element_text(face = "bold"), plot.title = element_text(
        hjust = 0.5,
        size = 15,
        colour = "Black",
        face = "bold"
      ),axis.text=(blue.bold.12.text), axis.title=blue.bold.14.text)+
      ggtitle(paste(
        input$sex_,
        "Older Population in Ohio and",
        input$county_, "\n", "\n",
        "from 2010 to 2050 by Age Groups"
      ))

  })
Nader Mehri
  • 514
  • 1
  • 5
  • 21

0 Answers0