[R] bar plot issues

Henri-Paul Indiogine hindiogine at gmail.com
Thu Oct 20 18:03:32 CEST 2011


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


-- 
Curriculum & Instruction
Texas A&M University
TutorFind Learning Centre

Email: hindiogine at gmail.com
Skype: hindiogine
Website: http://people.cehd.tamu.edu/~sindiogine



More information about the R-help mailing list