Reputation: 815
I have a set of cluster output. I want to show each cluster with unique color in parallel coordinate graph. I am using rggobi for parallel coordinate graph. I used this link http://www.ggobi.org/docs/parallel-coordinates/
here is my code to load the data to ggobi
library(rggobi)
mydata <- read.table("E:/Thesis/Experiments/R/input.cvs",header = TRUE,sep = ",")
g <- ggobi(mydata)
here is my output
I want to use different color to represent different clusters.
Upvotes: 1
Views: 2180
Reputation: 13280
You could also use MASS:::parcoord():
require(MASS)
cols = c('red', 'green', 'blue')
parcoord(iris[ ,-5], col = cols[iris$Species])
Or with ggplot2:
require(ggplot2)
require(reshape2)
iris$ID <- 1:nrow(iris)
iris_m <- melt(iris, id.vars=c('Species', 'ID'))
ggplot(iris_m) +
geom_line(aes(x = variable, y = value, group = ID, color = Species))
Please note also this post!
Upvotes: 4