On Wed, 2003-10-29 at 22:28, Paul Sorenson wrote: > When I create a bar plot, the legend is obscuring the rightmost bar. > > I haven't found a setting that appears to affect the positioning of > the legend - any tips re moving the legend would be most appreciated. > > paul sorenson
Conceptually, barplot() sets the default axes and legend position based upon the data that you are using for 'height'. These defaults may not be appropriate in all cases, as you are seeing. There are a couple of approaches that you can take: 1. Explicitly locate the legend by using legend() instead of the default used by barplot(). Don't set 'legend.text' in barplot() in this case. See ?legend for more details. 2. You can adjust the range of the y axis (if you have vertical bars) or the x axis (if you have horizontal bars) by using 'ylim' or 'xlim' in barplot(), respectively. Thus you could do something like: barplot(height, ..., ylim = c(0, max(height) * 1.3)) which will increase the maximum value of the y axis by 30%, leaving room for the legend in the upper portion of the plot area. HTH, Marc Schwartz ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
