-4

I did a script to have a good barplot with barplot() on R

Is it possible to have on the y-axis the % and not the quantity (number of observations) ? I would love to have the % without to change all of the script...

Thanks a lot

leo
  • 8,106
  • 7
  • 48
  • 80
nif
  • 39
  • 1
  • 1
  • 8
  • I used prop.table(g2) and it worked well – nif Dec 12 '14 at 14:55
  • What have you tried? Please give us an example of what you have so far. [Here are some tips](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) on how to do this. – Roman Luštrik Dec 15 '14 at 08:56
  • I did like this: test$Hoursdecimal<-as.factor(test$Hoursdecimal) g2<- table(test$Hoursdecimal) g2<-prop.table(g2) g2<-g2*100 barplot(g2) – nif Jan 07 '15 at 07:11

1 Answers1

0

ggplot has this option, but for barplot() I believe you will have to make a new variable that represents the percent and then feed that into barplot()

Andrew Taylor
  • 3,438
  • 1
  • 26
  • 47