Skip to content
Prev 274964 / 398502 Next

bar plot issues

Hi!

I have 2 problems in drawing a stacked bar plot:

(1)  This is a stacked bar plot with more than 100 bars next to each
other.  So there should not be names at the bottom of the bars because
the bars are too narrow.    I tried arg.names=NULL but that does not
work because R uses the row names from the data.frame.

How can I suppress the placing of names below the bars?


(2) The position of the legend is problematic. The legend is big, more
than 20 items. It overlays the bars themselves and makes the plot
unreadable.  I would like to move it outside the plot and have tried
legend("topleft") but R complains about missing information.

Here is what I have so far

########################################################
barplot(t(file.codes),
+         beside = FALSE,
+         col = rainbow(ncol(file.codes)), names.arg=NULL,
+         legend = FALSE,
+         main = "Presidential documents - Codes per document",
+         xlab = "document", ylab = "number of codings")
#######################################################

Any ideas?

Thanks,
Henri-Paul