# Study on Spherical Wedge

I want to get a graphic like this.

I'm trying to apply the angle on the Z axis as it is in the figure, but I do not know where I should change.

\documentclass{article}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis equal,
axis lines = center,
width = 10cm,
height = 10cm,
xlabel = {$x$},
ylabel = {$y$},
zlabel = {$z$},
zmax=1.1,
view/h=135,
every axis x label/.style={ at={(ticklabel* cs:1.05)}},
every axis y label/.style={ at={(ticklabel* cs:1.05)}},
every axis z label/.style={ at={(ticklabel* cs:1.05)}}
]
\addplot3[surf, opacity = 0.5,samples=21, domain=0:1, y domain=0:0.5*pi, z buffer=sort](0, {sqrt( 1-x^2 ) * sin(deg(y))}, x);
\addplot3[surf, opacity = 0.5,samples=21, domain=0:1, y domain=0:0.5*pi, z buffer=sort]({sqrt(1-x^2) * cos(deg(y))}, {sqrt( 1-x^2 ) * sin(deg(y))}, x);
\addplot3[surf, opacity = 0.5,samples=21, domain=0:1, y domain=0:0.5*pi, z buffer=sort]({sqrt(1-x^2) * cos(deg(y))},0, x);
\end{axis}
\end{tikzpicture}
\end{document}


And I'm also not finding what I should modify so that the radius is 3 and not 1.

I tried to change zmax, but it did not work.

• If you want your sphere to contain the point (1,3,0), then its radius would rather be sqrt(10), wouldn't it ? Jun 23, 2017 at 21:13
• @marsupilam Really. The initial idea is of a colleague. I'll have to confirm more details. Jun 23, 2017 at 21:19
• r=Sqrt(3^2+1^2) Jun 23, 2017 at 21:20
• I have removed the [geometry] tag, as that applies explicitly to the geometry package. Replaced by [shapes]. Nov 22, 2019 at 3:20

Realized I plotted the wrong part of the sphere, as compared to your drawing

## The code

\documentclass[12pt,tikz]{standalone}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.11}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{tikzpicture}
\tikzset
{%
{
fill=blue,
fill opacity=.4,
}
}%
\begin{axis}
[
axis equal,
axis lines = center,
width = 10cm,
height = 10cm,
xlabel = {$x$},
ylabel = {$y$},
zlabel = {$z$},
%zmax=1.1,
view/h=135,
every axis x label/.style={ at={(ticklabel* cs:1.05)}},
every axis y label/.style={ at={(ticklabel* cs:1.05)}},
every axis z label/.style={ at={(ticklabel* cs:1.05)}},
xtick=\empty,
ytick=\empty,
ztick=\empty,
extra x ticks={1},
extra y ticks={3},
%xmin=0,  % not working, don't know why...
xmax=1.7,
]
\pgfmathsetmacro{\thetaStart}{atan(3)}
\xdef\thetaEnd{90}
\pgfmathsetmacro{\r}{sqrt(10)}
\def\f{1.2}

% behind plane
\addplot3[surf, opacity = 0.6,samples=2, domain=0:\f*\r, y domain=0:4, z buffer=sort](0,x,y);
% blue disks sections
% the sphere wedge
[surf, opacity = 0.6,samples=21, domain=0:90, y domain=\thetaStart:\thetaEnd, z buffer=sort]
( { \r*cos(x)*cos(y) }, { \r*cos(x) * sin(y) }, { \r*sin(x) } );
% front plane
\addplot3[surf, opacity = 0.6,samples=2, domain=0:\f, y domain=0:4, z buffer=sort](x, 3*x, y);
%

• @LCarvalho Thank you very much ! (again ;)) Jun 25, 2017 at 8:49
• While I'm at it, the settings samples=41, samples y=7,  (or so...) for the sphere wedge (in the \addplot3[surf,...) may be better-looking, in this geometrical configuration. Jul 5, 2017 at 9:52