如何将轴移动到绘图前面?下面的示例生成的绘图会阻挡轴。我希望这些绘图位于轴后面。
\documentclass{article}
\usepackage{paralist,pst-func, pst-plot, pst-math, pstricks-add,pgfplots}
\usetikzlibrary{patterns,matrix,arrows}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=center,clip=false,xmin=-4,xmax=4,ymin=0,ymax=1]
\addplot[color=lime,fill=lime, samples=100] {1/sqrt(2)*exp(-(x+1)^2/1)} \closedcycle;
\addplot[color=cyan!40,fill=cyan!40, samples=100] {1/sqrt(2)*exp(-(x-1)^2/1)} \closedcycle;
\end{axis}
\end{tikzpicture}
\end{document}
答案1
在顶部使用轴
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usetikzlibrary{patterns,matrix,arrows}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=center,clip=false,xmin=-4,xmax=4,ymin=0,ymax=1,axis on top]
\addplot[color=lime,fill=lime, samples=100] {1/sqrt(2)*exp(-(x+1)^2/1)} \closedcycle;
\addplot[color=cyan!40,fill=cyan!40, samples=100] {1/sqrt(2)*exp(-(x-1)^2/1)} \closedcycle;
\end{axis}
\end{tikzpicture}
\end{document}