I'm currently working on a project where I need to plot the graph of the function $\sqrt{x-1}$ using the pgfplots package. However, I've encountered an issue – the graph doesn't seem to pass through the point (1,0).
I've included the necessary \usepackage{pgfplots} in my document preamble, and the graph is displaying, but it's not behaving as expected near the point (1,0). I've double-checked my function expression and the package inclusion, but I'm still facing this problem.
Here's a snippet of my code:
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{booktabs}
\usepackage{tkz-tab}
\usepackage{pgfplots}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
xlabel={$x$},
ylabel={$y$},
axis lines=middle,
xmin=-2, xmax=6,
ymin=-2, ymax=4,
grid=major,
domain=-2:6,
restrict y to domain=-2:6,
samples=100,
xtick={-2,-1,0,1,2,3,4,5,6},
ytick={-2,-1,0,1,2,3,4,5,6},
]
\addplot[blue, thick] {sqrt(x-1)};
% Add a node with the text in blue
\node[blue] at (axis cs: 5, 2.5) {$(\mathcal{C}_{f})$};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}



domain=1:6to theaddplotoption. 100 points between -2 and 6 will miss x=1... – Rmano Jan 10 '24 at 20:52\pgfplotsset{compat=1.18}to your preamble, after loadingpgfplots– Rmano Jan 10 '24 at 20:54