2
$\begingroup$

I am using ListLinePlot to represent a closed circuit of points (forming a polyhedron). I am trying to label each node (point) of the cycle, but the node that is present twice gets no label.

This is my example:

ListLinePlot[{{11, 7}, {7, 9}, {15, 15}, {16, 12}, {11, 7}} -> {"A'", 
   "B'", "C'", "D'", " "}, 
 LabelingFunction -> 
  Callout[Automatic, Automatic, Appearance -> None], 
 Filling -> Bottom, AspectRatio -> Automatic, 
 PlotRange -> {{0, 20}, {0, 20}}, AxesLabel -> {"z1", "z2"}, 
 Mesh -> Full, 
 GridLines -> Function[{min, max}, Range[Floor[min], Ceiling[max]]]]

This is the result I get:

enter image description here

I think the problem is with point {11, 7} (that should be labelled with "A'"), which appears twice in the main argument of the function ListLinePlot. I tried different approaches, but nothing seemed to work.

Any assistance will be appreciated.

$\endgroup$

2 Answers 2

3
$\begingroup$

Since you don't seem to want the stem / leader feature from Callout, try LabelingFunction -> Labeled instead. The results are practically identical to what you show in your answer:

ListLinePlot[
  {{11, 7}, {7, 9}, {15, 15}, {16, 12}, {11, 7}} -> {"A'", "B'", "C'", "D'", ""},

  LabelingFunction -> Labeled, 

  Filling -> Bottom,
  AspectRatio -> Automatic,
  PlotRange -> {{0, 20}, {0, 20}},
  AxesLabel -> {"z1", "z2"},
  Mesh -> Full, 
  GridLines -> Function[{min, max}, Range[Floor[min], Ceiling[max]]]
]

same figure, all labels showing

$\endgroup$
3
$\begingroup$

I found a way, using Show, which allows overlaying different plots:

Show[
 ListLinePlot[{{11, 7}, {7, 9}, {15, 15}, {16, 12}, {11, 7}} -> {"A'",
     "B'", "C'", "D'", "-"}, 
  LabelingFunction -> 
   Callout[Automatic, Automatic, Appearance -> None], 
  Filling -> Bottom, AspectRatio -> Automatic, 
  PlotRange -> {{0, 20}, {0, 20}}, AxesLabel -> {"z1", "z2"}, 
  Mesh -> Full, 
  GridLines -> Function[{min, max}, Range[Floor[min], Ceiling[max]]]],
 ListLinePlot[{{11, 7}} -> {"A'"}, 
  LabelingFunction -> 
   Callout[Automatic, Automatic, Appearance -> None], 
  PlotRange -> {{0, 20}, {0, 20}}]
 ]

I get this:

enter image description here

Anyway, I think a solution without using the Show hack should be possible.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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