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.
Best Answer
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.
Here's an easier solution - looks the same as the one above: