[R] Recurrence plots in R using different colours
l.handke at tu-braunschweig.de
l.handke at tu-braunschweig.de
Thu Oct 12 15:18:17 CEST 2017
Hello,
I am an absolutely beginner with regards to R, so forgive me for my
potentially very stupid questions.
I have been attempting to create recurrence plots using R. The data I am
using is based on a mutually exclusive and exhaustive coding scheme with
over 40 individual codes which can be assigned to 6 higher order categories.
When I carry out the usual rqa command, my plot is pretty much black - no
surprises there really considering the exhaustive nature of my coding scheme
and the fact that there are only 6 different categories.
What i would like to do is colour-code my categories in order to arrive at a
plot that shows the colour of the reccurence of the specific category.
Eventually that would mean a plot with six different colours (next to white,
which means no recurrence), rather than the plain black and white plot which
does not reflect the nature of the recurrence. I hope that my explanation is
clear enough.
My procedure up until now has been:
1) perform a recurrence quantification analysis:
testplot <- rqa(time.series = test$Code, embedding.dim = 1, time.lag = 1,
radius = 0.1,lmin =2, vmin =2, distanceToBorder = 2, save.RM
= TRUE, do.plot = TRUE)
This plot is based on a TRUE FALSE sparse matrix.
2) Accordingly the next step was to transform this TRUE FALSE matrix to one
that contains the values for the codes for TRUE and 0 for false:
RP1 <- testplot$recurrence.matrix
RP2 <- as.matrix(RP1)*1
TS <- test$Code
for (i in seq(1,dim(RP2)[1])) {
for (j in seq(1,dim(RP2)[1])) {
if (RP2[i,j] == 1) {
RP2[i,j] <- TS[i]
}
}
}
This results in a matrix of this type:
1 0 3 1
0 4 0 0
1 0 5 6
Now I am missing step 3 --> how can plot this matrix by previously assigning
different colours to the numbers?
Thank you in advance for your help!
Best, Lisa
--
M.Sc. Lisa Handke
Technische Universität Braunschweig
Institut für Psychologie
Lehrstuhl für Arbeits-, Organisations- und Sozialpsychologie
Spielmannstrasse 19, Raum 103
D-38106 Braunschweig
Phone: +49 (0)531-391-2539
Fax: +49 (0)531-391-8173
Mail: <mailto:l.handke at tu-braunschweig.de> l.handke at tu-braunschweig.de
<http://www.tu-braunschweig.de/psychologie/abt/aos>
www.tu-braunschweig.de/psychologie/abt/aos
[[alternative HTML version deleted]]
More information about the R-help
mailing list