MHB Probability of z > 1.28: Visualizing the Gaussian Curve

AI Thread Summary
The discussion focuses on visualizing the probability of z > 1.28 using a Gaussian curve. The user successfully generated a graph but noted that most Gaussian curves typically appear shorter and often only display essential domain ticks. They emphasized the importance of customizing tick marks and graph dimensions for clarity. The code utilized was sourced from Overleaf, a popular LaTeX editor in academic settings. Overall, the user expressed appreciation for the assistance received in creating the graph.
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 guass 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
Views
2K
Replies
2
Views
2K
Replies
2
Views
1K
Replies
4
Views
2K
Replies
1
Views
2K
Replies
8
Views
2K
Replies
5
Views
4K
Back
Top