取下轴标签

取下轴标签

如何去掉下图中轴上的标签?我只想显示圆抛物线系统,轴上没有数字。

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


\begin{center}
\begin{tikzpicture}
\begin{axis}[domain=-10:10, samples=100,grid=major,
    restrict y to domain=-2:2,xlabel=$x$,ylabel=$y$, legend pos=south west]
\addplot [color=red]    {-sqrt(1-x^2};
\addplot [color=red]    {sqrt(1-x^2};
\addplot [color=blue]  {(x-2)^(1/2)};
\addplot [color=blue] {-(x-2)^(1/2)}; 

\end{axis}
\end{tikzpicture}
\end{center}

\end{document}

答案1

您可以使用 来取下刻度标签ticks = none

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


\begin{center}
\begin{tikzpicture}
\begin{axis}[domain=-10:10, samples=100,grid=major,
    restrict y to domain=-2:2,xlabel=$x$,ylabel=$y$, legend pos=south west, ticks=none]
\addplot [color=red]    {-sqrt(1-x^2};
\addplot [color=red]    {sqrt(1-x^2};
\addplot [color=blue]  {(x-2)^(1/2)};
\addplot [color=blue] {-(x-2)^(1/2)}; 

\end{axis}
\end{tikzpicture}
\end{center}

\end{document}

答案2

如果您想要保留 MWE 中的轴刻度和网格,但不保留刻度标签,只需在轴选项中使用yticklabels=\empty和。xticklabels=\empty

相关内容