1
$\begingroup$

I use this code to find the ConvexHull for some points:

pts2 = {{2, 1}, {5, 0}, {7, 0}, {9, 5}, {6, 8}, {0, 6}, {0, 4}};
Show[ConvexHullMesh[pts2, GridLines -> Automatic], Axes -> True]

the result is this pic:

enter image description here

I need the result like this:

enter image description here

$\endgroup$
4
$\begingroup$

Update

(included more style specifications as requested in the comments)

You can use BaseStyle to control the appearance of the convex hull, and you can extract the coordinates of a mesh by using mesh["Coordinates"]. Finally, Arrowheads can be used to style the axes:

pts2={{2,1},{5,0},{7,0},{9,5},{6,8},{0,6},{0,4}};

mesh = ConvexHullMesh[
    pts2,
    BaseStyle->{FrontFaceColor->None,EdgeColor->Black,FrontFaceOpacity->0}
];
Show[
    mesh,
    Graphics[{PointSize[Large],Point[mesh["Coordinates"]]}],
    GridLines->Automatic,
    Axes->True,
    AxesStyle->Arrowheads[{0.0,0.05}]
]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks, @Carl Woll How can I show the point in the vertex and change the lines color to be Black, also How to add the narrows on x-axes $\endgroup$ – Ateq Alsaadi Mar 27 '18 at 21:14
3
$\begingroup$

Another way is with MeshCellStyle.

pts2 = {{2, 1}, {5, 0}, {7, 0}, {9, 5}, {6, 8}, {0, 6}, {0, 4}};

ConvexHullMesh[pts2, 
  Axes -> True, 
  AxesStyle -> Arrowheads[{0.0, 0.05}], 
  GridLines -> Automatic, 
  MeshCellStyle -> {0 -> {PointSize[Large], Opacity[1], Black}, 
    1 -> {Thick, Black}, 2 -> None}
]

enter image description here

For whatever reason, the setting 2 -> None is influencing the vertices. This is why I manually set Opacity[1].

$\endgroup$
1
$\begingroup$

Here is an approximate facsimile:

ch = MeshPrimitives[ConvexHullMesh[pts2], 2];
bb = BoundingRegion[pts2];
cent = Mean[pts2];

Graphics[{{EdgeForm[Directive[Dashed, AbsoluteThickness[1]]], FaceForm[], bb},
          {EdgeForm[Black], FaceForm[], ch},
          {AbsolutePointSize[6], Point[pts2]},
          {Text[Style["Γ", FontFamily -> "Times", FontSize -> 14], cent],
           Text[TraditionalForm[Subscript["O", Row[{0, 0}]]], {0, 0}, {1.2, 1.2}],
           Text[TraditionalForm[Subscript["O", Row[{∞, ∞}]]], Last[bb], -{1.2, 1.2}]},
          {MapIndexed[Text[Subscript["γ", #2[[1]]], cent + 0.9 (Mean[#] - cent)] &, 
                      Partition[ch[[1, 1]], 2, 1, 1]]}},
         Axes -> True, AxesLabel -> {Style["μ", Medium], Style["ν", Medium]}, 
         AxesStyle -> Arrowheads[{0., 0.05}],
         GridLines -> Automatic, GridLinesStyle -> Directive[Dotted, Opacity[1/4]],
         Method -> {"AxesInFront" -> False, "GridLinesInFront" -> False},
         PlotRangePadding -> Scaled[0.1],
         Ticks -> {{{bb[[2, 1]], Subscript["O", Row[{∞, 0}]]}},
                   {{bb[[2, 2]], Subscript["O", Row[{0, ∞}]]}}}]

figure

$\endgroup$
0
$\begingroup$
    Graphics[Line /@ Partition[AppendTo[pts2, First[pts2]], 2, 1],
GridLines -> Automatic]
$\endgroup$
0
$\begingroup$
ListPlot[AppendTo[pts2, First[pts2]], PlotStyle -> {Black}, 
 Joined -> True, Mesh -> All, 
 GridLines -> {Range[0, 10, 0.5], Range[0, 10, 0.5]}, 
 GridLinesStyle -> Directive[Gray, Dotted], AspectRatio -> 1, 
 AxesStyle -> Arrowheads[{0.0, 0.05}]]

enter image description here

$\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.