# Use y-values as PlotMarkers

Is there an automatic function inserts y-values as PlotMarkers?

For instance, suppose I wish these four points in ListPlot to display as their values (2, 4, 6, and, 8 respectively):

ListPlot[#,PlotMarkers->#]&@{2,4,6,8}


This is what I get instead:

This is a duplicate of these two questions:

ListPlot with plotmarkers determined by point

ListPlot, PlotMarker -> y value

But since these were asked and answered in 2012 and 2014, respectively, and since MMA's functionality has expanded significantly since that time, I thought it was worth repeating the inquiry.

• ListPlot[List /@ Thread[{Range[Length[#]], #}], PlotMarkers -> #, PlotRange -> {{0, 4.1}, Automatic}] &@{2, 4, 6, 8} If you don't want the different colors, include the option PlotStyle -> ColorData[97][1] Jan 27, 2022 at 3:50

list = {2, 4, 6, 8};
ListPlot[Labeled[#, #, Center]& /@ list, PlotStyle -> None]


In the more general case in which coordinate pairs are specified, then the expression becomes:

dataXY = {{1, 3}, {2, 5}, {3, 7}, {4, 9}};
ListPlot[
Labeled[#, #[[2]]] & /@ dataXY,
PlotStyle -> None
]


• Nice. And you can extend it to datasets with x and y values, as follows: list = {{1.5, 2}, {3, 4}, {3.5, 6}, {7, 8}}; ListPlot[Labeled[#[[2]], #[[2]], Center] & /@ list, PlotStyle -> None]. However, this seems to break down when you have more than one x value with the same y, e.g., list = {{1.5, 2}, {1.5, 3}, {3, 4}, {3.5, 6}, {7, 8}};. I know that wasn't explicitly in my OP; it seems in my attempt to give an MWE, I made it too minimal! Would it be possible to extend this to cover such cases? [I can edit my OP to request that if you'd like.] Jan 27, 2022 at 6:34
• @theorist, use Labeled[#, #[[2]], Center] instead of Labeled[#[[2]], #[[2]], Center]
– kglr
Jan 27, 2022 at 6:42
• You can use LabelingFunction -> Center instead of mapping Labeled across the data. Jan 27, 2022 at 16:09
• @BrettChampion That converts the labels to machine-precision numbers shown as 2. and 3. (on MMA 12.3 on Win10-64), which may be ok, but it could be ugly. Jan 27, 2022 at 18:20