答案1
您可以从以下几点开始:
我不是数学家所以我必须猜测这是什么类型的函数。
\documentclass[border=2cm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
samples=1000,
xlabel=$x$,
xtick=\empty,
ytick=\empty,
ylabel=$r$,
xmin=-2,xmax=6,
ymin=-2,ymax=6,
axis lines=middle,
x label style={at={(current axis.right of origin)},anchor=north, below=-5mm},
minor x tick num=3,
minor y tick num=3,
ticklabel style={font=\small},
enlargelimits={abs=0.5},
]
\draw[blue,dashed] \pgfextra{
\pgfpathellipse{\pgfplotspointaxisxy{3}{0}}
{\pgfplotspointaxisdirectionxy{0.5}{0}}
{\pgfplotspointaxisdirectionxy{0}{1.7}}
};
\addplot[,smooth,domain = 0:5,name path = A,red]{x^(1/2)};
\addplot[red,smooth,dashed,domain = 0:5,name path = A,red]{-x^(1/2)};
\end{axis}
\end{tikzpicture}
\end{document}
答案2
使用包的另一个可能的起点pgfplots
:
\documentclass[border=3.141592, varwidth]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
axis line style={-,very thin},
samples=200,
xtick=\empty, xlabel=$c$,
ytick=\empty, ylabel=$x$,
label style={below left},
every axis plot post/.append style={very thick, brown},
domain = -4:0,
enlarge x limits={0.2,upper},
no marks
]
\addplot {sqrt(abs(x))};
\addplot [dash pattern=on 5pt off 2pt] {-sqrt(abs(x))};
\end{axis}
\end{tikzpicture}
\bigskip
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
axis line style={-,very thin},
samples=200,
xtick=\empty, xlabel=$\gamma$,
ytick=\empty, ylabel=$r$,
label style={below left},
every axis plot post/.append style={very thick, brown, dash pattern=on 5pt off 2pt},
domain = 0:4,
enlarge x limits={0.2,lower},
no marks
]
\addplot { sqrt(x)};
\addplot {-sqrt(x)};
\scoped[every path/.style = {very thick, brown, dash pattern=on 5pt off 2.5pt}]
{
\draw (-2,0) -- (0,0);
\draw [solid] (0,0) -- (4,0);
%
\draw[blue] (2,0) ellipse [x radius=0.5, y radius=sqrt(2)];
}
\end{axis}
\end{tikzpicture}
\end{document}