Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201945

Show element values in barplot

$
0
0

I'm trying to put original counts into a barplot, but it's always messy:

set.seed(123)
c<-c(2, 3.5, 5, 7.9, 8.8, 12.3)
x<-sample(c, 100, replace=T)
barplot(table(x))
text(c, table(x)+2, labels=as.character(table(x)))

enter image description here

Would somebody have some suggestions?


Viewing all articles
Browse latest Browse all 201945

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>