0
$\begingroup$

I have the following data;

pnts = {{-1.8, 0.2}, {-1.8, 0.4}, {-1.8, 0.6}, {-1.8, 0.8}, {-1.8, 
1.}, {-1.8, 1.2}, {-1.8, 1.4}, {-1.8, 1.6}, {-1.8, 1.8}, {-1.8, 
2.}, {-1.6, 0.2}, {-1.6, 0.4}, {-1.6, 0.6}, {-1.6, 0.8}, {-1.6, 
1.}, {-1.6, 1.2}, {-1.6, 1.4}, {-1.6, 1.6}, {-1.6, 1.8}, {-1.6, 
2.}, {-1.4, 0.2}, {-1.4, 0.4}, {-1.4, 0.6}, {-1.4, 0.8}, {-1.4, 
1.}, {-1.4, 1.2}, {-1.4, 1.4}, {-1.4, 1.6}, {-1.4, 1.8}, {-1.4, 
2.}, {-1.2, 0.2}, {-1.2, 0.4}, {-1.2, 0.6}, {-1.2, 0.8}, {-1.2, 
1.}, {-1.2, 1.2}, {-1.2, 1.4}, {-1.2, 1.6}, {-1.2, 1.8}, {-1.2, 
2.}, {-1., 0.2}, {-1., 0.4}, {-1., 0.6}, {-1., 0.8}, {-1., 
1.}, {-1., 1.2}, {-1., 1.4}, {-1., 1.6}, {-1., 1.8}, {-1., 
2.}, {-0.8, 0.2}, {-0.8, 0.4}, {-0.8, 0.6}, {-0.8, 0.8}, {-0.8, 
1.}, {-0.8, 1.2}, {-0.8, 1.4}, {-0.8, 1.6}, {-0.8, 1.8}, {-0.8, 
2.}, {-0.6, 0.2}, {-0.6, 0.4}, {-0.6, 0.6}, {-0.6, 0.8}, {-0.6, 
1.}, {-0.6, 1.2}, {-0.6, 1.4}, {-0.6, 1.6}, {-0.6, 1.8}, {-0.6, 
2.}, {-0.4, 0.2}, {-0.4, 0.4}, {-0.4, 0.6}, {-0.4, 0.8}, {-0.4, 
1.}, {-0.4, 1.2}, {-0.4, 1.4}, {-0.4, 1.6}, {-0.4, 1.8}, {-0.4, 
2.}, {-0.2, 0.2}, {-0.2, 0.4}, {-0.2, 0.6}, {-0.2, 0.8}, {-0.2, 
1.}, {-0.2, 1.2}, {-0.2, 1.4}, {-0.2, 1.6}, {-0.2, 1.8}, {-0.2, 
2.}, {0., 0.2}, {0., 0.4}, {0., 0.6}, {0., 0.8}, {0., 1.}, {0., 
1.2}, {0., 1.4}, {0., 1.6}, {0., 1.8}, {0., 2.}, {0.2, 0.2}, {0.2,
 0.4}, {0.2, 0.6}, {0.2, 0.8}, {0.2, 1.}, {0.2, 1.2}, {0.2, 
1.4}, {0.2, 1.6}, {0.2, 1.8}, {0.2, 2.}, {0.4, 0.2}, {0.4, 
0.4}, {0.4, 0.6}, {0.4, 0.8}, {0.4, 1.}, {0.4, 1.2}, {0.4, 
1.4}, {0.4, 1.6}, {0.4, 1.8}, {0.4, 2.}, {0.6, 0.2}, {0.6, 
0.4}, {0.6, 0.6}, {0.6, 0.8}, {0.6, 1.}, {0.6, 1.2}, {0.6, 
1.4}, {0.6, 1.6}, {0.6, 1.8}, {0.6, 2.}, {0.8, 0.2}, {0.8, 
0.4}, {0.8, 0.6}, {0.8, 0.8}, {0.8, 1.}, {0.8, 1.2}, {0.8, 
1.4}, {0.8, 1.6}, {0.8, 1.8}, {0.8, 2.}, {1., 0.2}, {1., 
0.4}, {1., 0.6}, {1., 0.8}, {1., 1.}, {1., 1.2}, {1., 1.4}, {1., 
1.6}, {1., 1.8}, {1., 2.}, {1.2, 0.2}, {1.2, 0.4}, {1.2, 
0.6}, {1.2, 0.8}, {1.2, 1.}, {1.2, 1.2}, {1.2, 1.4}, {1.2, 
1.6}, {1.2, 1.8}, {1.2, 2.}, {1.4, 0.2}, {1.4, 0.4}, {1.4, 
0.6}, {1.4, 0.8}, {1.4, 1.}, {1.4, 1.2}, {1.4, 1.4}, {1.4, 
1.6}, {1.4, 1.8}, {1.4, 2.}, {1.6, 0.2}, {1.6, 0.4}, {1.6, 
0.6}, {1.6, 0.8}, {1.6, 1.}, {1.6, 1.2}, {1.6, 1.4}, {1.6, 
1.6}, {1.6, 1.8}, {1.6, 2.}, {1.8, 0.2}, {1.8, 0.4}, {1.8, 
0.6}, {1.8, 0.8}, {1.8, 1.}, {1.8, 1.2}, {1.8, 1.4}, {1.8, 
1.6}, {1.8, 1.8}, {1.8, 2.}, {2., 0.2}, {2., 0.4}, {2., 0.6}, {2.,
 0.8}, {2., 1.}, {2., 1.2}, {2., 1.4}, {2., 1.6}, {2., 1.8}, {2., 
2.}};
newpnts = Select[pnts, ! #[[1]]^2 + #[[2]]^2 < 1 &];
ListPlot[newpnts];

The graph of newpnts is essentially a uniform spread of points with increment .2, that has had points excluded where x^2+y^2<1. I wanted to know if there was an easy way to get mathematica to connect the boundary points for me. Essentially it would be creating 4 line segments and a semi circle. Is the only way to do this to create functions for each segment? If so how do I lay all 5 functions on the same plot?

$\endgroup$
1
$\begingroup$
{xmin, xmax} = MinMax[newpnts[[All, 1]]];

{ymin, ymax} = MinMax[newpnts[[All, 2]]];

RegionPlot[
 xmin <= x <= xmax && ymin <= y <= ymax && x^2 + y^2 >= 1, 
  {x, -2, 2}, {y, 0, 2},
 PlotStyle -> White,
 BoundaryStyle -> Red,
 Epilog -> {Blue, Point[newpnts]}, 
 AspectRatio -> 1/2]

enter image description here

| improve this answer | |
$\endgroup$
1
$\begingroup$

If I understand correctly you are interested in simply drawing lines with know equations for this specific set of points:

Show[
ListPlot[newpnts],
Graphics[{Red,Thick,Line[{{-1,.2},{-1.8,.2},{-1.8,2},{2,2},{2,.2},{1,.2}}]}],
ContourPlot[x^2+y^2==1,{x,-1,1},{y,.2,1},ContourStyle->Directive[Red,Thick]]
]

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.