0
$\begingroup$

I have the Voronoi diagram code working for the set of points in data1. I'd like to plot the points in data2 on the Voronoi diagram and show them in red. Any assistance is most appreciated!

data1 = {{1, 5}, {3, 2}, {18, 20}, {47, 55}, {8, 12}, {9, 33}, {88, 
    77}, {45, 12}, {45, 87}, {4, 85}, {12, 22}, {56, 34}, {38, 
    42}, {38, 22}, {75, 35}, {83, 59}, {80, 50}, {85, 55}, {0, 
    40}, {0, 60}, {10, 65}, {50, 60}};
data2 = {{5, 1}, {2, 3}, {30, 20}};
Show[HighlightMesh[
  VoronoiMesh[data1], {Style[2, White], Style[1, Blue]}], 
 Graphics[{PointSize[Medium], Blue, Point[data1]}], Frame -> True, 
 PlotRange -> Full]
$\endgroup$
4
  • $\begingroup$ How the data2 affect the original plot? $\endgroup$
    – cvgmt
    Aug 1 at 0:53
  • $\begingroup$ I just want to plot the coordinates in data2 onto the existing Voronoi. $\endgroup$
    – PRG
    Aug 1 at 1:00
  • 2
    $\begingroup$ I mean, you're already using Graphics[] in Show[], so why aren't you using that for your other set of points as well? Graphics[{PointSize[Medium], {Blue, Point[data1]}, {Red, Point[data2]}}] $\endgroup$ Aug 1 at 1:48
  • $\begingroup$ perfect!! ... many thanks!! $\endgroup$
    – PRG
    Aug 1 at 2:36

0

Browse other questions tagged or ask your own question.