我不知道为什么,但这个命令\draw
似乎在我的代码中不起作用。理想情况下,我希望看到以下内容:
我的代码是:
\begin{tikzpicture}
\begin{axis}[
axis lines = left,
xmin=0,
xmax=4,
xlabel = $z$,
ymin=0,
ymax=3,
ylabel = {$\pi(w,r,z)$}
]
\
\addplot[color=green]{{0.0018741*(x^6.66667)}};
\addlegendentry{$\pi(w,r,z)$};
\addplot[color=red]
{{1}};\addlegendentry{$w$};
\addplot[mark=*] coordinates {(2.55,1)} node[pin=150:{$\pi(w,r,\bar{z})=w$}]{} ;
\addplot[mark=*] coordinates {(2.55,0)} node[pin=150:{$\bar{z}$}]{} ;
\addplot[dashed] coordinates {(2.55,0) (2.55,1)};
\end{axis}
\end{tikzpicture}
答案1
欢迎使用 TeX-SE!将来请考虑提供以以下代码开头\documentclass
和结尾的完整代码:\end{document}
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16,width=10cm}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=left,xmin=0,xmax=4,xlabel=$z$,ymin=0,ymax=3,ylabel={$\pi(w,r,z)$}]
\addplot[color=green]{{0.0018741*(x^6.66667)}};
\addlegendentry{$\pi(w,r,z)$};
\addplot[color=red] {{1}};
\addlegendentry{$w$};
\addplot[mark=none] coordinates {(2.55,1)} node[pin=150:{$\pi(w,r,\bar{z})=w$}]{};
\addplot[mark=none] coordinates {(2.55,0)} node[pin=150:{$\bar{z}$}]{} ;
\addplot[dashed] coordinates {(2.55,0) (2.55,1)};
\path (0,0) coordinate (O) (2.5,0) coordinate (M) (4,0) coordinate (R);
\end{axis}
\draw[decorate,decoration={brace,raise=2.5em}] (M) -- (O) node[midway,below=2.6em] {text A};
\draw[decorate,decoration={brace,raise=2.5em}] (R) -- (M) node[midway,below=2.6em] {text B};
\end{tikzpicture}
\end{document}