$x=t,y=\sqrt(1-t^2)$
使用代码绘制路径
\documentclass[tikz, border=2mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.4}
\begin{document}
\begin{figure}[h]
\begin{tikzpicture}
\begin{axis}
[xlabel=$x$,ylabel=$y$,axis lines=middle, xtick={2},ytick={2},no marks,axis equal,xmin=-1.4,xmax=1.2,ymax=1.2,ymin=-0.2,enlargelimits={upper=0.1}]
\addplot[no markers,samples=200, domain=-1:1,variable=t]({t},{pow(1-t^2,1/2)});
\end{axis}
\draw (5.8,1.2) node {$1$};
\draw (3.1,1.2) node {$O$};
\draw (0.93,1.2) node {$-1$};
\end{tikzpicture}
\end{figure}
\end{document}
答案1
问题是,它在划分间隔时,没有适当地划分点。不要写入偶数个样本,而是写入奇数个样本来修复此问题。
相反samples = 200
,写samples = 201
。
\begin{document}
\begin{figure}[h]
\begin{tikzpicture}
\begin{axis}
[xlabel=$x$,ylabel=$y$,axis lines=middle, xtick={2},ytick={2},no marks,axis equal,xmin=-1.4,xmax=1.2,ymax=1.2,ymin=-0.2,enlargelimits={upper=0.1}]
\addplot[no markers,samples=201, domain=-1:1,variable=t]({t},{pow(1-t^2,1/2)});
\end{axis}
\draw (5.8,1.2) node {$1$};
\draw (3.1,1.2) node {$O$};
\draw (0.93,1.2) node {$-1$};
\end{tikzpicture}
\end{figure}
\end{document}