# How can I draw temperature map in form of cut-away sphere?

I am very new in Mathematica and I want to draw a temperature map. I have data which gives me the value of temperature in each spherical shell (the radius of the sphere is divided into number of concentric shells) and I need to color each spherical shell according to the value of temperature. I have tried the following. But I am not getting the radial color according to the "val" and also the color bar. Please help. Thanks a lot.

    val = ListInterpolation[{8, 8, 8, 4, 4, 4, 0, 0, 0}, {{0, 1.1}}]

Export["~/Desktop/earth-like.jpg",
RegionPlot3D[(x^2 + y^2 + z^2 <= 1) && (x < 0 || y > 0 ||
z < 0), {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
ColorFunction ->
Function[{x, y, z},
ColorData["TemperatureMap"][val[Sqrt[(x^2 + y^2 + z^2)]]]],
PlotPoints -> 100, Mesh -> False, Boxed -> False, Axes -> False,
ColorFunctionScaling -> False, Lighting -> "Neutral",
AxesLabel -> {X, Y, Z}, {ViewPoint -> {2, -0.5, 0.5}}]]

• Your code is not valid, working Mathematica code and it is essentially unreadable as well. Please edit the code in something that can be evaluated. Oct 11, 2017 at 15:25
• Sorry. Thanks for your comment. I have corrected it. Please check again and try to help me. Thanks again. Oct 13, 2017 at 7:52

Here's one possibility:

fun = ListInterpolation[{8, 8, 8, 4, 4, 4, 0, 0, 0}, {{0, 1.1}}];

reg = BoundaryDiscretizeRegion[RegionDifference[Ball[{0, 0, 0}, 11/10],
ConicHullRegion[{{0, 0, 0}},
{{1, 0, 0}, {0, -1, 0}, {0, 0, 1}} 11/10]],
MaxCellMeasure -> {"Length" -> 0.02},
Method -> "RegionPlot3D"];

SliceDensityPlot3D[fun[Sqrt[x^2 + y^2 + z^2]], reg,
{x, -1.1, 1.1}, {y, -1.1, 1.1}, {z, -1.1, 1.1},
ColorFunction -> "TemperatureMap", PlotPoints -> 545]


• Thanks. What is about the colorbar with values? Oct 14, 2017 at 11:25
• Look up PlotLegend. Oct 14, 2017 at 11:34
• Thanks for your help. Oct 19, 2017 at 14:23