[R] heat color on age visible on ordination
Jim Lemon
drjimlemon at gmail.com
Tue May 24 05:37:34 CEST 2016
Hi Jackson,
I'll take a wild guess at "What is wrong?". You only got one end of
the color vector, probably the purple end. As my recollection of
principal components analysis is of a data reduction method, you
probably have a lot fewer than 500 points on your plot. If you only
have, say, 50 values to plot, you will only use up 50 colors. If this
is a good guess, you will have to link the colors to the values you
are plotting, not the original values. I have very little idea of what
either set of values is like, but you may be able to work it out.
Jim
On Tue, May 24, 2016 at 12:34 PM, Jackson Rodrigues
<jacksonmrodrigues at gmail.com> wrote:
> Hi Jim,
>
> thank you very much!
> It seems to be very easy!
>
> Another question, how to implement it on ordination? What is wrong?
>
> test.pca<-rda(mat5)
> plot(test.pca, col=agecol,display="sites", cex=1, type="p",scaling=-3)
>
> Thank you very much again
>
> Jackson
>
> 2016-05-23 23:08 GMT-03:00 Jim Lemon <drjimlemon at gmail.com>:
>>
>> Hi Jackson,
>> One way to assign colors to values is:
>>
>> library(plotrix)
>> ages<-seq(1, 50000, by = 100)
>> agecol<-color.scale(ages,extremes=c("purple","red"))
>>
>> Then just use "agecol" for your point colors.
>>
>> Jim
>>
>>
>> On Tue, May 24, 2016 at 11:57 AM, Jackson Rodrigues
>> <jacksonmrodrigues at gmail.com> wrote:
>> > Hi everybody,
>> >
>> > I have a big matrix spread over a long time period.
>> > I would like to make a ordination plot (PCA, CA, DCA etc) of this matrix
>> > and look for patterns on time by exploring a color scheme (I have heat
>> > color in mind).
>> > The idea is to use a progressive color scheme ranging from red (the
>> > oldest
>> > age) until purple (the youngest one). Then, make a ordination and see if
>> > the similar colors are plotted together, if so , I would have a pattern
>> > on
>> > time easily identifiable on 2 dimensions.
>> >
>> > Let me give an hypothetical case to you.
>> >
>> > mat5 <- matrix(rnorm(2000), ,4) #I have a matrix
>> > mat5
>> > seq<-seq(1, 50000, by = 100) # I have a time sequence of 500 dates
>> > ranging
>> > from 50000 to 1
>> > seq
>> >
>> > rownames(mat5) <- c(seq ) # making ages the row names of the matrix
>> >
>> > library("vegan")
>> > test.pca<-rda(mat5) # Ordination (PCA)
>> >
>> > plot(test.pca, scaling=-3) # In this plot I would like to have the old
>> > ages
>> > ranging from red (age 50000) to purple (age 1)
>> >
>> > Would that be possible??
>> >
>> > Thank you all for any help
>> >
>> > Jackson M. Rodrigues
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-help at r-project.org 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.
>
>
>
>
> --
>
> Jackson M. Rodrigues
> Department of Palynology and Climate Dynamics
> Albrecht-von-Haller-Institute for Plant Sciences
> Georg-August-University Göttingen
> Untere Karspuele 2
> 37073 Göttingen/Germany
> Tel.: 0049 (0) 176 8186 4994
> Web: http://www.uni-goettingen.de/en/306700.html
>
> "In order to succeed, we must first believe that we can."
> Nikos Kazantzakis
More information about the R-help
mailing list