Probability of z > 1.28: Visualizing the Gaussian Curve

Click For Summary
SUMMARY

The forum discussion focuses on visualizing the probability of z > 1.28 using the Gaussian curve with LaTeX's pgfplots package. The user successfully generated a graph that highlights the area under the curve for z > 1.28, utilizing specific parameters for the Gaussian function. They also noted the importance of customizing tick marks and graph dimensions for clarity, which enhances the visual representation of the data. The discussion emphasizes the utility of the Mathematics Help Board (MHB) as a resource for assistance in LaTeX graphing techniques.

PREREQUISITES
  • Understanding of Gaussian functions and their parameters (mean and standard deviation)
  • Familiarity with LaTeX and the pgfplots package
  • Basic knowledge of probability theory, specifically z-scores
  • Experience with graph customization in LaTeX
NEXT STEPS
  • Explore advanced features of the pgfplots package for enhanced graphing capabilities
  • Learn about customizing LaTeX documents for mathematical typesetting
  • Study the implications of z-scores in statistical analysis
  • Investigate other visualization tools for probability distributions, such as Python's Matplotlib
USEFUL FOR

Students, educators, and researchers in mathematics or statistics who require assistance in visualizing probability distributions and utilizing LaTeX for graphing purposes.

karush
Gold Member
MHB
Messages
3,240
Reaction score
5
ok I was able to get the graph of P(z>1.28)

\begin{tikzpicture}
%preamble \usepackage{pgfplots}
\newcommand\gauss[2]{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))} % Gauss function, parameters mu and sigma
\begin{axis}[every axis plot post/.append style={
mark=none,samples=50,smooth}, % All plots: 50 samples, smooth, no marks
axis x line*=bottom, % no box around the plot, only x axis
axis y line=none, % the * suppresses the arrow tips
enlargelimits=upper, % extend the axes a bit to the right and top
domain=-4:4] % Default for all plots: from -4:4
%\node [below] at (1.28,0) {$a$};%
\addplot [fill=cyan!30, draw=none, domain=1.28:4] {\gauss{0}{1}} \closedcycle;
\addplot {\gauss{0}{1}};
\end{axis}
\end{tikzpicture}

but... most Gauss curves i see are about half this high
and usually only the domain ticks are shown
in this case only 1.28 needs be shown
really don't need what is here on the x-axis
since is basically already understood

also this code was c/p from Overleaf which is very common Latex editor among Universities

MHB has been a great help on this
 
Last edited:
Physics news on Phys.org
We can set custom tick marks and/or labels with xtick respectively xticklabels.
And we can change the height with height, in which case we will also want to set the width because otherwise the picture is just scaled.

If we do so, we get:
Code:
\begin{tikzpicture}
%preamble \usepackage{pgfplots}
\newcommand\gauss[2]{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))} % Gauss function, parameters mu and sigma
\begin{axis}[every axis plot post/.append style={
  mark=none,samples=50,smooth}, % All plots: 50 samples, smooth, no marks
axis x line*=bottom, % no box around the plot, only x axis
axis y line=none, % the * suppresses the arrow tips
enlargelimits=upper, % extend the axes a bit to the right and top
domain=-4:4, % Default for all plots: from -4:4
xtick={1.28},
xticklabels={$a$},
width=10cm,
height=4cm
]
\addplot [fill=cyan!30, draw=none, domain=1.28:4] {\gauss{0}{1}} \closedcycle;
\addplot {\gauss{0}{1}};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
%preamble \usepackage{pgfplots}
\newcommand\gauss[2]{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))} % Gauss function, parameters mu and sigma
\begin{axis}[every axis plot post/.append style={
mark=none,samples=50,smooth}, % All plots: 50 samples, smooth, no marks
axis x line*=bottom, % no box around the plot, only x axis
axis y line=none, % the * suppresses the arrow tips
enlargelimits=upper, % extend the axes a bit to the right and top
domain=-4:4, % Default for all plots: from -4:4
xtick={1.28},
xticklabels={$a$},
width=10cm,
height=4cm
]
\addplot [fill=cyan!30, draw=none, domain=1.28:4] {\gauss{0}{1}} \closedcycle;
\addplot {\gauss{0}{1}};
\end{axis}
\end{tikzpicture}
 
that looks great

i went all over the place to find help with this graph
but the one stop help was here at MHB:cool:
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
2K
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
6
Views
2K