Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129300] Re: question
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 29 Dec 2012 22:26:02 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20121229200946.8054D68A3@smc.vnet.net>

colors = {Red, Blue, Green};

r = 20;
c = 4;
(* r = 88 and c = 9 for your example *)

data = RandomReal[1, {r, c}];

clusters = FindClusters[
   data, Length[colors]];

n = 1;
Style[#, Background ->
    colors[[n++]]] & /@
 clusters

To color in place by cluster

Style[#, Background -> colors[[
      Position[clusters, #][[1, 1]]
      ]]] & /@
 data


Bob Hanlon


On Sat, Dec 29, 2012 at 3:09 PM, Hagwood, Charles R
<charles.hagwood at nist.gov> wrote:
>
> I have a matrix, say 88 x 9 .  I use FindCluster to find say 3 clusters, i.e. the 88  rows are partitioned into 3 clusters.  I want to use 3 colors to highlight these rows. For example, the rows in cluster 1 highlighted with color1, cluster 2 highlighted with color2 and cluster 3 highlighted with color 3.  I want to be able to read the data underneath the highlight.   How can this be done in Mathematica?
>
> Charles Hagwood
>
>



  • References:
    • question
      • From: "Hagwood, Charles R" <charles.hagwood@nist.gov>
  • Prev by Date: Re: Cursor position on images
  • Next by Date: Re: Attach legend to a family of functions?
  • Previous by thread: question
  • Next by thread: Re: question