An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-ecology/attachments/20130225/7b5d6197/attachment.pl>
question for the R community : Plot RDA biplot without axis ?
7 messages · Sarah Loboda, Gavin Simpson, Pierre THIRIET +2 more
On Mon, 2013-02-25 at 13:18 -0500, Sarah Loboda wrote:
Hi, I have trouble to obtain the ordination graph I want. I want to have 4 RDA biplot on the same page and I don't want to have (or I want to modify) the axis numbers. I want the marks on the axis without numbers to maximize the space for each RDA plot.
A problem is the call to text() ( which calls text.cca() ). It doesn't pass on arguments to the underlying axis() calls and hence you can't do what you are trying to do with that function directly. Not sure why you want the axis to be white - that draws an axis so it will obscure anything drawn before it with white paint. The only solution at the moment will be to modify the vegan:::text.cca() function to change the two calls to axis() at the end of the function definition. I suspect you could just copy the body of vegan:::text.cca and put it into your own function, but I haven't tried it. If that fails due to namespace issues, then use assignInNamespace() to assign your function to the text.cca function in vegans namespace. See the relevant help pages on how to do this. I'm about to leave the office so I can't help further now, but if you have trouble email back to the list and I'll see about cooking up and example... All the best Gavin
This seems like a simple task but I tried different approaches and coudn't
figure out how to change my axis. This is my code :
par(mfrow=c(2,2))
par(mar=c(0.2,0.2,0.2,0.2))
### first RDA biplot
with(arctic, levels(site))
shapevec<- c(19,19,19,19,19,19,19,19,19,19,19,19,6,6,6,6,6,6,6,6,6,6,6,6)
plot(spiders.rda.a, type = "n", scaling = 2, las=1, tcl=0.2,
col.axis="white")
with(spiders.env.a, points(spiders.rda.a, display = "sites",
scaling = 2, pch = shapevec, cex=1.3))
text(spiders.rda.a, display="bp", cex=1.1, col.axis="white", ann=FALSE)
#### it is when I run this line that my y axis appear on the right but I
don't want to
### in yellow, this is what I tried to make it diseappear. To put those
arguments in plot() doesn't change anything.
What should I had in the text part to make sure that the axis doesn't show
up?
My intention is to plot my sites as dots without text and my arrows for
environmental variables with the name of each variable. Any other ideas on
rda plot will be greatly appreciated.
Thank you very much :D
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-ecology/attachments/20130225/b7d7b5ab/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-ecology/attachments/20130226/a4819de0/attachment.pl>
Dear List, I am unsure if this is the right forum to direct my question and if it is not i apologise. My query is more of the theoretical / "can it be done" type than practical. I have modelled time series of fish catch in relation to a suite of environmental variables (SST, ChlA etc) using a dynamic factor analysis. The output from this is usual model output including a AIC value for each model. I then calculated AIC difference and chucked away candidate models with a AIC difference score of < 2 i.e. as per Burnham and Anderson. I then calculated the relative variable importance from the Akaike weights. I did this for 52 distinct sites. So I have for site 1 Chla = 1 - implying very important SST = 0.0 - - implying not very important Depth = 0.3 site 2 Chla = 0.4 SST = 0.2 Depth = 0.3 Etc etc Now my question - In my eyes it is reasonable to cluster these scores using vegan for example in order to understand which sites share similarities in relation to what is important in explain variance in fish catch. I have done it, it works, and the results are nice and make sense but is there something i am missing - i have not been able to find other studies using this approach? Thanks Chris Chris Mcowen Postdoctoral Scientist, Nippon Foundation Nereus Senior Fellow Marine Assessment and Decision Support Programme UNEP World Conservation Monitoring Centre 219 Huntingdon Road Cambridge CB3 0DL United Kingdom Switchboard: +44 (0)1223 277 314 Fax: +44 (0)1223 277 136 www.unep-wcmc.org
Sarah, We indeed insist on drawing scale of arrows for text() and point() function of cca/rda/capscale. Currently the only way to avoid this is to edit the function. I'll see what to do with this. One piece of advice: do not use col.axis = "white" which will draw white axes. The background of the graph is transparent but the plot is displayed on white canvas so that you cannot see white axes. The white axes are still, like you will see if you look at the graph against some other colour (which happens most easily if you copy the graph and display it in slides or in a poster with coloured background). The canonical way is to suppress axes: plot(dune.cca, type="n", scaling = 2, axes = FALSE, xlab = "", ylab = "") Here 'axes' suppress drawing axes and to be sure, xlab and ylab use zero-length strings "" so that axis labels are also suppressed. You can later use box() to frame the empty graph if needed. Cheers, Jari Oksanen
On 26 Feb 2013, at 3:49, Sarah Loboda wrote:
Hi, Here's the reproducible example that I made with dune data. When you do the 4 graphs, you can see that because of the text () function, there is an axis on the right and values appear in the plots on the right side. I understand that it is because of my text () function, but is there a way to delete that axis in the text funtion? if not, is there another way to plot my data on 4 panels without axis? I don't know what you mean by "body of vegan text.cca". You mean in the vegan tutorial ? I used col.axis because ann=FALSE as an argument in plot function does not work and col.axis seems fine... Thank you very much for your time. I really appreciate your help :D library(vegan) library(MASS) ### data data(dune) data(dune.env) ### Constrained ordination dune.hel<-decostand(dune, "hellinger") dune.cca <- cca(dune ~ A1 + Manure, data=dune.env) ### Plot with 4 panels par(mfrow=c(2,2)) par(mar=c(0.3,0.3,0.3,0.3)) ### plot 1 plot(dune.cca, type = "n", scaling = 2, col.axis="white") with(dune.env, points(dune.cca, display = "sites", scaling = 2, cex=1.3, col=2)) ### When I add the next line, it adds env. variables as arrows but also adds an axis on the right text(dune.cca, display="bp", col=1, cex=1.1) ###plot 2 plot(dune.cca, type = "n", scaling = 2, col.axis="white", col="grey") with(dune.env, points(dune.cca, display = "sites", scaling = 2, cex=1.3, col=2)) text(dune.cca, display="bp", col=1, cex=1.1) ###plot 3 plot(dune.cca, type = "n", scaling = 2, col.axis="white") with(dune.env, points(dune.cca, display = "sites", scaling = 2, cex=1.3, col=2)) text(dune.cca, display="bp", col=1, cex=1.1) ###plot 4 plot(dune.cca, type = "n", scaling = 2, col.axis="white") with(dune.env, points(dune.cca, display = "sites", scaling = 2, cex=1.3, col=2)) text(dune.cca, display="bp", col=1, cex=1.1) 2013/2/25 Gavin Simpson <gavin.simpson at ucl.ac.uk>
On Mon, 2013-02-25 at 13:18 -0500, Sarah Loboda wrote:
Hi, I have trouble to obtain the ordination graph I want. I want to have 4
RDA
biplot on the same page and I don't want to have (or I want to modify)
the
axis numbers. I want the marks on the axis without numbers to maximize
the
space for each RDA plot.
A problem is the call to text() ( which calls text.cca() ). It doesn't pass on arguments to the underlying axis() calls and hence you can't do what you are trying to do with that function directly. Not sure why you want the axis to be white - that draws an axis so it will obscure anything drawn before it with white paint. The only solution at the moment will be to modify the vegan:::text.cca() function to change the two calls to axis() at the end of the function definition. I suspect you could just copy the body of vegan:::text.cca and put it into your own function, but I haven't tried it. If that fails due to namespace issues, then use assignInNamespace() to assign your function to the text.cca function in vegans namespace. See the relevant help pages on how to do this. I'm about to leave the office so I can't help further now, but if you have trouble email back to the list and I'll see about cooking up and example... All the best Gavin
This seems like a simple task but I tried different approaches and
coudn't
figure out how to change my axis. This is my code :
par(mfrow=c(2,2))
par(mar=c(0.2,0.2,0.2,0.2))
### first RDA biplot
with(arctic, levels(site))
shapevec<- c(19,19,19,19,19,19,19,19,19,19,19,19,6,6,6,6,6,6,6,6,6,6,6,6)
plot(spiders.rda.a, type = "n", scaling = 2, las=1, tcl=0.2,
col.axis="white")
with(spiders.env.a, points(spiders.rda.a, display = "sites",
scaling = 2, pch = shapevec, cex=1.3))
text(spiders.rda.a, display="bp", cex=1.1, col.axis="white", ann=FALSE)
#### it is when I run this line that my y axis appear on the right but I
don't want to
### in yellow, this is what I tried to make it diseappear. To put those
arguments in plot() doesn't change anything.
What should I had in the text part to make sure that the axis doesn't
show
up? My intention is to plot my sites as dots without text and my arrows for environmental variables with the name of each variable. Any other ideas
on
rda plot will be greatly appreciated. Thank you very much :D
-- Sarah Loboda MSc candidate, Entomology, Department of Natural Resource Sciences McGill University *http://insectecology.mcgill.ca/* [[alternative HTML version deleted]]
_______________________________________________ R-sig-ecology mailing list R-sig-ecology at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Sarah, I added argument 'axis.bp' to text.cca and points.cca functions. To upgraded functions can be found in http://vegan.r-forge.r-project.org/ (rev2452), and will probably be included in the next minor release of vegan (2.0-7) scheduled for March, 2013. You can also get the single files from R-Forge, or you can install devel version of vegan with install.packages("vegan", repos="http://r-forge.r-project.org") It will take a day at minimum to get the version packaged in R-Forge. Cheers, Jari Oksanen
On 26 Feb 2013, at 3:49, Sarah Loboda wrote:
Hi, Here's the reproducible example that I made with dune data. When you do the 4 graphs, you can see that because of the text () function, there is an axis on the right and values appear in the plots on the right side. I understand that it is because of my text () function, but is there a way to delete that axis in the text funtion? if not, is there another way to plot my data on 4 panels without axis? I don't know what you mean by "body of vegan text.cca". You mean in the vegan tutorial ? I used col.axis because ann=FALSE as an argument in plot function does not work and col.axis seems fine... Thank you very much for your time. I really appreciate your help :D library(vegan) library(MASS) ### data data(dune) data(dune.env) ### Constrained ordination dune.hel<-decostand(dune, "hellinger") dune.cca <- cca(dune ~ A1 + Manure, data=dune.env) ### Plot with 4 panels par(mfrow=c(2,2)) par(mar=c(0.3,0.3,0.3,0.3)) ### plot 1 plot(dune.cca, type = "n", scaling = 2, col.axis="white") with(dune.env, points(dune.cca, display = "sites", scaling = 2, cex=1.3, col=2)) ### When I add the next line, it adds env. variables as arrows but also adds an axis on the right text(dune.cca, display="bp", col=1, cex=1.1) ###plot 2 plot(dune.cca, type = "n", scaling = 2, col.axis="white", col="grey") with(dune.env, points(dune.cca, display = "sites", scaling = 2, cex=1.3, col=2)) text(dune.cca, display="bp", col=1, cex=1.1) ###plot 3 plot(dune.cca, type = "n", scaling = 2, col.axis="white") with(dune.env, points(dune.cca, display = "sites", scaling = 2, cex=1.3, col=2)) text(dune.cca, display="bp", col=1, cex=1.1) ###plot 4 plot(dune.cca, type = "n", scaling = 2, col.axis="white") with(dune.env, points(dune.cca, display = "sites", scaling = 2, cex=1.3, col=2)) text(dune.cca, display="bp", col=1, cex=1.1) 2013/2/25 Gavin Simpson <gavin.simpson at ucl.ac.uk>
On Mon, 2013-02-25 at 13:18 -0500, Sarah Loboda wrote:
Hi, I have trouble to obtain the ordination graph I want. I want to have 4
RDA
biplot on the same page and I don't want to have (or I want to modify)
the
axis numbers. I want the marks on the axis without numbers to maximize
the
space for each RDA plot.
A problem is the call to text() ( which calls text.cca() ). It doesn't pass on arguments to the underlying axis() calls and hence you can't do what you are trying to do with that function directly. Not sure why you want the axis to be white - that draws an axis so it will obscure anything drawn before it with white paint. The only solution at the moment will be to modify the vegan:::text.cca() function to change the two calls to axis() at the end of the function definition. I suspect you could just copy the body of vegan:::text.cca and put it into your own function, but I haven't tried it. If that fails due to namespace issues, then use assignInNamespace() to assign your function to the text.cca function in vegans namespace. See the relevant help pages on how to do this. I'm about to leave the office so I can't help further now, but if you have trouble email back to the list and I'll see about cooking up and example... All the best Gavin
This seems like a simple task but I tried different approaches and
coudn't
figure out how to change my axis. This is my code :
par(mfrow=c(2,2))
par(mar=c(0.2,0.2,0.2,0.2))
### first RDA biplot
with(arctic, levels(site))
shapevec<- c(19,19,19,19,19,19,19,19,19,19,19,19,6,6,6,6,6,6,6,6,6,6,6,6)
plot(spiders.rda.a, type = "n", scaling = 2, las=1, tcl=0.2,
col.axis="white")
with(spiders.env.a, points(spiders.rda.a, display = "sites",
scaling = 2, pch = shapevec, cex=1.3))
text(spiders.rda.a, display="bp", cex=1.1, col.axis="white", ann=FALSE)
#### it is when I run this line that my y axis appear on the right but I
don't want to
### in yellow, this is what I tried to make it diseappear. To put those
arguments in plot() doesn't change anything.
What should I had in the text part to make sure that the axis doesn't
show
up? My intention is to plot my sites as dots without text and my arrows for environmental variables with the name of each variable. Any other ideas
on
rda plot will be greatly appreciated. Thank you very much :D
-- Sarah Loboda MSc candidate, Entomology, Department of Natural Resource Sciences McGill University *http://insectecology.mcgill.ca/* [[alternative HTML version deleted]]
_______________________________________________ R-sig-ecology mailing list R-sig-ecology at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology