# opacity and shading of an ellipse

I am making a picture of the tidal force effects on the Earth. My current picture is decent but I would like where the bulging occurs on the edges to be little bit darker in blue, but I don't want the dull out the sphere anymore than what it is.

How can I accomplish this?

I am looking to get the water color as dark as this picture:

\documentclass{article}
\usepackage{tikz}
%% helper macros

\newcommand\pgfmathsinandcos[3]{%
\pgfmathsetmacro#1{sin(#3)}%
\pgfmathsetmacro#2{cos(#3)}%
}
\newcommand\LongitudePlane[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % azimuth
\tikzset{#1/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand\LatitudePlane[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % latitude
\pgfmathsetmacro\yshift{\cosEl*\sint}
\tikzset{#1/.estyle={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} %
}
\newcommand\DrawLongitudeCircle[2][1]{
\LongitudePlane{\angEl}{#2}
\tikzset{current plane/.prefix style={scale=#1}}
% angle of "visibility"
\pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
\draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1);
\draw[current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
}
\newcommand\DrawLatitudeCircle[2][1]{
\LatitudePlane{\angEl}{#2}
\tikzset{current plane/.prefix style={scale=#1}}
\pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
% angle of "visibility"
\pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
\draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1);
\draw[current plane,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1);
}

%% document-wide tikz options and styles

\tikzset{%
>=latex, % option for nice arrows
inner sep=0pt,%
outer sep=2pt,%
mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
fill=black,circle}%
}

\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}[line join = round, line cap = round, >=triangle 45]
\def\angEl{35} % elevation angle

\filldraw[ball color = green] (0,0) circle (\R);
\foreach \t in {-80,-60,...,80} { \DrawLatitudeCircle[\R]{\t} }
\foreach \t in {-5,-35,...,-175} { \DrawLongitudeCircle[\R]{\t} }
\filldraw[blue!50, opacity = .4] (0,0) ellipse (2.5cm and 1.8cm);
\end{tikzpicture}
\caption{Exaggeration of the bulge caused by the tidal force of the moon.}
\end{figure}
\end{document}

-

You have problems, getting an intense blue, if you leave the opacity at 0.4. I needed to change the order of the drawing objects, so that the globe gets drawn above the ellipse. Then you can leave out the opacity and have no problem, getting the intensity of the colors:

\documentclass{article}
\usepackage{tikz}
%% helper macros

\newcommand\pgfmathsinandcos[3]{%
\pgfmathsetmacro#1{sin(#3)}%
\pgfmathsetmacro#2{cos(#3)}%
}
\newcommand\LongitudePlane[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % azimuth
\tikzset{#1/.estyle={cm={\cost,\sint*\sinEl,0,\cosEl,(0,0)}}}
}
\newcommand\LatitudePlane[3][current plane]{%
\pgfmathsinandcos\sinEl\cosEl{#2} % elevation
\pgfmathsinandcos\sint\cost{#3} % latitude
\pgfmathsetmacro\yshift{\cosEl*\sint}
\tikzset{#1/.estyle={cm={\cost,0,0,\cost*\sinEl,(0,\yshift)}}} %
}
\newcommand\DrawLongitudeCircle[2][1]{
\LongitudePlane{\angEl}{#2}
\tikzset{current plane/.prefix style={scale=#1}}
% angle of "visibility"
\pgfmathsetmacro\angVis{atan(sin(#2)*cos(\angEl)/sin(\angEl))} %
\draw[current plane] (\angVis:1) arc (\angVis:\angVis+180:1);
\draw[current plane,dashed] (\angVis-180:1) arc (\angVis-180:\angVis:1);
}
\newcommand\DrawLatitudeCircle[2][1]{
\LatitudePlane{\angEl}{#2}
\tikzset{current plane/.prefix style={scale=#1}}
\pgfmathsetmacro\sinVis{sin(#2)/cos(#2)*sin(\angEl)/cos(\angEl)}
% angle of "visibility"
\pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))}
\draw[current plane] (\angVis:1) arc (\angVis:-\angVis-180:1);
\draw[current plane,dashed] (180-\angVis:1) arc (180-\angVis:\angVis:1);
}

%% document-wide tikz options and styles

\tikzset{%
>=latex, % option for nice arrows
inner sep=0pt,%
outer sep=2pt,%
mark coordinate/.style={inner sep=0pt,outer sep=0pt,minimum size=3pt,
fill=black,circle}%
}

\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}[line join = round, line cap = round, >=triangle 45]
\begin{scope}
\clip (0,0)ellipse(2.5cm and 1.8cm);
%     \pgfsetfillopacity{0.4}
{rgb(0cm)=(0,0,0.9);
rgb(1.8cm)=(0,0,0.9);
rgb(2.5cm)=(0,0,0.7)}
\end{scope}
\def\angEl{35} % elevation angle

\filldraw[ball color = green] (0,0) circle (\R);
\foreach \t in {-80,-60,...,80} { \DrawLatitudeCircle[\R]{\t} }
\foreach \t in {-5,-35,...,-175} { \DrawLongitudeCircle[\R]{\t} }

%     \filldraw[opacity = .4] (0,0) ellipse (2.5cm and 1.8cm);
\end{tikzpicture}
\caption{Exaggeration of the bulge caused by the tidal force of the moon.}
\end{figure}
\end{document}


-
I didn't want that order though. That is why I put sphere first. –  dustin Apr 27 '13 at 0:00
If you don't want that order (I suppose because you want to have the blue and the green mixed-in) why don't you make the green sphere transparent? Don't you want to use the cyan color also? \filldraw[cyan, opacity = 1] (0,0) ellipse (2.5cm and 1.8cm); \filldraw[ball color = green,opacity=0.5] (0,0) circle (\R); –  vrleboss Apr 27 '13 at 1:24
@dustin: You can't change physics. If you want the green sphere to be seen through the blue ellipse, you need high transparency=low opacity. But then, the ellipse also lets pass lot of light at its outer rim, so it doesn't look dark there. If you need that order, you can try with different opacities for the ellipse or a dark background. –  Toscho Apr 27 '13 at 9:54
What about the following line after the green sphere is drawn: \filldraw[shading=radial,inner color=blue!10,outer color=blue!70!black, opacity = .4] (0,0) ellipse (2.5cm and 1.8cm); –  Toscho Apr 27 '13 at 10:00