# Labeling points imported from csv

I have a csv file consisting of two columns corresponding to the x and y coordinates of a point cloud. Since it is possible to label a point in a tikzpicture environment by

\coordinate (1) at (0,0); # from now one simply has to write (1) instead of (0,0)


I was wondering if it is possible to import the points from the csv file and labeling them automatically with their appropriate row number in the file.

• Yes that's what pgfplots does. You can also use plot from TikZ – percusse Nov 3 '17 at 0:18

Here, I use readarray to absorb and compose the data. I label the coordinates as R\i where \i is the local row number.

\documentclass[border=3mm,tikz]{standalone}
\begin{filecontents*}{mydata}
-4,16
-3,9
-2,4
-1,1
-.5,.25
0, 0
.5,.25
1, 1
2, 4
3, 9
4,16
\end{filecontents*}
\begin{document}