# Label points in listplot [closed]

The following command:

Show[Plot[x^2, {x, 0, 3}], ListPlot[{{0, 0}, {1, 1}, {2, 4}, {3, 9}}]]


Yields the following figure:

I would like to add labels to each point. Each label would be a string containing the ordered pair for the point.

I know using the Labeled[] command in the following context

ListPlot[Table[Labeled[i, i], {i, 1, 5}]]


Yields this figure below:

I cannot find a way to combine the two commands to arrive at the desired result. This is mainly because I do not really understand how the Labels[] command works. Can anyone provide some guidance? Thanks.

• Have you checked the examples in the ListPlot documentation that use Labeled? Have you checked the Details section of the same documentation page that describes the use of Labeled? Replace e.g. the {1,1} data point with Labeled[{1,1}, "something"] and see what happens. I think this is really a case of "off topic because it is easily found in the documentation". – Szabolcs Jan 13 '17 at 10:35

## Example

This is one way how you could achieve the result.

Module[
{
offset = {0, .3},
data = {{0, 0}, {1, 1}, {2, 4}, {3, 9}}
},
Show[
Plot[x^2, {x, 0, 3}],
ListPlot[data],
(* The line below adds Text above ea. data point *)
Graphics @ Text["P" <> ToString @ #, # + offset] & /@ data
]
]


## Alternative

Module[
{
offset = {0, .3},
data = {{0, 0}, {1, 1}, {2, 4}, {3, 9}}
},
Show[
Plot[x^2, {x, 0, 3}],
ListPlot[data -> data, LabelingFunction -> (# &)]
]
]


## Reference

Text

With V11

data = {{0, 0}, {1, 1}, {2, 4}, {3, 9}};
dataForPlot = Map[Function[p, Callout[p, Style[p[[1]], Red, 14], Above]], data]
Show[ListPlot[dataForPlot], Plot[x^2, {x, 0, 3}], AxesOrigin -> {0, 0}]