Reputation: 55
I have a table with a header that seems to be ruining my plots.
| Header2 |
--------+---------+
a | 1 |
b | 5 |
c | 7 |
I want to barplot the x and y values against each other, and I can, but it does not print out the values "a,b,c" on the x-axis
And when I run:
barplot(xyz.rf$importance[order(xyz.rf$importance, decreasing = TRUE)], ylim=c(0,40) las=2)
It does not print out the x values on the graph
xyz.rf$importance looks like this:
MeanDecreaseGini
a 25.803414
b 20.671604
c 14.043655
d 20.307379
e 27.805377
f 11.427971
g 14.104592
How do I fix this?
Upvotes: 2
Views: 45
Reputation: 887148
We could transpose the object
barplot(t(df1), ylim=c(0,40), las=2)
where,
df <- xyz.rf$importance
df1 <- df[order(df[, "MeanDecreaseGini"], decreasing = TRUE), , drop = FALSE]
Upvotes: 2