Reputation: 220
I am working on making two back-to-back barplots with the traditional graphics package in R; I have found the horiz argument to the barplot() function, but can't figure out how to flip the horizontally-oriented graph horizontally.
As an example,
barplot(mtcars$cyl, horiz = T)
gives
but what I want to make is this (with the x-axis correct, of course).
Is there a way to do this with the traditional graphics package?
Upvotes: 2
Views: 6539
Reputation: 61214
Something like this...?
barplot(-mtcars$cyl, horiz = TRUE, axes=FALSE)
axis(1, at=-0:-8, labels=0:8)
Upvotes: 1