# Putting math symbol labels in ListPlot

I have a list of of points, and I want to label them $$v_1$$, $$v_2$$ etc. How do I go about that? Everywhere I look it seems I can only label using strings.

So let's say

data={{1,1},{2,2},{3,3}}


how do i lable each of these $$v_1$$,$$v_2$$,$$v_3$$

One possible way

data = {{1, 1}, {2, 2}, {3, 3}}
lbl = MapIndexed[Subscript[v, First[#2]] &, data ]
ListLinePlot[data -> lbl, Mesh -> All, MeshStyle -> Red, PlotRange -> {0, 4}]


I had to add PlotRange -> {0, 4} due to clippling of last label:

 ListLinePlot[data -> lbl, Mesh -> All, MeshStyle -> Red]


But I think there might be a better way to handle this label clipping at the end without having to explicitly give PlotRange. Will see if I can find one.

If you want to get a little more fancy, you can do

<< MaTeX
data = {{1, 1}, {2, 2}, {3, 3}}
lbl = MapIndexed[MaTeX["v_" <> ToString@First[#2], Magnification -> 1.5] &, data]
ListLinePlot[data -> lbl, Mesh -> All, MeshStyle -> Red,
PlotRange -> {0, 4}, GridLines -> Automatic,
GridLinesStyle -> LightGray]


• That works, thank you! Commented Mar 18, 2022 at 4:36

You can use the Callout functionality:

data = {{1, 1}, {2, 2}, {3, 3}}
ListLinePlot[
Table[
Callout[data[[i]], Subscript[v, i], Above]
, {i, Length@data}
]
, Mesh -> All
, MeshStyle -> Red
, PlotRange -> {{0.5, 3.5}, {0.0, 3.2}}
]


EDIT

The good thing about Callout is the automatic placement of labels in a busy plot. Consider the following example.

data = Sort@RandomReal[{-2, 2}, {10, 2}];
pos = ConstantArray[Automatic, Length@data];
lbls = Subscript[v, #] & /@ Range[1, Length@data];
p1 = ListLinePlot[
`