Skip to main content
added 46 characters in body
Source Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

Is there a way to dynamically define a polygon on a plot (I'm working with ListPlotListPlot and SmoothDensityHistogramSmoothDensityHistogram) to select a cluster of interest, and give the positions of those points in the original list of data?

I'd appreciate any help!

Here's just an example set of points:

pointsx = RandomSample[
Transpose[{Flatten[
     {RandomReal[{0, 5}, 20], 
      RandomReal[{4, 4.5}, 10]}], 
 Flatten[    {RandomReal[1, 20],
      RandomReal[{1.5, 2}, 10]}]
    }],;

points 30];= Transpose[Join @@@ x] ~RandomSample~ 30;

SmoothDensityHistogram[points, ColorFunction -> "TemperatureMap"]
ListPlot[points, PlotRange -> {{0, 5.5}, {0, 2.5}}]

Is there a way to dynamically define a polygon on a plot (I'm working with ListPlot and SmoothDensityHistogram) to select a cluster of interest, and give the positions of those points in the original list of data?

I'd appreciate any help!

Here's just an example set of points:

points = RandomSample[
Transpose[{Flatten[{RandomReal[{0, 5}, 20], 
   RandomReal[{4, 4.5}, 10]}], 
 Flatten[{RandomReal[1, 20], RandomReal[{1.5, 2}, 10]}]}], 30];
SmoothDensityHistogram[points, ColorFunction -> "TemperatureMap"]
ListPlot[points, PlotRange -> {{0, 5.5}, {0, 2.5}}]

Is there a way to dynamically define a polygon on a plot (I'm working with ListPlot and SmoothDensityHistogram) to select a cluster of interest, and give the positions of those points in the original list of data?

I'd appreciate any help!

Here's just an example set of points:

x = {
     {RandomReal[{0, 5}, 20],
      RandomReal[{4, 4.5}, 10]},
     {RandomReal[1, 20],
      RandomReal[{1.5, 2}, 10]}
    };

points = Transpose[Join @@@ x] ~RandomSample~ 30;

SmoothDensityHistogram[points, ColorFunction -> "TemperatureMap"]
ListPlot[points, PlotRange -> {{0, 5.5}, {0, 2.5}}]
Tweeted twitter.com/#!/StackMma/status/184793238706733056
Source Link
Daniel S
  • 233
  • 1
  • 8

Interactively extract points from a plot (ListPlot or SmoothDensityHistogram)

Is there a way to dynamically define a polygon on a plot (I'm working with ListPlot and SmoothDensityHistogram) to select a cluster of interest, and give the positions of those points in the original list of data?

I'd appreciate any help!

Here's just an example set of points:

points = RandomSample[
Transpose[{Flatten[{RandomReal[{0, 5}, 20], 
   RandomReal[{4, 4.5}, 10]}], 
 Flatten[{RandomReal[1, 20], RandomReal[{1.5, 2}, 10]}]}], 30];
SmoothDensityHistogram[points, ColorFunction -> "TemperatureMap"]
ListPlot[points, PlotRange -> {{0, 5.5}, {0, 2.5}}]