evt
evt

Reputation: 971

Setting a height in Barplots for R

I bet this is incredibly simple, but I looked through the documentation on barplot() and could not find it.

I want to create a barplot, with a Y-axis of a particular height (lets say 4) even though the data only goes to 2. Is there some parameter I can pass so that this is done?

Thank you!

Upvotes: 1

Views: 5290

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368241

That should be ylim=c(0,4) but it is hard to say without sample data.

R> vals <- c('a','a', 'b','b','a')
R> table(vals)
vals
a b 
3 2 
R> barplot(table(vals), ylim=c(0,4), main="Barplot with y-axis to 4")
R> 

Upvotes: 4

Related Questions