tikz-pgf,drawing – Help with Drawing and Shading Regions Limited by a Curve in TIKZ

drawingtikz-pgf

I need to create the picture below in Tikz. I cannot shade the two asymmetric regions as depicted. Any help is much appreciated.enter image description here

Best Answer

It's not clear exactly what you want, but hopefully this will get you started. Use the patterns library to get the diagonal lines. Use \path to form the boundary of each region including plot for the curve. (I used 1/√x for the function.) Then \draw the function and dashed lines.

enter image description here

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{patterns}

\begin{document}

\begin{tikzpicture}
\path[pattern=north west lines] (1,2.5)--(1,1) -- plot[domain=1:3.5, smooth] (\x,{1/sqrt(\x)}) -- (3.5,2.5) -- cycle;
\path[pattern=north east lines] (.5,0)--(.5,{1/sqrt(.5)}) -- plot[domain=.5:3.5, smooth] (\x,{1/sqrt(\x)}) -- (3.5,0) -- cycle;
\draw(0,3)--(0,-.5) (-.5,0)--(4,0);
\draw[domain=.15:3.5, smooth] plot (\x,{1/sqrt(\x)});
\draw[dashed](1,0)--(1,2.5) (.5,0)--(.5,2.5);
\end{tikzpicture}

\end{document}

If you want to color the regions, you don't need patterns, just \fill the regions with colors of your choosing.

enter image description here

\begin{tikzpicture}
\fill[blue] (1,2.5)--(1,1) -- plot[domain=1:3.5, smooth] (\x,{1/sqrt(\x)}) -- (3.5,2.5) -- cycle;
\fill[red] (.5,0)--(.5,{1/sqrt(.5)}) -- plot[domain=.5:3.5, smooth] (\x,{1/sqrt(\x)}) -- (3.5,0) -- cycle;
\draw(0,3)--(0,-.5) (-.5,0)--(4,0);
\draw[domain=.15:3.5, smooth] plot (\x,{1/sqrt(\x)});
\draw[dashed](1,0)--(1,2.5) (.5,0)--(.5,2.5);
\end{tikzpicture}
Related Question