6
$\begingroup$

My code takes a list of {x, y, z} vertices and displays a convex hull with each vertex labeled by its index in the list. Here is a minimal working example of the problem,

pts = RandomReal[{-1, 1}, {4, 3}];
chull = ConvexHullMesh[pts];
HighlightMesh[chull, Labeled[0, "Index"]]

enter image description here

However, the size of the vertex labels is tiny and I have been unable to find any method to make the text larger. Labeling the axes etc. and changing the text there is straightforward. Does anyone have an idea how to do specify the size of the vertex text. Same issue if I want the edges labeled or the faces of the triangles. I am showing a simple icosahedron.

$\endgroup$
2
  • $\begingroup$ You should include some sample data so we can try out your code. That said, have you tried using the LabelStyle option e.g. Labeled[0,"Index",LabelStyle->Directive[FontSize->20]]? $\endgroup$
    – N.J.Evans
    Mar 2, 2016 at 15:00
  • 1
    $\begingroup$ @N.J.Evans, I can't seem to find any way of changing the fontsize. Any application of LabelStyle like you suggested makes the labels vanish. And using FullForm I don't see any occurrences of Graphics3D[Text[...]] to use a replacement rule on. $\endgroup$
    – Jason B.
    Mar 2, 2016 at 15:06

1 Answer 1

4
$\begingroup$

This was difficult to find, but I think this is how you do it, using MeshCellLabel and MeshCellMarker

ConvexHullMesh[pts,
 MeshCellLabel -> {0 -> "Marker"},
 MeshCellMarker -> 
  Table[{0, n} -> Style[n, 25], {n, 1, 4}]]

enter image description here

Or you can use HighlightMesh if you've already created the ConvexHullMesh as below. You can apply any Style elements,

HighlightMesh[chull, Labeled[0, "Marker"],
 MeshCellMarker ->
  Table[{0, n} -> 
    Style[n, 25, Hue[n/4], 
     FontFamily -> "Comic Sans MS"], {n, 1, 4}]]

enter image description here

I don't see how to use Labeled to label different cell specs, but you can use MeshCellLabel in this way,

ConvexHullMesh[pts,
  MeshCellLabel -> {0 -> "Marker", 1 -> "Marker", 2 -> "Marker"},
  MeshCellMarker -> Join[
      Table[{0, n} -> 
          Style[n, 25, Red, 
            FontFamily -> "Comic Sans MS"], {n, 1, 4}],
      Table[{1, n} -> 
          Style[n, 35, Blue, 
            FontFamily -> "Courier"], {n, 1, 6}],
      Table[{2, n} -> Style[n, 35, Purple, 
            FontFamily -> "Times New Roman"], {n, 1, 4}]
      ]]

enter image description here

$\endgroup$
0

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.