Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14996

Re: labeling clustered data

From W Craig Carter <ccarter@MIT.EDU>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: labeling clustered data
Date 2013-06-25 06:51 +0000
Message-ID <kqbem8$fo5$1@smc.vnet.net> (permalink)
References <20130623004608.B6FC269BF@smc.vnet.net> <20130624025458.83E036275@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


Hello Bob,
This is something I've been meaning to do for myself for a while; so I've added a graphical feature to your nice solution.

<< ComputationalGeometry`

data = Flatten[{RandomReal[{0, 1.5}, {10, 2}],
    RandomReal[{0.5, 2}, {10, 2}]}, 1];


Module[{
  n = 1,
  clusters = FindClusters[data, 2]
  },
 ListPlot[clusters,
  Epilog -> {Text[n++, #, {-1.5, -1.5}] & /@ data,
    ({Hue[RandomReal[]], Opacity[0.5],
        GraphicsComplex[#, Polygon@ConvexHull[#]]} &) /@ clusters},
  PlotMarkers -> Automatic,
  PlotRange -> 2 {{-0.1, 1.1}, {-0.1, 1.1}},
  Frame -> True,
  Axes -> False
  ]
 ]


W Craig Carter
Professor of Materials Science, MIT



On Jun 23, 13, at 22:54 PM, Bob Hanlon wrote:

>
> data = RandomReal[{}, {10, 2}];
>
>
>
> Module[{n = 1},
> ListPlot[data,
>  Epilog -> {
>    Text[n++, #, {-1, -1}] & /@
>     data},
>  PlotRange ->
>   {{-0.1, 1.1}, {-0.1, 1.1}},
>  Frame -> True, Axes -> False]]
>
>
>
> Module[{n = 1},
> ListPlot[FindClusters[data, 2],
>  Epilog -> {
>    Text[n++, #, {-1.5, -1.5}] & /@
>     data},
>  PlotMarkers -> Automatic,
>  PlotRange ->
>   {{-0.1, 1.1}, {-0.1, 1.1}},
>  Frame -> True, Axes -> False]]
>
>
>
> Bob Hanlon
>
>
>
>
> On Sat, Jun 22, 2013 at 8:46 PM, <ahmedco31@hotmail.com> wrote:
>
>> Hi, I have a list of 2D points like this {{a,b},{x,y},...}, and I don't
>> know how to plot them with labeled dots such that the first point labeled
>> with number 1 and the second point labeled with 2, ...etc. Then I use the
>> clustering function "FindClusters" to cluster the points into 2 groups, how
>> can I plot the resulted list of two groups of points such that I keep the
>> same labeling order?
>>
>> Thanks in advance
>>
>>
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar


Thread

Re: labeling clustered data W Craig Carter <ccarter@MIT.EDU> - 2013-06-25 06:51 +0000

csiph-web