On 09/30/2013 07:47 PM, Juan Andres Hernandez wrote:> Hi, does anybody know how to get a barplot with the x axis starting in the
> right side and the y axis in the right side too?
> An example:
>
> dat=c(2,4,0,6,5)
> names(dat)=paste('dpt.',1:5,sep='')
> barplot(dat, horiz=T)
> box()
>
> I need this barplot in mirror, with the zero value to 6 starting in the
> right side of x axes and the horizontal bars starting in the right side
too.
>
Hi Juan,
Try this:
par(mar=c(5,2,4,4))
barpos<-barplot(-dat,names.arg=rep("",5),axes=FALSE,horiz=TRUE)
axis(1,at=(-6):0,labels=6:0)
mtext(names(dat),side=4,at=barpos,line=1)
Jim