# Help with plotting the following

Bellow is the following code that I currently have, I am just struggling to replicate the graph as accurately as I would like. The actual functions for the graphs are quite complex so i am just trying to replicate with some trig functions etc.

Here is what what I am trying to achieve..

\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis x line=middle,
axis y line=middle,
ymax=1,ymin=0, ylabel=$\omega$,
xmin=-pi, xlabel=$\beta_p$
]
\end{axis}
\end{tikzpicture}
\end{document}


With only tikz

\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\fill[pattern=north west lines,pattern color=gray!50] (-5,0) rectangle (5,1);
\draw (-5,1) -- (5,1);
\fill[pattern=north west lines,pattern color=gray!50] (-5,7) rectangle (5,8);
\draw (-5,7) -- (5,7) (-5,8) -- (5,8);
\draw[-latex,thick] (-5,0) -- (5.5,0)node[pos=1,anchor=west]{$\beta_p$}
node[pos=1,below,anchor=north east]{$+\pi$};
\draw[-latex,thick] (0,0)node[below]{0} -- (0,8)node[pos=1,above]{$\omega$};
\draw[dashed] (5,0) -- (5,8);
\node[font=\bfseries] at (-3,0.5) {LH Gap};
\node[font=\bfseries] at (3,7.5) {RH Gap};
%% curves
\draw[dashed,gray] (-5,1) to[out = 0, in = 180] (5,7);
\draw[dashed,gray] (-5,1) to[out = 0, in = 250] (0,8);
\draw[dashed,gray] (0,0) -- (2,4) to[out = 65, in = 180] (5,7);
\draw[thick,blue] (-5,1) to[out = 0, in = 240] (0,3);
\node[circle, inner sep=2pt,fill=blue] at (0,3){};
\node[circle, inner sep=2pt,fill=blue] at (0,5){};
\draw[thick,blue] (0,5) to[out = 10, in = 180] (3.5,7) -- (5,7);
\end{tikzpicture}
\end{document}


• Thats great, I can amend to suit, the functions are great. Thanks kumar – JS60 Mar 17 '15 at 5:06
• @BenQuinton You are welcome. Adjust in and out angles suitably. – user11232 Mar 17 '15 at 5:12

Done with the mfpic package, a (La)TeX interface to MetaPost.

Since the picture borders' coordinates \xmin, \xmax, \ymin, \ymax take their values in the four arguments of the mfpic environment, I've tried to parameterize the picture as much as possible in function of them. Hence the relative length of the code.

Key parameters here are the x-coordinate of the upper left summit G of the ‘‘LH Gap’’, that is to say \xmin, the common height barheight of these gaps, which is also the second coordinate of G, and the y-coordinate \ymax of the picture's upper-right corner.

It may be fun to play with those three parameters and see how the picture fares (without warranty :-)). Below I gave those parameters the values given in Harish Kumar's tikz coding.

\documentclass{scrartcl}
\usepackage[metapost, mplabels, truebbox]{mfpic}
\setlength{\mfpicunit}{1cm}
\mfpverbtex{%&latex
\documentclass{scrartcl}
\begin{document}}
\opengraphsfile{\jobname}
\begin{document}
\begin{mfpic}[1]{-5}{6}{0}{8}
\setmfnumeric{barheight}{1}
\setmfpair{G}{(\xmin, barheight)} % Upper left summit of "LH Gap"
\setmfpair{C}{(- xpart G, \ymax - barheight)} % Lower right summit of "RH Gap"
\hatchcolor[gray]{.8}
\lhatch\rect{G, (xpart C, \ymin)}
\lines{G, (xpart C, ypart G)}
\lhatch\rect{(xpart G, \ymax), C}
\lines{(xpart G, ypart C), C}
\lines{(xpart G, \ymax), (xpart C, \ymax)}
\drawcolor[gray]{.6}
\dashed\mfobj{origin{dir 60} --- (.4xpart C, .6ypart C) .. C{right}}
\dashed\mfobj{G{right} .. C{right}}
\dashed\mfobj{G{right} .. (0, \ymax){dir 70}}
\setmfarray{path}{P}{%
G{right} ... (0, 3/7ypart C){dir 60},
(0, 5/7ypart C){dir 10} .. (3.5/5xpart C, ypart C) --- C{right}}
\drawcolor{blue}
\mfobj{P1}\mfobj{P2}
\pointcolor{blue}
\point[3bp]{point 1 of P1}
\point[3bp]{point 0 of P2}
\drawcolor{black}
\doaxes{xy}
\dashed\lines{(xpart C, 0), (xpart C, \ymax)}
\tlpointsep{3bp}
\tlabels{[tc]{origin}{$O$} [cl]{(\xmax, 0)}{$\beta_p$}
[tc]{(xpart C, 0)}{$+\pi$} [bc]{(0, \ymax)}{$\omega$}
[cc]{(.5xpart C, .5(ypart C + \ymax))}{\textbf{RH Gap}}
[cc]{(.5xpart G, .5(ypart G + \ymin))}{\textbf{LH Gap}}}
\end{mfpic}
\closegraphsfile
\end{document}


The result is thus more or less the same, when the program is executed with (PDF)LaTeX, then with MetaPost and then again with (PDF)LaTeX: