I can use this code to label my points with text.

 NumberLinePlot[{1, 2, 3}],
 Graphics[Text["A", {1, 1}, {0, -1}]], 
 Graphics[Text["B", {2, 1}, {0, -1}]],
 Graphics[Text["C", {3, 1}, {0, -1}]]

But how do I use an image instead of text as a label? I don't see how to do this in the documentation and just adding an image in the Show function breaks everything (I assume its because we need to define its coordinates somehow).


closed as off-topic by Kuba, bbgodfrey, gpap, Dr. belisarius, ciao Apr 1 '15 at 23:15

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Kuba, bbgodfrey, gpap, Dr. belisarius, ciao
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Try Inset. P.s. you don't need separate Graphics for each element, you can gather them with {}. $\endgroup$ – Kuba Apr 1 '15 at 19:41
 im = Import["ExampleData/lena.tif"];

 NumberLinePlot[{1, 10, 20, 30, 40, 50}],
  {Inset[im, {1, 1}],
   Inset[im, {20, 1}],
   Inset[im, {40, 1}]

Mathematica graphics

You'd have to adjust the sizes and scale things to make it look ok


You can also use Epilog:

img=ExampleData[{"TestImage", "Mandrill"}];
pnts={1, 10, 20, 30, 40, 50};

NumberLinePlot[pnts, ImageSize->600, 
 Epilog -> (Inset[Show@Thumbnail[img, 50], #]&/@ Thread[{pnts, 1}])]

enter image description here

Or post-process Point primitives into Insets:

NumberLinePlot[pnts, ImageSize->600]/. 
   Point[x_]:>(Inset[Show@Thumbnail[img,50], #] & /@{x})
(* same picture *)

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