How to draw a linear line in graph? [duplicate]

I want to obtain the figure as

Could you suggest to me the way to draw it? Thanks so much. Note that, the circle is a point (x,y).

Update: This is a simple data set for points(x,y)

(3,3.2)
(4,3.8)
(4,4.5)
(5,5.1)
(5.5,5.6)
(5.3,5.8)
(6.3,5.8)
(7, 7.4)
(7.3, 7.5)
(8.3, 8.5)
(9, 8.5)
(10, 11.0)
(11, 11.5)
(11.2, 11.6)
(11.5, 11.9)
(12.5, 12.9)
(13.5, 13.1)
(14, 13.8)
(15, 15.3)
(16, 16.5)
(17, 17.2)
(18, 18.4)
(19, 19.1)


This is my code based on suggestions:

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
xlabel=Weight (kg), % label x axis
ylabel=Height (cm), % label y axis
axis lines=left, %set the position of the axes
xmin=0, xmax=20, % set the min and max values of the x-axis
ymin=0, ymax=20, % set the min and max values of the y-axis
clip=false
]
\addplot[only marks,mark=o] coordinates {(3,3.2) (4,3.8) (4,4.5) (5,5.1) (5.5,5.6) (5.3,5.8) (6.3,5.8) (7, 7.4) (7.3, 7.5) (8.3, 8.5) (9, 8.5) (10, 11.0) (11, 11.5) (11.2, 11.6) (11.5, 11.9) (12.5, 12.9) (13.5, 13.1) (14, 13.8) (15, 15.3) (16, 16.5) (17, 17.2) (18, 18.4) (19, 19.1)};
\end{axis}

\end{tikzpicture}
\end{document}


marked as duplicate by Martin Scharrer♦ tikz-pgf StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jul 24 '18 at 5:44

• @percusse: I have updated dataset – Jame Jul 23 '18 at 7:05
• Thanks percusse. I have read your post but it is different. In my case, I draw the circle points from dataset and the line is y=x – Jame Jul 23 '18 at 7:09
• \addplot [samples at={0,20}] {x}; – Torbjørn T. Jul 23 '18 at 7:15
• ... and to get the circles you could do \addplot[only marks,mark=o] coordinates {(3,3.2) (4,3.8) (4,4.5) (5,5.1) (5.5,5.6) (5.3,5.8) (6.3,5.8) (7, 7.4) (7.3, 7.5) (8.3, 8.5) (9, 8.5) (10, 11.0) (11, 11.5) (11.2, 11.6) (11.5, 11.9) (12.5, 12.9) (13.5, 13.1) (14, 13.8) (15, 15.3) (16, 16.5) (17, 17.2) (18, 18.4) (19, 19.1)};... – user121799 Jul 23 '18 at 7:22
• Great. So. where is the line y=x? Thanks – Jame Jul 23 '18 at 7:24

\addplot [samples at={0,20}] {x}; gives you a black line for y=x from x=0 to x=20.

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}
\begin{document}

\begin{tikzpicture}
\begin{axis}[
xlabel=Weight (kg), % label x axis
ylabel=Height (cm), % label y axis
axis lines=left, %set the position of the axes
xmin=0, xmax=20, % set the min and max values of the x-axis
ymin=0, ymax=20, % set the min and max values of the y-axis
]
\addplot[only marks,mark=o] coordinates {(3,3.2) (4,3.8) (4,4.5) (5,5.1) (5.5,5.6) (5.3,5.8) (6.3,5.8) (7, 7.4) (7.3, 7.5) (8.3, 8.5) (9, 8.5) (10, 11.0) (11, 11.5) (11.2, 11.6) (11.5, 11.9) (12.5, 12.9) (13.5, 13.1) (14, 13.8) (15, 15.3) (16, 16.5) (17, 17.2) (18, 18.4) (19, 19.1)};