0

I have created a histogram, but I would like to order the bars by desc

mediatweets%>%
ggplot( aes(screen_name, as.numeric(count))) +
  geom_col(fill = 'firebrick') + 
  theme_minimal(base_size = 14) +
  xlab(NULL) + ylab(NULL) +
  geom_text(aes(label = count, y = count+15), position = position_dodge(0.9), vjust =0.5,size=3)+
  scale_x_discrete(limits = mediatweets$screen_name) + coord_flip()+
  ggplot2::labs(
    x = NULL, y = NULL, #Info en cada eje 
    title = "Tweets sobre el COVID-19 por día" #Texto 
  )

AdrianGI
  • 37
  • 5
  • 1
    A reproducible example would be beneficial, but to reorder the bars have your aes object read something like "aes(x = reorder(screen_name, desc), y = as.numeric(count)" assuming "desc" is numeric. – Jack May 10 '20 at 19:28
  • Bars of a histogram are already ordered by the binning; you're talking about ordering a non-histogram bar chart. – alistaire May 10 '20 at 19:38

0 Answers0