0

I am using R to create a barplot and it is working properly but I want there to be more space between the individual bars so that the numbers are not over lapping. The picture is of the graph I got, but is there a way to make it so that there is more space between the Green and Blue parts each bar? Again I am trying to make the space between the two boxes to be greater. Not the space between the Expected box and the actual plot. I want he space between the blue and Green portions of the box to be greater.

output

Here is what I wrote to produce the chart:

par(xpd=T,mar=c(3,4,2,9i))
midpoints<-barplot(width=1,space=.25,t(dialogueMatrix),col=c('blue','green'),border='white',horiz=T,names.arg=c('Actual','Expected'),xaxt='n',cex.names=1,bty='L',lwd=1,cex.main=1.5,main='Dialogue quantity: overall',bty='n')
text(x=numberLocations,y=midpoints,labels=numberLabels,col='black',cex=1)
legend(col=c('blue','green'),legend=c('Original posts','Replies'),x=650,y=2,bty='n',cex=1.3,pch=15)
  • 3
    You should include a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data in the question itself. This will make it easier to help you. – MrFlick Mar 30 '17 at 19:51
  • In ordedr for this to be reproducible, `dialogueMatrix` needs to be defined as well as `numberLocations` and `numberLabels`. I'm not sure I understand what the desired result is. With barplots "space" is data. If you "pad" between blocks then you interfere with the interpretation of the bars themselves. – MrFlick Mar 30 '17 at 20:11
  • dialogueMatrix is just a list of data. and numberLocations is just used to place the numbers in the center of the bar. All I am is if there is a way to make the space between the blue and green bars larger. – Sam Miranda Mar 30 '17 at 20:26
  • @Facottons I believe this is not a correct dupe target. The OP requests to have more space between the blue and green parts, i.e., a gap, to avoid the numbers to overlap. – Uwe Mar 30 '17 at 22:13
  • @UweBlock Yes, you right, I've just read the title and saw the pic. I removed it – Fábio Mar 31 '17 at 12:11

0 Answers0