Skip to main content
Became Hot Network Question
minor edit/code blocks and greek symbols added
Source Link
Syed
  • 59.3k
  • 5
  • 40
  • 95

I am trying to plot a density plot on a surface of a sphere, where the density function Sqrt[1-x^2]Sqrt[1-x^2] is symmetric around 00. (There, x=Sin[[Theta]] Cos[[Phi]].x=Sin[θ] Cos[ϕ]).

So far I have:

ParametricPlot3D[{Sin[[Theta]] Cos[[Phi]], Sin[[Theta]] Sin[[Phi]], Cos[[Theta]]}, {[Theta], 0, [Pi]}, {[Phi], 0, 2 [Pi]}, ColorFunction -> Function[{x, y, z, [Theta], [Phi]}, ColorData["Rainbow"][Sqrt[1 - x^2]]]]

ParametricPlot3D[{Sin[θ] Cos[ϕ], 
Sin[θ] Sin[ϕ], Cos[θ]}, {θ, 0, π}, {ϕ, 0, 2 π}, ColorFunction -> Function[{x, y, z, θ, ϕ}, ColorData["Rainbow"][Sqrt[1 - x^2]]]]

But somehow when the plot is outputteddisplayed, values for x=1the colors at x=1 and x=-1 are differentx=-1 do not match. SomethingDoes it have something to do with ColorFunctionthe ColorFunction?

I am trying to plot a density plot on a surface of a sphere, where the density function Sqrt[1-x^2] is symmetric around 0. (There, x=Sin[[Theta]] Cos[[Phi]].) So far I have

ParametricPlot3D[{Sin[[Theta]] Cos[[Phi]], Sin[[Theta]] Sin[[Phi]], Cos[[Theta]]}, {[Theta], 0, [Pi]}, {[Phi], 0, 2 [Pi]}, ColorFunction -> Function[{x, y, z, [Theta], [Phi]}, ColorData["Rainbow"][Sqrt[1 - x^2]]]]

But somehow when the plot is outputted, values for x=1 and x=-1 are different. Something to do with ColorFunction?

I am trying to plot a density plot on a surface of a sphere, where the density function Sqrt[1-x^2] is symmetric around 0. (There, x=Sin[θ] Cos[ϕ]).

So far I have:

ParametricPlot3D[{Sin[θ] Cos[ϕ], 
Sin[θ] Sin[ϕ], Cos[θ]}, {θ, 0, π}, {ϕ, 0, 2 π}, ColorFunction -> Function[{x, y, z, θ, ϕ}, ColorData["Rainbow"][Sqrt[1 - x^2]]]]

But somehow when the plot is displayed, the colors at x=1 and x=-1 do not match. Does it have something to do with the ColorFunction?

Source Link

Plotting symmetric density plot on a surface of a sphere - ColorFunction problem

I am trying to plot a density plot on a surface of a sphere, where the density function Sqrt[1-x^2] is symmetric around 0. (There, x=Sin[[Theta]] Cos[[Phi]].) So far I have

ParametricPlot3D[{Sin[[Theta]] Cos[[Phi]], Sin[[Theta]] Sin[[Phi]], Cos[[Theta]]}, {[Theta], 0, [Pi]}, {[Phi], 0, 2 [Pi]}, ColorFunction -> Function[{x, y, z, [Theta], [Phi]}, ColorData["Rainbow"][Sqrt[1 - x^2]]]]

But somehow when the plot is outputted, values for x=1 and x=-1 are different. Something to do with ColorFunction?