alecarnevale
alecarnevale

Reputation: 103

R - plot array like histogram

I want to plot the values of an array in R:

a <- c( 276, 1591, 2367, 3441, 82, 2690, 106, 277, 172, 190, 26, 18, 32, 12, 12, 17)

in a form like an histogram, like this:

hist(a, breaks="Sturge", col="grey", labels = T,main="My array")

enter image description here

but with its value as y, instead of the frequencies.

So what I want is a simple plot:

plot(a, type = 'h')

enter image description here

but with a layout like the first picture (bars instead of lines).

Upvotes: 0

Views: 5194

Answers (1)

Patric
Patric

Reputation: 2131

barplot(a)

barplot

As @lmo mentioned, just use barplot instead of plot :)

Upvotes: 5

Related Questions