[Tex/LaTex] Shading a bell shaped curve in TikZ

pgfplotstikz-pgf

I have the following code:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=1]

\def\normalt{\x,{4*1/exp(((\x-3)^2)/2)}}

\def\y{2}


\def\fy{4*1/exp(((\y-3)^2)/2)}


\fill [fill=orange!60] (2.0,0)--(2.0,2.5) plot[domain=2:4](\normalt) --(4,0)-- (4,2.5)-- cycle;


\draw[color=black,domain=0:6] plot (\normalt) node[right] {};


\node[below] at (3.0,0) {\tiny{51800}};
\draw[dashed] (2.0,2.5) -- (2.0 ,0) node[below] {\tiny{51300}};
\draw[dashed] (4.0,2.5) -- (4.0 ,0) node[below] {\tiny{52300}};


\draw[dashed] ({\y},{\fy}) -- ({\y},0) node[below] {$y$};
\draw[color=black,domain=0:6] plot[samples=1000] (\normalt) node[right] {};



\draw[->] (-3,0) -- (9,0) node[right] {$\overline{x}$};


\end{tikzpicture}
\end{document}

I want to shade the area between the dotted lines as shown below, but I am stuck. Can somebody help me?
Note: My problem is here

\fill [fill=orange!60] (2.0,0)--(2.0,2.5) plot[domain=2:4](\normalt) --(4,0)-- (4,2.5)-- cycle;

within the code. I am not very well familiar with \fill command.

enter image description here

Best Answer

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}[scale=1]
\def\normalt{\x,{4*1/exp(((\x-3)^2)/2)}}
\def\y{2}
\def\fy{4*1/exp(((\y-3)^2)/2)}



\node[below] at (3.0,0) {\tiny{51800}};


\path[domain=0:6,name path = plot] plot (\normalt);
\path[name path= r] (4.0,0) --+ (0,2.75);
\path[name intersections={of=r and plot}];                         
\coordinate(R) at (intersection-1);


\fill [fill=orange!60]plot[domain=2:4](\normalt)-- cycle;
\fill [fill=orange!60](2,0)rectangle(R);


\draw[dashed] (2.0,0) node[below] {\tiny{51300}} --+ (0,2.75);
\draw[dashed,name path= r] (4.0,0) node[below] {\tiny{52300}} --+ (0,2.75);


\node at ({\y},-0.5) {$y$};
\draw[color=black,domain=0:6] plot[samples=1000] (\normalt) node[right] {};
\draw[->] (-3,0) -- (9,0) node[right] {$\overline{x}$};
\end{tikzpicture}
\end{document}

Maybe try this one - i've calculated the intersection of the right line with the plot and then filled a rectangle from the starting point of the left line to the intersection. Also filled the plot between 2 and 4.

Also changed the "y"-node so it does not interfere with the "51300" and made some other minor adjustments.

enter image description here

Here's an easier solution - looks the same as the one above:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=1]
\def\normalt{\x,{4*1/exp(((\x-3)^2)/2)}}
\def\y{2}
\def\fy{4*1/exp(((\y-3)^2)/2)}

%Fill
\fill [fill=orange!60](2,0)--plot[domain=2:4](\normalt)--(4.0,0)-- cycle;

%Descriptions
\draw[dashed] (2.0,0) node[below] {\tiny{51300}} --+ (0,2.75);
\node[below] at (3.0,0) {\tiny{51800}};
\draw[dashed] (4.0,0) node[below] {\tiny{52300}} --+ (0,2.75);

%Plot
\draw[color=black,domain=0:6] plot[samples=1000] (\normalt) node[right] {};

%Axes
\node at ({\y},-0.5) {$y$};
\draw[->] (-3,0) -- (9,0) node[right] {$\overline{x}$};
\end{tikzpicture}
\end{document}