Re: [R] boxplot with text and symbols on x

From: Birgit Lemcke <birgit.lemcke_at_systbot.uzh.ch>
Date: Wed, 04 Jun 2008 17:04:40 +0200

Thanks Greg.

A useful solution.

Birgit

Am 02.06.2008 um 23:13 schrieb Greg Snow:

> An alternative way to draw the symbols (or some approximation of
> them) is to use the my.symbols function from the TeachingDemos
> package along with ms.male and ms.female (or your improvement of
> these, also from the TeachingDemos package). See the 4th example
> from ?ms.male (or ?ms.female).
>
> Hope this helps,
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow_at_imail.org
> (801) 408-8111
>
>
>
>> -----Original Message-----
>> From: r-help-bounces_at_r-project.org

>> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Birgit Lemcke
>> Sent: Thursday, May 29, 2008 6:05 AM
>> To: Gabor Grothendieck
>> Cc: R Hilfe
>> Subject: Re: [R] boxplot with text and symbols on x
>>
>> Thanks that was a huge help.
>>
>> Now I am using this:
>>
>> pdf("InfLengMaxVarHomogeneity.pdf")
>> plot(inflorescence_length_Max~Sex,xaxt="n" #unterdrückt
>> "normale x- Achse , ylab="inflorescence length max",
>> main="Bartletts Homogeneity for inflorescence length
>> Max",data=FemMal_Sex)
>> Homo<-bartlett.test(FemMal_Sex$inflorescence_length_Max,FemMal
>> _Sex$Sex)
>> text( 2, 500, "Bartlett's K-squared=", col='red',adj = c(1,0)
>> ) text( 2, 500, round(Homo$statistic,digits=5), col='red'
>> ,adj = c(0,0)) text( 2, 480, "df=", col='red',adj = c(1,0) )
>> text( 2, 480, Homo$parameter, col='red' ,adj = c(0,0))
>>
>> text( 2, 460, "p-value=", col='red', adj = c(1,0)) text( 2,
>> 460, round(Homo$p.value,digits=5), col='red', adj = c(0,0))
>> axis(1,at=c(1,2) #Mache punkte auf Achse in Position 1 und 2
>> , lab=expression( "\u2642", "\u2640")) #zeichne dort Mann/Frau
>> Symbole
>> dev.off()
>>
>>
>> But the symbols do not appear in the pdf. What is the reason
>> for that and how can I create a pdf with the symbols.
>>
>> Thanks again
>>
>> Birgit
>>
>> Am 29.05.2008 um 13:13 schrieb Gabor Grothendieck:
>>
>>> 1. See ?locator
>>> 2. Try this:
>>> plot(1:2, pch = c("\u2640", "\u2642"))
>>>
>>>
>>> On Thu, May 29, 2008 at 4:40 AM, Birgit Lemcke
>>> <birgit.lemcke_at_systbot.uzh.ch> wrote:
>>>> Hello R-user community!
>>>>
>>>> I am running R 2.7.0 on a Power Book (Tiger). (I am still R and
>>>> statistics
>>>> beginner)
>>>>
>>>> I did the following :
>>>>
>>>> pdf("InLnegthMaxHomogeneity.pdf")
>>>> boxplot(inflorescence_length_Max~Sex, main="Bartletts
>> Homogeneity for
>>>> inflorescence length",data=FemMal_Sex)
>>>> Homo<-bartlett.test(FemMal_Sex$inflorescence_length_Max,FemMal_Sex
>>>> $Sex)
>>>> text( 2, 500, "Bartlett's K-squared=", col='red',adj =
>> c(1,0) ) text(
>>>> 2, 500, round(Homo$statistic,digits=5), col='red' ,adj = c
>>>> (0,0))
>>>> text( 2, 480, "df=", col='red',adj = c(1,0) ) text( 2, 480,
>>>> Homo$parameter, col='red' ,adj = c(0,0))
>>>>
>>>> text( 2, 460, "p-value=", col='red', adj = c(1,0)) text( 2, 460,
>>>> round(Homo$p.value,digits=5), col='red', adj = c(0,0))
>>>>
>>>> dev.off()
>>>>
>>>>
>>>> As I am still not very good in R, I guess it is not the
>> easiest way
>>>> to implement the text and it was kind of fiddling around
>> to find the
>>>> right position for the text.
>>>> I would be glad if somebody would have an easier solution.
>>>>
>>>> My second question is about adding symbols (usual male and female
>>>> symbol) to
>>>> the x-axis to label the boxes.
>>>>
>>>> I would be very glad if somebody could help mw with this.
>>>>
>>>> Many thanks in advance.
>>>>
>>>> Greets
>>>>
>>>> Birgit
>>>>
>>>> Birgit Lemcke
>>>> Institut für Systematische Botanik
>>>> Zollikerstrasse 107
>>>> CH-8008 Zürich
>>>> Switzerland
>>>> Ph: +41 (0)44 634 8351
>>>> birgit.lemcke_at_systbot.uzh.ch
>>>>
>>>> 175 Jahre UZH
>>>> «staunen.erleben.begreifen. Naturwissenschaft zum
>> Anfassen.» Weitere
>>>> Informationen http://www.175jahre.uzh.ch/naturwissenschaft
>>>>
>>>> ______________________________________________
>>>> 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.
>>>>
>>
>> Birgit Lemcke
>> Institut für Systematische Botanik
>> Zollikerstrasse 107
>> CH-8008 Zürich
>> Switzerland
>> Ph: +41 (0)44 634 8351
>> birgit.lemcke_at_systbot.uzh.ch
>>
>> 175 Jahre UZH
>> «staunen.erleben.begreifen. Naturwissenschaft zum Anfassen.»
>> Weitere Informationen http://www.175jahre.uzh.ch/naturwissenschaft
>>
>> ______________________________________________
>> 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.
>>
>

Birgit Lemcke
Institut für Systematische Botanik
Zollikerstrasse 107
CH-8008 Zürich
Switzerland
Ph: +41 (0)44 634 8351
birgit.lemcke_at_systbot.uzh.ch

175 Jahre UZH
«staunen.erleben.begreifen. Naturwissenschaft zum Anfassen.» Weitere Informationen http://www.175jahre.uzh.ch/naturwissenschaft



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. Received on Wed 04 Jun 2008 - 16:28:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 04 Jun 2008 - 16:30:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive