2

I am trying to replicate the graph from the picture below. I tried looking at some old questions here and use them for the code, but I didn't get as much information as I hoped.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture} \begin{axis}[ axis lines=middle, %grid=major, %xmin=-1, %xmax=11, %ymin=-1, %ymax=13, %xlabel=$x$, %ylabel=$y$, scale=1.9, transform shape, tick style={very thick}, legend style={ at={(rel axis cs:0,1)}, anchor=north west,draw=none,inner sep=0pt,fill=gray!10} ] % %line of best fit \plot[thick,samples=150,domain=0:10] {0.3 (x-5)^(2) + 1}; \end{axis} \newline \end{tikzpicture}

\end{document}

enter image description here I think my way is a bit sloppy. Sorry, if this isn't an appropriate question. If so, tell me and I will delete it.

Thanks in advance!

Source: The Graph is from the book "Hands-On Machine Learning with R" by Bradley Boehmke and Brandon Greenwell, 2019

1 Answers1

6

This may be a start. You can play with the parameters.

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17} 
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
tick style={very thick},
]
%
%line of best fit
\addplot[thick,samples=151,domain=0:10] {0.3*(x-5)^(2) + 1}
foreach \x in {1,...,12} {coordinate[pos={0.5-1.5/pow(1+\x,2)}] (p\x)
\ifnum\x>1
(p\the\numexpr\x-1) edge[bend left=80] (p\x)
\fi};
\end{axis}
\newline
\end{tikzpicture}
\end{document}

enter image description here