Skip to content
Back to formatted view

Raw Message

Message-ID: <6BAD2DF3-D978-4C70-B547-B78CCFC8DBD3@ucuenca.ec>
Date: 2016-06-09T22:27:55Z
From: FRANCISCO XAVIER SUMBA TORAL
Subject: Visualize Sparse Matrix.

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]]