I have a function with variables (theta,phi) the spherical coordinates.
I want to represent it as a density plot over the surface of a sphere.
following an answer to a previous question Density plot on the surface of sphere I have used the Texture[]
directive, which allows one to wrap textures on surfaces. For this application, we can wrap the output of DensityPlot[] (after some postprocessing with Image[]) on a sphere. I use this approach as DensityPlot[] automatically scale the values.
So, I have this code:
Block[{ymap8, θ, ϕ}, ymap8 = Image[DensityPlot[
ocho[θ, ϕ] // Evaluate, {ϕ, 0, 2 π}, {θ, 0, π},
AspectRatio -> Automatic, ColorFunction -> jet, Frame -> False, ImagePadding -> None,
PerformanceGoal -> "Quality", PlotPoints -> 200, PlotRange -> All,
PlotRangePadding -> None], ImageResolution -> 144];
f8 = ParametricPlot3D[{Cos[ϕ] Sin[θ],
Sin[ϕ] Sin[θ], Cos[θ]}, {ϕ, 0,
2 π}, {θ, 0, π}, Lighting -> "Neutral",
Mesh -> None, Boxed -> False, Axes -> False,
PlotStyle -> Texture[ymap8],
TextureCoordinateFunction -> ({#4, #5} &)]]
which produces a nice output:

My question is, how can I do to add a bar legend which gives the information about what values the false color represents??
Thanks,
Pablo!
Edit: the function is:
0.114082 + 0.754845 Cos[θ]^4 - 0.417772 Cos[θ]^6 +
0.114257 Cos[θ]^8 + 0.00117501 Cos[8 ϕ] Sin[θ]^8 +
Cos[θ]^2 (-0.417848 +
0.195306 Cos[4 ϕ] Sin[θ]^4) +
Cos[4 ϕ] (0.0331035 Sin[θ]^4 +
0.00208865 Sin[2 θ]^4)
Legended[f8, BarLegend[{"Rainbow", {0, 5}}]]? replace color function to your unknownjet– Harry Feb 16 '15 at 10:53Legended[f8, BarLegend[{ColorData["Rainbow"][#/2] &, {0, 5}}]],replace the pure functionColorData["Rainbow"][#/2] &to your own color function. what is jet? – Harry Feb 16 '15 at 11:22