I want to draw a cylindrical hole in a sphere with Tikz which the picture is below.
By searching the site, I could to find two useful links. By Using the Henri Menke's answer to Gray shaded sphere with tikz-3dplot,
the sphere can be drawn.
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
axis equal, axis lines=none,
domain=0:180, samples=40,
y domain=0:360, samples y=40,
colormap/blackwhite,
view={100}{10},
]
\addplot3
[
surf,
z buffer=sort,
shader=flat,
point meta={acos(z/sqrt(x*x+y*y+z*z)) + atan2(y,x)}
] (
{sin(x)*cos(y)},
{sin(x)*sin(y)},
{cos(x)}
);
\end{axis}
\end{tikzpicture}
\end{document}
And by changing the Tathagat agrawal's answer to Draw cylinder and sphere using PGFPlots, I was able to draw the cylindrical part.
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9, colormap/blackwhite}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis equal,
axis lines=middle,
view={110}{25},
domain=0:5,
y domain=0:2*pi,
xmin=-1.5, xmax=1.5,
ymin=-1.5, ymax=1.5,
zmin=-2, zmax=2,
samples=35,
xlabel=$x$,
ylabel=$y$,
zlabel={$z$},
]
\addplot3
[surf,
z buffer=sort,
opacity=0.6,
domain=0:1,
color=black!90] (
{cos(deg(y))},
{sin(deg(y))},
{x}
);
\addplot3[surf,
domain=45:90,
domain y=0:360,
z buffer=sort,
opacity=0.6,
color=black!50] (
{sqrt(2)cos(y)cos(x)},
{sqrt(2)sin(y)cos(x)},
{sqrt(2)*sin(x)});
\addplot3
[surf,
z buffer=sort,
opacity=0.6,
domain=0:1,
color=black!90] (
{cos(deg(y))},
{sin(deg(y))},
{-x}
);
\addplot3[surf,
domain=45:90,
domain y=0:360,
z buffer=sort,
opacity=0.6,
color=black!50] (
{sqrt(2)cos(y)cos(x)},
{sqrt(2)sin(y)cos(x)},
{-sqrt(2)*sin(x)});
\end{axis}
\end{tikzpicture}
\end{document}
How to achieve the desired figure by combining thess two figures?

\begin{scope}[opacity=0.4] \clip[canvas is xy plane at z=\s-\h] (0,0) circle (\r); \draw[thick,shading=ball,ball color=blue!50] (0,0,\s-\h) circle (\a cm); \end{scope}– Mohammadi May 14 '21 at 13:55