I'm trying to use pgfplots to plot a Maxwell-Boltzmann curve. After scouring around the internet for the density function, I've come up with this:
\begin{tikzpicture}
\def\kB{1.3806488e-23}% boltzmann constant
\def\temperature{298}% room temperature
\def\Beta{1/(\kB*\temperature)}
\def\amu{1.660538921e-27}% atomar mass unit in kg
\def\mass{1*\amu}
\begin{axis}[
axis lines = left,
domain = 0:6000,
xlabel = $v$,
ylabel = $P(v)$,
xtick = \empty,
ytick = \empty
]
\addplot[color=black]{
sqrt(2/pi)*(\mass*\Beta)^(3/2)*x^2*exp(-.5*\mass*\Beta*x^2)
};
\end{axis}
\end{tikzpicture}
The curve and everything comes out alright, problem is that, as the title suggests, the top bit of the curve is cut off. I think this has something to do with some sort of automatic scaling, since after stretching (mathematically) the graph by doing 0.5 * f(x)
, everything seems to remain the same.
Here's an image of what I mean:
As can be seen, the peak of the curve is truncated.
Global settings are as such:
\pgfplotsset{
compat = 1.13,
samples = 100,
scaled ticks = false,
width = 100mm,
height = 60mm
}
Thanks!
clip=false
will likely solve your problem.