SphericalPlot3D

SphericalPlot3D[r,θ,ϕ]

generates a 3D plot with a spherical radius r as a function of spherical coordinates θ and ϕ.

SphericalPlot3D[r,{θ,θmin,θmax},{ϕ,ϕmin,ϕmax}]

generates a 3D spherical plot over the specified ranges of spherical coordinates.

SphericalPlot3D[{r1,r2,},{θ,θmin,θmax},{ϕ,ϕmin,ϕmax}]

generates a 3D spherical plot with multiple surfaces.

Details and Options

  • The angles theta and phi are measured in radians.
  • corresponds to "latitude"; is 0 at the "north pole", and at the "south pole".
  • phi corresponds to "longitude", varying from 0 to counterclockwise looking from the north pole.
  • SphericalPlot3D[r,θ,ϕ] takes theta to have range 0 to , and phi to have range 0 to .
  • The , , position corresponding to , , is , , . The variables and can have any values. The surfaces they define can overlap radially.
  • Holes are left at positions where the etc. evaluate to None, or anything other than real numbers.
  • SphericalPlot3D treats the variables theta and phi as local, effectively using Block.
  • SphericalPlot3D has attribute HoldAll, and evaluates the only after assigning specific numerical values to variables.
  • In some cases it may be more efficient to use Evaluate to evaluate the symbolically before specific numerical values are assigned to variables.
  • SphericalPlot3D has the same options as Graphics3D, with the following additions and changes:
  • AxesTruewhether to draw axes
    BoundaryStyleAutomatichow to draw boundary lines for surfaces
    ColorFunctionAutomatichow to determine the color of curves and surfaces
    ColorFunctionScalingTruewhether to scale arguments to ColorFunction
    EvaluationMonitorNoneexpression to evaluate at every function evaluation
    ExclusionsAutomatictheta, phi curves to exclude
    ExclusionsStyleNonewhat to draw at excluded points or curves
    MaxRecursionAutomaticthe maximum number of recursive subdivisions allowed
    MeshAutomatichow many mesh divisions in each direction to draw
    MeshFunctions{#4&,#5&}how to determine the placement of mesh divisions
    MeshShadingNonehow to shade regions between mesh divisions
    MeshStyleAutomaticthe style for mesh divisions
    MethodAutomaticthe method to use for refining surfaces
    NormalsFunctionAutomatichow to determine effective surface normals
    PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
    PlotLegendsNonelegends for surfaces
    PlotPointsAutomaticthe initial number of sample points in each parameter
    PlotStyleAutomaticgraphics directives for the style for each object
    PlotTheme$PlotThemeoverall theme for the plot
    RegionFunction(True&)how to determine whether a point should be included
    ScalingFunctionsNonehow to scale individual coordinates
    TextureCoordinateFunctionAutomatichow to determine texture coordinates
    TextureCoordinateScalingTruewhether to scale arguments to TextureCoordinateFunction
    WorkingPrecisionMachinePrecisionthe precision used in internal computations
  • Interactive labeling can be specified for curves or surfaces using Tooltip, StatusArea, or Annotation.
  • SphericalPlot3D[Tooltip[{r1, r2,}],] specifies that the should be displayed as tooltip labels for the corresponding surfaces.
  • Tooltip[r,label] specifies an explicit tooltip label for a surface.
  • SphericalPlot3D initially evaluates each function at a number of equally spaced sample points specified by PlotPoints. Then it uses an adaptive algorithm to choose additional sample points, subdividing in each parameter at most MaxRecursion times.
  • You should realize that with the finite number of sample points used, it is possible for SphericalPlot3D to miss features in your functions. To check your results, you should try increasing the settings for PlotPoints and MaxRecursion.
  • On[SphericalPlot3D::accbend] makes SphericalPlot3D print a message if it is unable to reach a certain smoothness of curve.
  • The arguments supplied to functions in MeshFunctions and RegionFunction are , , , , , and . Functions in ColorFunction and TextureCoordinateFunction are by default supplied with scaled versions of these arguments.
  • The functions are evaluated all over each surface.
  • By default, surfaces are treated as uniform white diffuse reflectors, corresponding to ColorFunction->(White&).
  • SphericalPlot3D returns Graphics3D[GraphicsComplex[data]].
  • Themes that affect 3D surfaces include:
  • "DarkMesh"dark mesh lines
    "GrayMesh"gray mesh lines
    "LightMesh"light mesh lines
    "ZMesh"vertically distributed mesh lines
    "ThickSurface"add thickness to surfaces
  • Possible settings for ScalingFunctions include:
  • {sx,sy,sz}scale the x, y and z coordinates
    {sx,sy,sz,sθ,sϕ}scale the θ and ϕ parameter spaces
  • Common built-in scaling functions s include:
  • "Log"log scale with automatic tick labeling
    "Log10"base-10 log scale with powers of 10 for ticks
    "SignedLog"log-like scale that includes 0 and negative numbers
    "Reverse"reverse the coordinate direction
    "Infinite"infinite scale
  • Scaling the θ or ϕ parameter space affects how the plot is sampled, but not the overall visual appearance of the plot.

Examples

open allclose all

Basic Examples  (3)

Plot a spherical surface:

Plot several spherical surfaces:

Style the resulting surface:

Scope  (18)

Sampling  (9)

More points are sampled when the function changes quickly:

The plot range is selected automatically:

Ranges where the function becomes nonreal are excluded:

The surface is split when there are discontinuities in the function:

Use PlotPoints and MaxRecursion to control adaptive sampling:

Use PlotRange to focus in on areas of interest:

Use Exclusions to remove points or split the resulting surface:

Plot multiple surfaces:

Use ScalingFunctions to reverse the direction of the x axis:

Presentation  (9)

Provide explicit styling to different surfaces:

Add labels:

Use legends for multiple surfaces:

Provide an interactive Tooltip for each surface:

Create an overlay mesh:

Style the areas between mesh levels:

Color by parameter values:

Use named color schemes:

Remove portions of a curve or surface:

Use a highly stylized theme:

Options  (62)

BoundaryStyle  (4)

BoundaryStyle automatically matches MeshStyle:

Use a thick red boundary:

Boundaries are drawn where the surface is clipped by RegionFunction:

Boundaries are not drawn where the surface is clipped by Exclusions:

BoxRatios  (2)

The default BoxRatios preserves the natural scale of the surface:

Use specific BoxRatios:

ColorFunction  (5)

Color a surface by , , , , , and parameters:

Use ColorData for predefined color gradients:

Named color gradients color in the direction:

ColorFunction has higher priority than PlotStyle:

ColorFunction has lower priority than MeshShading:

ColorFunctionScaling  (1)

Use scaled coordinates in the direction and unscaled coordinates in the direction:

EvaluationMonitor  (2)

Show where RevolutionPlot3D samples a function in coordinates:

Count the number of sample points on the surface:

Exclusions  (5)

This uses automatic methods to compute exclusions, in this case from branch cuts:

Indicate that no exclusions should be computed:

Give a set of exclusions as an equation:

Give three sets of exclusions:

Use both automatically computed and explicit exclusions:

ExclusionsStyle  (2)

Style the boundary with a red line:

Style the boundary with a red line and the surface in between with yellow:

MaxRecursion  (1)

Refine the surface where it changes quickly:

Mesh  (5)

Show the initial and final sampling meshes:

Use 10 mesh levels evenly spaced in the parameter directions:

Use a different number of mesh lines in different directions:

Use an explicit list of values for the mesh in the parameter and no mesh in the parameter:

Use explicit value and style for the mesh:

MeshFunctions  (2)

Use a mesh evenly spaced in the , , , , , and directions:

Show five mesh levels in the direction (red) and ten in the direction (blue):

MeshShading  (7)

Alternate red and blue arcs in the direction:

Use None to remove segments:

MeshShading has higher priority than PlotStyle for styling:

Use the PlotStyle for some segments by setting MeshShading to Automatic:

MeshShading can be used with ColorFunction:

Fill between regions defined by multiple mesh functions:

Use FaceForm to use different styles for different sides of a surface:

MeshStyle  (2)

Use a red mesh in the direction:

Use a red mesh in the direction and a blue mesh in the direction:

NormalsFunction  (3)

Normals are automatically calculated:

Use None to get flat shading for all the polygons:

Vary the effective normals used on the surface:

PerformanceGoal  (2)

Generate a higher-quality plot:

Emphasize performance, possibly at the cost of quality:

PlotLegends  (3)

Use placeholders to identify plot styles:

Use specific labels:

Use the expressions as legends:

Use Placed to control legend position:

PlotPoints  (1)

Use more initial points to get a smoother plot:

PlotStyle  (3)

Use different style directives:

Explicitly specify the style for different surfaces:

Use a different style inside the surface:

PlotTheme  (3)

Use a theme with detailed ticks, grid lines, and legends:

Turn off the mesh lines:

Create a thick surface for 3D printing:

RegionFunction  (2)

Select a region in , , , , , and :

Select a region in parameter space:

TextureCoordinateFunction  (4)

Textures use scaled and parameters by default:

Use the and coordinates:

Use unscaled coordinates:

Use textures to highlight how parameters map onto a surface:

TextureCoordinateScaling  (1)

Use scaled or unscaled coordinates for textures:

WorkingPrecision  (2)

Evaluate functions using machine-precision arithmetic:

Evaluate functions using arbitrary-precision arithmetic:

Applications  (5)

Plot a sphere:

A spiraling shell:

An oscillation around a sphere:

Plot an eigenfunction to the Laplace equation in spherical coordinates:

Plot the absolute value and color by phase:

Properties & Relations  (8)

SphericalPlot3D is a special case of ParametricPlot3D:

Use RevolutionPlot3D for revolved surfaces and cylindrical coordinates:

Use ParametricPlot3D for arbitrary curves and surfaces in three dimensions:

Use PolarPlot for curves in polar coordinates:

Use ParametricPlot for curves and regions in two dimensions:

Use ContourPlot3D and RegionPlot3D for implicitly defined surfaces and regions:

Use ListPlot3D and ListSurfacePlot3D for data:

Use Sphere for generating spheres:

Possible Issues  (1)

Surfaces that have multiple coverings may exhibit unusual behavior:

Neat Examples  (2)

An oscillating spherical surface:

An oscillating piecewise spherical surface:

Wolfram Research (2007), SphericalPlot3D, Wolfram Language function, https://reference.wolfram.com/language/ref/SphericalPlot3D.html (updated 2022).

Text

Wolfram Research (2007), SphericalPlot3D, Wolfram Language function, https://reference.wolfram.com/language/ref/SphericalPlot3D.html (updated 2022).

CMS

Wolfram Language. 2007. "SphericalPlot3D." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/SphericalPlot3D.html.

APA

Wolfram Language. (2007). SphericalPlot3D. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SphericalPlot3D.html

BibTeX

@misc{reference.wolfram_2022_sphericalplot3d, author="Wolfram Research", title="{SphericalPlot3D}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/SphericalPlot3D.html}", note=[Accessed: 26-November-2022 ]}

BibLaTeX

@online{reference.wolfram_2022_sphericalplot3d, organization={Wolfram Research}, title={SphericalPlot3D}, year={2022}, url={https://reference.wolfram.com/language/ref/SphericalPlot3D.html}, note=[Accessed: 26-November-2022 ]}