I am trying to shade the area restricted by the functions
y \sin x, x = \sin y and y = 2pi + x. Now my problem is that
I do not have access to Pgfplots 1.10so the libary fillbetween is not accessible to me. I have attempted to plot the area below using
\documentclass[a4paper,12pt]{standalone}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.10}
%\usepgfplotslibrary{fillbetween}
\begin{document}
\pgfplotsset{every axis legend/.append style={
at={(0,0.99)},
anchor=north west}}
\begin{tikzpicture}
\begin{axis}[
xmin=-2.5*pi,xmax=pi,ymin=-pi,ymax=2.5*pi,
domain=-2pi:2pi,
samples=100,
xlabel={$x$},
ylabel={$y$},
yticklabels={,,},
xticklabels={,,},
axis lines=middle
]
\addlegendentry{$y =x + 2\pi$}
\addplot[black,thick,black,domain=-2*pi:0] {x+2*pi} \closedcycle;
\addplot[fill=gray,opacity=0.1,thick,black,domain=-2*pi:0] {x+2*pi} \closedcycle;
\addplot[color=red,fill= white,thick,domain=-2*pi:0] {sin(deg(x))};
\addplot[color=blue,fill= white,thick,variable=\t, domain=0:2*pi] ({sin(deg(t))}, {t});
\addplot[color=red,fill=gray,opacity=0.2,thick,domain=-pi:0] {sin(deg(x))};
\addplot[color=blue,fill=gray,opacity=0.2,thick,variable=\t, domain=0:pi] ({sin(deg(t))}, {t});
\addlegendentry{$y =x + 2\pi$}
\addplot[color=red,thick,domain=-2*pi:0] {sin(deg(x))};
\addlegendentry{$y =x + 2\pi$}
\addplot[color=blue,thick,variable=\t, domain=0:2*pi] ({sin(deg(t))}, {t});
%\addlegendentry{$x = \sin y$}
]\end{axis}
\end{tikzpicture}
\end{document}

I have tried to mark the parts on the figure I am having problems with. All
of them are related to how I am shading the figure. The idea I am using is to
first fill in the entire triangular area under x + 2\pi, and then fill in white where needed.
- Why must i use
opacity=0.1for the first function andopacity=0.2for the second function to obtain the same color gray? Is this a problem on my end? - Why is the
x-axisunneven, eg higher between -pi and 0 ? Same withy-axis. - Labels, why are the first and last label correct, but the middle one is always gray?
I think the labeling problem is a minor problem caused by how I fill the various parts of the figure. But still it is quite weird that the first and second legends are fine. So to summarize, is there a better method for shading the area gray? I have tried the method provided here filling area between 2 functions, with shading, but alas this crashes every time I try to invoke the sine function, and not sure how to handle the implicit function using this method.

\clipcommand might help you, but I’m away from a TeX compiler and so I can’t try it right now. – alexwlchan Apr 03 '14 at 09:39pgfplots 1.10with itsfillbetweenlibrary is not an option, I would like to give pointers to a related solution in order to build up the knowledge base: http://texwelt.de/wissen/antwort_link/4161/ (in german) and http://tex.stackexchange.com/questions/112738/fill-the-area-enclosed-by-multiple-functions-in-a-single-plot/163659#163659 – Christian Feuersänger Apr 03 '14 at 17:40