0

I am recently introduced in R. I am trying to create a bar plot from a data frame with 51 variable names just like the following example:

enter image description here

By using the barplot function I produced the following bar plot. Is there a way to display the variable names on the x-axis just like the above example:

enter image description here

Thanks in advance.

shiny
  • 3,380
  • 9
  • 42
  • 79
Whitebeard13
  • 411
  • 1
  • 7
  • 17
  • I think you'll find this helpful http://stackoverflow.com/questions/10286473/rotating-x-axis-labels-in-r-for-barplot – Yannis Vassiliadis May 03 '17 at 21:42
  • See this. I think you are looking to use las http://stackoverflow.com/questions/10286473/rotating-x-axis-labels-in-r-for-barplot – MadmanLee May 03 '17 at 21:43
  • Yes indeed las worked fine, Thanks a lot for that. Although not the the variable names are not clearly shown as their length is too long. – Whitebeard13 May 03 '17 at 22:01

1 Answers1

2

It can be done with cex.names argument of barplot function. cex.names determines the size for x labels, try to write 0.1 then increase by 0.1 to check for optimal size. For example:

barplot(x,names.arg = x_name,cex.names=0.4)
Llex
  • 1,770
  • 1
  • 12
  • 27
Alex
  • 21
  • 2