Boxplot, formula interface, and labels.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Boxplot, formula interface, and labels.

Ed Siefker
I have data I'd like to plot using the formula interface to boxplot.
I call boxplot like so:

with(mydata, boxplot(count ~ geno * tissue))

I get a boxplot with x axis labels like "wt.kidney".  I would like
to change the '.' to a newline.  Where is this separator configured?

Thanks,
-Ed

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Boxplot, formula interface, and labels.

Ed Siefker
Another way to think of this problem.  If I could get my hands on the
vector of names boxplot()
is creating, I could use gsub() to replace '.' with '\n'.

Is there something I could run before boxplot() that would give me
that vector of names which
I could then pass to boxplot()?

On Thu, Sep 28, 2017 at 11:40 AM, Ed Siefker <[hidden email]> wrote:

> I have data I'd like to plot using the formula interface to boxplot.
> I call boxplot like so:
>
> with(mydata, boxplot(count ~ geno * tissue))
>
> I get a boxplot with x axis labels like "wt.kidney".  I would like
> to change the '.' to a newline.  Where is this separator configured?
>
> Thanks,
> -Ed

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Boxplot, formula interface, and labels.

Ista Zahn
In reply to this post by Ed Siefker
mybp <- boxplot(count ~ geno * tissue, data = mydata, plot = FALSE)
mybp$names <- gsub("\\.", "\n", mybp$names)
bxp(mybp)

See ?boxplot for details.

Best,
Ista

On Thu, Sep 28, 2017 at 12:40 PM, Ed Siefker <[hidden email]> wrote:

> I have data I'd like to plot using the formula interface to boxplot.
> I call boxplot like so:
>
> with(mydata, boxplot(count ~ geno * tissue))
>
> I get a boxplot with x axis labels like "wt.kidney".  I would like
> to change the '.' to a newline.  Where is this separator configured?
>
> Thanks,
> -Ed
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Boxplot, formula interface, and labels.

David Carlson
Just change the separator:

data(Titanic)
Titanic.df <- as.data.frame(Titanic)
boxplot(Freq~Class*Sex, Titanic.df, cex.axis=.6, sep="\n")

See attached .png.

----------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352


-----Original Message-----
From: R-help [mailto:[hidden email]] On Behalf Of Ista Zahn
Sent: Thursday, September 28, 2017 12:27 PM
To: Ed Siefker <[hidden email]>
Cc: r-help <[hidden email]>
Subject: Re: [R] Boxplot, formula interface, and labels.

mybp <- boxplot(count ~ geno * tissue, data = mydata, plot = FALSE) mybp$names <- gsub("\\.", "\n", mybp$names)
bxp(mybp)

See ?boxplot for details.

Best,
Ista

On Thu, Sep 28, 2017 at 12:40 PM, Ed Siefker <[hidden email]> wrote:

> I have data I'd like to plot using the formula interface to boxplot.
> I call boxplot like so:
>
> with(mydata, boxplot(count ~ geno * tissue))
>
> I get a boxplot with x axis labels like "wt.kidney".  I would like to
> change the '.' to a newline.  Where is this separator configured?
>
> Thanks,
> -Ed
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.

Titanic.png (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Fwd: Boxplot, formula interface, and labels.

Ed Siefker
I knew I was making harder than it needed to be.  I see it now in ?boxplot
Thanks!

On Thu, Sep 28, 2017 at 12:30 PM, David L Carlson <[hidden email]> wrote:

> Just change the separator:
>
> data(Titanic)
> Titanic.df <- as.data.frame(Titanic)
> boxplot(Freq~Class*Sex, Titanic.df, cex.axis=.6, sep="\n")
>
> See attached .png.
>
> ----------------------------------------
> David L Carlson
> Department of Anthropology
> Texas A&M University
> College Station, TX 77843-4352
>
>
> -----Original Message-----
> From: R-help [mailto:[hidden email]] On Behalf Of Ista Zahn
> Sent: Thursday, September 28, 2017 12:27 PM
> To: Ed Siefker <[hidden email]>
> Cc: r-help <[hidden email]>
> Subject: Re: [R] Boxplot, formula interface, and labels.
>
> mybp <- boxplot(count ~ geno * tissue, data = mydata, plot = FALSE) mybp$names <- gsub("\\.", "\n", mybp$names)
> bxp(mybp)
>
> See ?boxplot for details.
>
> Best,
> Ista
>
> On Thu, Sep 28, 2017 at 12:40 PM, Ed Siefker <[hidden email]> wrote:
>> I have data I'd like to plot using the formula interface to boxplot.
>> I call boxplot like so:
>>
>> with(mydata, boxplot(count ~ geno * tissue))
>>
>> I get a boxplot with x axis labels like "wt.kidney".  I would like to
>> change the '.' to a newline.  Where is this separator configured?
>>
>> Thanks,
>> -Ed
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.

Titanic.png (6K) Download Attachment