[R] No room for labels in barplot
Greg Snow
538280 at gmail.com
Thu Sep 6 20:47:38 CEST 2012
Look at the staxlab function in the plotrix package.
On Thu, Sep 6, 2012 at 12:03 PM, David-Arnold <david-arnold at redwoods.edu> wrote:
> All,
>
> I have:
>
> sales <- c(2300,900,155,102,42,10)
> names(sales) <- c("Christmas","Valentine's Day",
> "Mother's Day","Father's Day",
> "Thanksgiving","New Year's Day")
> barplot(sales,ylim=c(0,2500))
>
> But it doesn't place all of the name labels on the plot. So I tried:
>
> sales <- c(2300,900,155,102,42,10)
> names(sales) <- c("Christmas","Valentine's Day",
> "Mother's Day","Father's Day",
> "Thanksgiving","New Year's Day")
> barplot(sales,ylim=c(0,2500),las=2)
>
> But there wasn't enough room at the bottom margin for the labels. Then I tried:
>
> sales <- c(2300,900,155,102,42,10)
> names(sales) <- c("Christmas","Valentine's Day",
> "Mother's Day","Father's Day",
> "Thanksgiving","New Year's Day")
> barplot(sales,horiz=TRUE,xlim=c(0,2500),las=1)
>
> Still, not enough room in the margin for the labels. Now, I am going to be introducing students to barplots in R tonight and I'm looking for a simple way to fix this label problem without scaring them too much.
>
> Any thoughts?
>
> D.
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com
More information about the R-help
mailing list