如何在pgfplots中绘制平滑曲线?以及如何删除y轴刻度线?

问题描述 投票:1回答:1

我正在使用Latex Beamer准备演示文稿。我决定包括一个地块。

enter image description here

中间曲线应该是正态分布;但它有尖锐的角落。为什么会这样?

还可以删除y轴上的刻度吗?

这是我的代码:

\begin{frame}
\begin{tikzpicture}
\begin{axis}[domain=-1:1]
\addplot+[no markers] {4*exp(-4*(x+1))};
\addplot+[no markers] {1/sqrt(2*pi*0.02)*exp(-(x^2)/(2*0.02))};
\addplot+[no markers] {4*exp(4*(x-1))};
\end{axis}
\end{tikzpicture} 
\end{frame}

谢谢

latex pgf
1个回答
0
投票
  • 要获得平滑曲线,请增加采样点的数量,例如samples=100

  • 要删除y轴标签:yticklabels=\empty


\documentclass{beamer}

\usepackage{pgfplots}

\begin{document}

\begin{frame}
\begin{tikzpicture}
\begin{axis}[domain=-1:1,samples=100,yticklabels=\empty]
\addplot+[no markers] {4*exp(-4*(x+1))};
\addplot+[no markers] {1/sqrt(2*pi*0.02)*exp(-(x^2)/(2*0.02))};
\addplot+[no markers] {4*exp(4*(x-1))};
\end{axis}
\end{tikzpicture} 
\end{frame}

\end{document}

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.