1

enter image description hereI 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}}]]
Nirmalendu
  • 11
  • 2
  • 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. – m_goldberg Oct 11 '17 at 15:25
  • Sorry. Thanks for your comment. I have corrected it. Please check again and try to help me. Thanks again. – Nirmalendu Oct 13 '17 at 07:52

1 Answers1

3

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]

plot

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574