[R] Visualize Sparse Matrix.

FRANCISCO XAVIER SUMBA TORAL xavier.sumba93 at ucuenca.ec
Fri Jun 10 00:27:55 CEST 2016


Hi,

First of all, sorry for my question it could be so basic for a common user in R, but I am starting with this new environment.

I have done a clustering job and I would like to visualize my vectors. I have a matrix of TF-IDF weights of 4602 x 1817. I store the values in a CSV file. How can I visualize my vectors in a 2D-space?

After that, I execute a clustering algorithm and I got a label for each cluster. How can I visualize my vectors resulting base on a color or figure for each cluster? 

This is the code that I am having trying to accomplish my graphs:

data <- read.csv(pathFile,header = FALSE, sep = ",”)
dMatrix <- matrix(unlist(data), ncol = 4602, byrow = TRUE) # Use a matrix to use melt.
# Graph my data
ggplot(melt(dMatrix), aes(Var1,Var2, fill=value)) + geom_raster() + scale_fill_gradient2(low='red', high=‘black', mid=‘white') + theme_bw() + xlab("x1") + ylab("x2")


Cheers.
	[[alternative HTML version deleted]]



More information about the R-help mailing list