[R] Symbols on a capscale object plot

Mark Difford mark_difford at yahoo.co.uk
Sat Sep 13 21:10:38 CEST 2008


Hi Rogrido,

Sorry: The first points() call was missing a vital comma. It should have
been.

points(ord.obj$scores[mydf$Site=="MarkerA", ], pch=21, bg="red")

See ?"["


Mark Difford wrote:
> 
> Hi Rodrigo,
> 
>>> Maybe if I can define a factor that specifies these groups and use this
>>> factor to assign the symbols.
> 
> Yes, that's the idea. Some ordination-oriented packages make this easier
> to do than others. You should look through vegan carefully to see the full
> offering. Nevertheless, it's pretty easy to do it from the ground up once
> you get the knack.
> 
> You would do something like the following. Say you have a factor-column
> called Site, the rows of which match the rows of the data frame (=mydf)
> you used for the ordination. Then you could lasso your groups by doing:
> 
> points(ord.obj$scores[mydf$Site=="MarkerA"], pch=21, bg="red")
> points(ord.obj$scores[1:10, ], pch=21, bg="red") ## by rownum()
> 
> HTH, Mark.
> 
> 
> Rodrigo Aluizio wrote:
>> 
>> Thank You Mark,
>> With your tip now I'm able to chance the sites names for real symbols.
>> Well,
>> now I just have to find out how to change groups of sites names, that
>> compose a 'biofacies', with different symbols (actually six groups) in
>> the
>> same plot.
>> Maybe if I can define a factor that specifies these groups and use this
>> factor to assign the symbols.
>> I don't know, I've to try, but I'm getting something, I hope.
>> 
>> Rodrigo.
>> 
>> --------------------------------------------------
>>> From: "Mark Difford" <mark_difford at yahoo.co.uk>
>>> Sent: Saturday, September 13, 2008 9:21 AM
>>> To: <r-help at r-project.org>
>>> Subject: Re: [R] Symbols on a capscale object plot
>>>
>>>>
>>>> Hi Rodrigo,
>>>>
>>>>>> I would like to use something like squares, triangles and circles 
>>>>>> (filled
>>>>>> and empty).
>>>>
>>>> You would normally add this using points():
>>>> ?points
>>>>
>>>> ##
>>>> plot(1:10, type="n")
>>>> points(1:5, pch=21:25, bg=1:5)
>>>> points(6:10, pch=21:25, bg=c(1,"darkgrey","cyan", "bisque"))
>>>> points(6:10, y=rep(6,5), pch=1:5)
>>>>
>>>>
>>>> I don't know what vegan is doing at the moment but there used to be a 
>>>> points
>>>> command for doing this (sub ordiplot, I think). Vegan mostly still uses 
>>>> base
>>>> graphics so you can always get your scores [via: scores(ord.object):
>>>> see
>>>> ?scores] from your saved ordination object and add them as per above.
>>>>
>>>> Regards, Mark.
>>>>
>>>>
>>>> Rodrigo Aluizio wrote:
>>>>>
>>>>> Hi, I'm a beginner with R, but I'm getting excellent results with it.
>>>>> Well I've got an capscale object (vegan package) and I want to made a
>>>>> biplot
>>>>> with symbols representing six groups of areas.
>>>>> With the plot.cca function and some par attributes (like 'labels') I
>>>>> was
>>>>> able to substitute the samples names for keyboard symbols
>>>>> ('x','o','#',ect),
>>>>> but it's far from the ideal.
>>>>> I've already search about it and find something using 'Hershey' fonts
>>>>> symbols for a scatterplot, but it didn't work for the biplot (capscale
>>>>> object).
>>>>> I would like to use something like squares, triangles and circles 
>>>>> (filled
>>>>> and empty).
>>>>> Does anyone have and idea to solve it?
>>>>> Thank you for your attention and patience
>>>>> Sorry if the English is not that good, I'm Brazilian.
>>>>>
>>>>> Here is the script I'm using!
>>>>>
>>>>> # The analysis
>>>>> library(vegan)
>>>>> library(xlsReadWrite)
>>>>> PotiAbio<-read.xls('PotiAbioCanoco.xls',sheet=1,rowNames=T)
>>>>> PotiBio<-read.xls('FatorialReplica.xls',sheet=8,rowNames=T)
>>>>> attach(PotiAbio)
>>>>> LogPotiBio<-log(PotiBio+1)
>>>>> dbRDA<-capscale(t(LogPotiBio)~"Environmental 
>>>>> Variables",dist="bray",add=T)
>>>>> dbRDA
>>>>>
>>>>> #Preparing to generate and save the graphic
>>>>> SymbolsRep<-read.xls('Fatores.xls',sheet=2)
>>>>> tiff('dbRDAPontos.tif',width=1250,height=1250,res=150)
>>>>> plot.cca(dbRDA,type='none',display=c('bp','sites'))
>>>>> text.cca(dbRDA,dis='cn',col=323232,cex=0.7,lwd=2,lty='dotted')
>>>>> text.cca(dbRDA,dis='sites',col='black',cex=0.8,labels=FatoresSymbols$RepSimb)
>>>>> dev.off()
>>>>> ___________________________________
>>>>> MSc. Rodrigo Aluizio
>>>>> Centro de Estudos do Mar/UFPR
>>>>> Laboratório de Micropaleontologia
>>>>> Avenida Beira Mar s/n - CEP 83255-000
>>>>> Pontal do Paraná - PR - BRASIL
>>>>> Fone: (0**41) 3455-1496 ramal 217
>>>>> Fax: (0**41) 3455-1105
>>>>>
>>>>> ______________________________________________
>>>>> 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.
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> View this message in context: 
>>>> http://www.nabble.com/Symbols-on-a-capscale-object-plot-tp19469679p19470027.html
>>>> Sent from the R help mailing list archive at Nabble.com.
>>>>
>>>> ______________________________________________
>>>> 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.
>>>>
>> 
>> ______________________________________________
>> 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.
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Symbols-on-a-capscale-object-plot-tp19469679p19473735.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list