How to visualize clusters on heatmap

809 views
Skip to first unread message

PATHWAYGEEK

unread,
Feb 16, 2011, 9:30:54 PM2/16/11
to ggplot2
Hello,

I am able to use ggplot to generate a heatmap using geom="tile". My
question is: which function to use to find clusters on the heatmap?

Thank you
San

Mateusz

unread,
Feb 17, 2011, 4:43:12 AM2/17/11
to ggplot2
Dear San,

Clustering can be a quite complex task, there are tons of publications
on that and even entire R package, depending which algorithm You want
to use and how You want to define clusters. This is complex topic I
don't think ggplot2 which is a graphic drawing library is implementing
anything like that.

There is kmeans algorithm which you might want to use
http://www.r-chart.com/2010/09/bot-botany-k-means-and-ggplot2.html
After You cluster Your data, You might want to arrange them correctly
on the heatmap by scale_x_discrete(...) and scale_y_discrete(...) for
that You can refer to very good example on
http://theatavism.blogspot.com/2009/05/plotting-correlation-matrix-with.html

For a dendogram in ggplot2 You might want to look at
http://stats.stackexchange.com/questions/4062/how-to-plot-a-fan-polar-dendrogram-in-r
and then maybe just use different coord system.

I hope this helps :) I did correlation map but never tried any
clusters visualization yet. I might be interested in that in a couple
of days.
There is also this "NeatMap" package for R using ggplot2, but I
haven't looked into it yet.
Reply all
Reply to author
Forward
0 new messages