Home > database >  How Do I Space Out the Labels on the Y axis in ggplot2?
How Do I Space Out the Labels on the Y axis in ggplot2?

Time:10-31

I need to increase the spacing between my labels on the y-axis (see picture below). I have also included the code that I have used to make the plot in ggplot2.

Thanks for your help!

ggplot(who6, aes(total_cases, country)) geom_col(width = .25, position = position_dodge(width = 60*60*24))

enter image description here

CodePudding user response:

Try this:

guide_axis(n.dodge = 2)

It should alternate the horizontal placement of the labels so they don't overlap.

CodePudding user response:

I reproduced your example, but in the next time don't forget to add it by yourself.

I think, you should do that:

***
plot_new <- ggplot(who6, aes(total_cases, country))  
       geom_col()   theme (axis.text.x = element_text(margin = unit(c(0, 0, 0, 0), "mm"), angle = 90))   coord_flip()
***

Now your plot will look better:

enter image description here

  •  Tags:  
  • r
  • Related