pgfplots-用图宽度填充变化之间

pgfplots-用图宽度填充变化之间

我正在为我的学生绘制一些分布函数,并且我正在绘制阴影区域。如果我将绘图宽度减小到 0.35\textwidth 或更小,阴影就会消失。

我如何确保一切都保持原样?

我已包含所有页面设置,以防出现问题。

\documentclass[11pt, twoside]{book} % use larger type; default would be 10pt
\usepackage{geometry} % to change the page dimensions
\geometry{a4paper} % or letterpaper (US) or a5paper or....
\geometry{lmargin=30mm, rmargin=10mm,tmargin=20mm,bmargin=20mm} 

\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.13}
\usepgfplotslibrary{fillbetween}

\begin{document}


\pgfmathdeclarefunction{FuncUniform}{3}{%
  \pgfmathparse{and(#1>(#2- #3), #1<(#2+ #3)) *  (1/(2* #3))}%
}


\begin{tikzpicture}
\begin{axis}[
    axis lines = left,
    every outer x axis line/.append style= {-},
    every outer y axis line/.append style= {-},
    width={0.35\textwidth}, height={0.35\textwidth}, %this line is the issue
]
\addplot[domain=-5:5, samples=501, name path=U,] {FuncUniform(x,0,3)};
\addplot[domain=-5:5, samples=3, name path=Xaxis,] {0};
\addplot[lightgray] fill between[of=U and Xaxis, soft clip={domain=-1.732:1.732},];

\end{axis}
\end{tikzpicture}

\end{document}

相关内容