For my work, I am examining the values of a complex function as I vary the input according to a real parameter, and I want to both give the general plot and the plot of specific points, with labels (so one sees the direction of increase).

I knew from the documentation that Point and Epilog together allow you to label points on graphs; e.g.,

ourF[z_] := z^2;
parts[z_] := {Re[z], Im[z]}
ParametricPlot[parts[ourF[x + I/4]], {x, -3 , 3}, 
 Epilog -> {{PointSize[Medium], 
    Point[Table[parts[ourF[ j + I/4]], {j, -3, 3}]]}}]

This produces:

A plot with labeled points, just as in the documentation

Looking at the answers to this site's Question 1854 (especially Jacob Jurmain's), Listplot in newer versions of Mathematica has a Labeled option that labels the points in the Listplot. Indeed, I can get what I want by making a Plot and Listplot separately and then Showing them together. e.g.

ourF[z_] := z^2;
parts[z_] := {Re[z], Im[z]}
plotOne = ParametricPlot[parts[ourF[x + I/4]], {x, -3 , 3}];
plotTwo = ListPlot[Table[Labeled[parts[ourF[ j + I/4]],
     Row[{"x = ", j}], Right
     ], {j, -3, 3}]];
Show[plotOne, plotTwo]

which yields

A plot with labeled points

as required.

My first attempt, however, was to simply put the ListPlot in the Epilog, e.g.

ourF[z_] := z^2;
parts[z_] := {Re[z], Im[z]}
ParametricPlot[parts[ourF[x + I/4]], {x, -3 , 3}, 
 Epilog -> {ListPlot[Table[Labeled[parts[ourF[ j + I/4]],
      Row[{"x = ", 13/10 + j/10}], Right
      ], {j, -3, 3}]]}]

This yields the error:

Graphics is not a Graphics primitive or directive.

I guess ParametricPlot calls Graphics, and Listplot is now calling Graphics inside the other Graphics, hence the issue.

I also tried putting Labeled in the Point variation, but Point doesn't know what to do with the label, and the error message becomes

Coordinate Labeled[{8.9375, -1.5}, Row[{"x = ", 1}], Right] should be a pair of numbers, or a Scaled or Offset form.  

Q: Is there any way of putting it all in one plotting command?

P.S.: An answer in the vein of, "You have acceptable output, stop worrying about it" would also be reasonable. I am new to Mathematica, but it seems to the newcomer as though Mathematica puts in one line what I would use 5-10 lines in MATLAB to set up, and [after having debugged] the fewest number of lines is the best.

  • 1
    $\begingroup$ Add First on ListPlot. Related: 73402, because Epilog essentially accepts the same what Graphics does. $\endgroup$
    – Kuba
    Feb 12, 2015 at 19:39
  • $\begingroup$ Are you satisfied with any of the answers here, or do they still leave issues unaddressed? Please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, or leave a comment indicating what needs to be done. Also, consider taking the tour, if you have not done so. $\endgroup$
    – Michael E2
    May 26, 2015 at 22:18

2 Answers 2


Just to show you can readily do this directly with graphics primitives:

ourF[z_] := z^2;
parts[z_] := {Re[z], Im[z]}
ParametricPlot[parts[ourF[x + I/4]], {x, -3, 3},
    Epilog -> Table[{ {PointSize[.01], Red, Point@#},
        Text[Row[{"x = ", 13/10 + j/10}], #, {-2, 0}]} &@
        parts[ourF[j + I/4]], {j, -3, 3}],
          PlotRangePadding -> {{0, 1}, {1, 1}}]

enter image description here


You are five keystrokes ([[1]]) close to something that works (See also: this and this)

ParametricPlot[parts[ourF[x + I/4]], {x, -3, 3}, PlotRangeClipping -> False, ImagePadding -> 30,
 Epilog -> ListPlot[Table[Labeled[parts[ourF[j + I/4]], Row[{"x = ", 13/10 + j/10}], Right], 
                    {j, -3, 3}]][[1]]]

enter image description here

Alternatively, you can use ParametricPlot[...][[1]] as the Epilog setting in ListPlot:

ListPlot[Table[Labeled[parts[ourF[j + I/4]], Row[{"x = ", 13/10 + j/10}], Right], {j, -3, 3}], 
 Epilog -> ParametricPlot[parts[ourF[x + I/4]], {x, -3, 3}][[1]]]

Update: Using MeshFunctions and Mesh:

ParametricPlot[parts[ourF[x + I/4]], {x, -3, 3},
 PlotRangePadding -> {{0, 1}, {1, 1}}, ImageSize -> 500,
 BaseStyle -> {PointSize[Large], Blue}, MeshFunctions -> {#2 &}, 
 Mesh -> {Table[{Im[ourF[j + I/4]], 
            Text[Style[Row[{"x = ", 13/10 + j/10}], 12, Black], parts[ourF[j + I/4]], {-2, 0}]}, 
          {j, -3, 3}]}]

  • $\begingroup$ Text[] also has the reference point option after the position. It would make the lables not intersect the line - looks better. $\endgroup$ Feb 16, 2015 at 16:23
  • $\begingroup$ @Alexey, excellent point, thank you. $\endgroup$
    – kglr
    Feb 17, 2015 at 18:30

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.