\documentclass{article}
\thispagestyle{empty}
\def\pgfsysdriver{pgfsys-tex4ht.def}
\usepackage{tikz}
\begin{document}

\pgfmathsetmacro\zlen{.5}
\begin{tikzpicture}[z={(-\zlen,-\zlen)}]
%\pgfmathsetmacro\mystep{0.02*\step}
\pgfmathsetmacro\major{1.5}
\pgfmathsetmacro\minor{.5}
\pgfmathsetmacro\tstep{15}
\pgfmathsetmacro\sstep{20}
\pgfmathsetmacro\start{-180+atan(1/\zlen)-\tstep/2}
\pgfmathsetmacro\tsnd{\start+\tstep}
\pgfmathsetmacro\tend{\start+180-\tstep}
\pgfmathsetmacro\send{360-\sstep}
\foreach \t in {\start,\tsnd,...,\tend} {
\foreach \s in {0,\sstep,...,\send} {
\pgfmathsetmacro\tt{\t+\tstep}
\pgfmathsetmacro\ss{\s+\sstep}

\pgfmathsetmacro\xa{(\major + \minor * cos(\s))*cos(\t)}
\pgfmathsetmacro\ya{\minor * sin(\s)}
\pgfmathsetmacro\za{(\major + \minor * cos(\s))*sin(\t)}

\pgfmathsetmacro\xb{(\major + \minor * cos(\s))*cos(\tt)}
\pgfmathsetmacro\yb{\minor * sin(\s)}
\pgfmathsetmacro\zb{(\major + \minor * cos(\s))*sin(\tt)}

\pgfmathsetmacro\xc{(\major + \minor * cos(\ss))*cos(\tt)}
\pgfmathsetmacro\yc{\minor * sin(\ss)}
\pgfmathsetmacro\zc{(\major + \minor * cos(\ss))*sin(\tt)}

\pgfmathsetmacro\xd{(\major + \minor * cos(\ss))*cos(\t)}
\pgfmathsetmacro\yd{\minor * sin(\ss)}
\pgfmathsetmacro\zd{(\major + \minor * cos(\ss))*sin(\t)}

\pgfmathsetmacro\ltint{.9*(1-abs(\t)/180)}
\definecolor{currentcolor}{rgb}{\ltint, 0, \ltint}

\fill[currentcolor] (\xa,\ya,\za) -- (\xb,\yb,\zb) -- (\xc,\yc,\zc) -- (\xd,\yd,\zd) -- (\xa,\ya,\za);
}
}
\pgfmathsetmacro\tstart{\start+360}
\pgfmathsetmacro\tsnd{\start+360-\tstep}
\pgfmathsetmacro\tend{\start+180+\tstep}
\foreach \t in {\tstart,\tsnd,...,\tend} {
\foreach \s in {0,\sstep,...,\send} {
\pgfmathsetmacro\tt{\t-\tstep}
\pgfmathsetmacro\ss{\s+\sstep}

\pgfmathsetmacro\xa{(\major + \minor * cos(\s))*cos(\t)}
\pgfmathsetmacro\ya{\minor * sin(\s)}
\pgfmathsetmacro\za{(\major + \minor * cos(\s))*sin(\t)}

\pgfmathsetmacro\xb{(\major + \minor * cos(\s))*cos(\tt)}
\pgfmathsetmacro\yb{\minor * sin(\s)}
\pgfmathsetmacro\zb{(\major + \minor * cos(\s))*sin(\tt)}

\pgfmathsetmacro\xc{(\major + \minor * cos(\ss))*cos(\tt)}
\pgfmathsetmacro\yc{\minor * sin(\ss)}
\pgfmathsetmacro\zc{(\major + \minor * cos(\ss))*sin(\tt)}

\pgfmathsetmacro\xd{(\major + \minor * cos(\ss))*cos(\t)}
\pgfmathsetmacro\yd{\minor * sin(\ss)}
\pgfmathsetmacro\zd{(\major + \minor * cos(\ss))*sin(\t)}

\pgfmathsetmacro\rtint{.9*(abs(\tt-180)/180)}
\definecolor{currentcolor}{rgb}{\rtint, 0, \rtint}

\fill[currentcolor] (\xa,\ya,\za) -- (\xb,\yb,\zb) -- (\xc,\yc,\zc) -- (\xd,\yd,\zd) -- (\xa,\ya,\za);
}
}
\pgfmathsetmacro\tstart{\start+180}
\pgfmathsetmacro\tsnd{\tstart+\tstep}
\pgfmathsetmacro\tend{\tstart+60}
\pgfmathsetmacro\sstart{-30}
\pgfmathsetmacro\ssnd{\sstart+\sstep}
\pgfmathsetmacro\send{\sstart+60}
\foreach \t in {\tstart,\tsnd,...,\tend} {
\foreach \s in {\sstart,\ssnd,...,\send} {
\pgfmathsetmacro\tt{\t-\tstep}
\pgfmathsetmacro\ss{\s+\sstep}

\pgfmathsetmacro\xa{(\major + \minor * cos(\s))*cos(\t)}
\pgfmathsetmacro\ya{\minor * sin(\s)}
\pgfmathsetmacro\za{(\major + \minor * cos(\s))*sin(\t)}

\pgfmathsetmacro\xb{(\major + \minor * cos(\s))*cos(\tt)}
\pgfmathsetmacro\yb{\minor * sin(\s)}
\pgfmathsetmacro\zb{(\major + \minor * cos(\s))*sin(\tt)}

\pgfmathsetmacro\xc{(\major + \minor * cos(\ss))*cos(\tt)}
\pgfmathsetmacro\yc{\minor * sin(\ss)}
\pgfmathsetmacro\zc{(\major + \minor * cos(\ss))*sin(\tt)}

\pgfmathsetmacro\xd{(\major + \minor * cos(\ss))*cos(\t)}
\pgfmathsetmacro\yd{\minor * sin(\ss)}
\pgfmathsetmacro\zd{(\major + \minor * cos(\ss))*sin(\t)}

\fill[cyan,nearly transparent] (\xa,\ya,\za) -- (\xb,\yb,\zb) -- (\xc,\yc,\zc) -- (\xd,\yd,\zd) -- (\xa,\ya,\za);
}
}
% Spheres are *much* easier!
\shadedraw[shading=ball,ball color=purple, white] (6.5,0) circle (1.5);
% As are the subsets of Euclidean space
\draw[fill=cyan] (-1,-4) rectangle (1,-3);
\draw[fill=cyan] (5.5,-4) rectangle (7.5,-3);
% The next three draw the maps, slightly curved for aesthetics.
\draw[->] (0,-2.8) .. controls (-.2,-2.2) .. (0,-1.6) node[pos=0.5, auto=left] {\(\psi\)};
\draw[->] (6.5,-1.6) .. controls (6.7,-2.2) .. (6.5,-2.8) node[pos=0.5, auto=left] {\(\phi^{-1}\)};
\draw[->] (2.5,0) .. controls (3.5,.2) .. (4.5,0) node[pos=0.5, auto=left] {\(f\)};
% Now we want to draw the codomains of the second chart.
% We do this by drawing some great circles (aka ellipses) on the
% sphere and then ``clipping'' an overlaid (and slightly transparent)
% sphere by those great circles.  Each great circle actually specifies
% one side of the ``clip'' so to make sure that the clip is big enough
% the arcs are completed by big rectangles (otherwise the clipping
% would join the end points directly).
\pgfmathsetmacro\tell{-sin(10)}
\pgfmathsetmacro\bell{sin(50)}
\pgfmathsetmacro\rell{1.5 * sin(50)}
\begin{scope}
\clip (6.5,0) +(-1.5,0) arc (-180:0:1.5 and 1.5*\tell) -- ++(0,-1.5) -- ++(-3,0) -- ++(0,1.5);
\clip (6.5,0) +(-1.5,0) arc (-180:0:1.5 and 1.5*\bell) -- ++(0,1.5) -- ++(-3,0) -- ++(0,-1.5);
\clip (6.5,0) +(0,1.5)  arc (90:-90:\rell cm and 1.5 cm) -- ++(-1.5,0) -- ++(0,3) -- ++(1.5,0);
\clip (6.5,0) +(0,1.5)  arc (90:-90:-\rell cm and 1.5 cm) -- ++(1.5,0) -- ++(0,3) -- ++(-1.5,0);
\fill[cyan, fill opacity=0.35] (6.5,0) circle (1.5);
\end{scope}
\end{tikzpicture}
\end{document}