"Patrick Großmann"
2011-Jun-14 20:10 UTC
[R] color specific(!) lines in different color with in parcoord plots
Dear Madame or Sir,
in my current project, I have so far used a lot of very different plots. I am
now trying to gain informatin with the help of parallel coordinate plots.
Therefore, I use the function "parcoord" of the MASS package. What I
would like to do, is to color let's say the points according to the first
half of rows of a specific matrix/dataframe in a color different from the color
according to the second half of rows (resp. coordinates).
For example:
Assume, table is a matrix/dataframe with nrow(table) = 20, I would like to
generate a parcoord plot and color points of table[1:10,] in green and
table[11:20,] in yellow. The background is, that I have two (or more) datasets
to be analyzed and I thought it would be much more efficient and easier in
general to merge them into one big table (please let me know, if you have any
idea better from that). With an ordinary 2d scatterplot, I could do something
like:
plot(table[1:10,1], table[1:10,2])
# and then add the rest by means of points
points(table[11:20,1] , table[11:20,2])
which makes it easy to write various own functions. However, this is the goal:
seperate objects according to their (row- or even column-)position.
I tried something like
library(MASS)
parcoord(table[,c(1,2)], col = c("green", "yellow"))
but as I figure out, the colors of the lines/points plotted, alternate, meaning
all points referring to uneven rownumbers are colord in green and respectivley
all even rownumbers in yellow. Same with three or more colors; it just
continously goes through the vector of colors, right?
Acoordingly, my questions concerns on how the plot function uses col and if
there is any way to "manipulate".
I looked up the api of plot and matplot, but I was not able to find a general
enough defnition or explanation of the option "col", sorry.
Kind regards and thank you for your response in advance,
-Patrick Grossmann
--
Patrick Großmann - HiWi zur Netzwerkdokumentation
Network Operation Center NOC
Hochschulrechenzentrum HRZ Universität Bielefeld
Büro:
UHG V0-251
Telefon:
+49 521 106-12618
Fax:
+49 521 106-2969
Telefon Sekretariat:
+49 521 106-4951
http://www.uni-bielefeld.de/hrz/
[[alternative HTML version deleted]]
Daniel Malter
2011-Jun-14 20:34 UTC
[R] color specific(!) lines in different color with in parcoord plots
Hi, Why does the second example on ?parcoord help page not help you with that? ?parcoord ir <- rbind(iris3[,,1], iris3[,,2], iris3[,,3]) parcoord(log(ir)[, c(3, 4, 2, 1)], col = 1 + (0:149)%/%50) If that does not do, feel free to get back. Daniel -- View this message in context: http://r.789695.n4.nabble.com/color-specific-lines-in-different-color-with-in-parcoord-plots-tp3597709p3597748.html Sent from the R help mailing list archive at Nabble.com.