Skip to content
Back to formatted view

Raw Message

Message-ID: <CAFEqCdxGrHu0gj9BbQBEcz1M9aF6GRxJNGSJ0Dg=E31AJx3H3w@mail.gmail.com>
Date: 2012-09-06T18:47:38Z
From: Greg Snow
Subject: No room for labels in barplot
In-Reply-To: <A97A1FA1-97A6-4840-8452-1781EB9BE38E@redwoods.edu>

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