Since the OP was unable/unwilling to provide data, I'm coming up with my own:
states = Entity["AdministrativeDivision", {#, "UnitedStates"}] & /@
CountryData["UnitedStates", "Regions"];
pos = Reverse[First[EntityValue[#, "Position"]]] & /@ states;
logPop = Log10[N[QuantityMagnitude[EntityValue[#, "Population"]]]] & /@ states;
logGSP = Log10[QuantityMagnitude[EntityValue[#, "GrossStateProduct"]]] & /@ states;
For the purposes of this answer, I'll use the triplet of pos
with logPop
as the $x$-$y$-$z$ data, and use logGSP
as the color map. Let's plot the data first as is:
dat = MapThread[Append, {pos, logPop}];
ListPlot3D[dat, ViewPoint -> {-2.4, -1.3, 2.}]
Now, here is how to color with respect to logGSP
: we create an interpolating function by feeding the values of logGSP
rescaled to $[0,1]$ along with the associated $x$ and $y$ to Interpolation[]
:
ifun = Interpolation[MapThread[Append, {pos, Rescale[logGSP]}]];
(There is a warning thrown, but it is mostly harmless here.)
From here, we can use ifun
along with an appropriate color function. Let's borrow the one in plotly used in the OP's picture:
portland = Blend[{RGBColor[4/85, 1/5, 131/255], RGBColor[2/51, 8/15, 62/85],
RGBColor[242/255, 211/255, 56/255], RGBColor[242/255, 143/255, 56/255],
RGBColor[217/255, 2/17, 2/17]}, #] &;
Now let's put it all together, along with Legended[]
to provide a sense of what the colors map to:
rng = MinMax[logGSP];
Legended[ListPlot3D[dat, ColorFunction -> Function[{x, y, z}, portland[ifun[x, y]]],
ColorFunctionScaling -> False, Lighting -> "Neutral",
PlotStyle -> Specularity[0.9, 50], PlotTheme -> None,
ViewPoint -> {-2.4, -1.3, 2.}],
BarLegend[{portland[Rescale[#, rng]] &, rng}]]
For comparison purposes, here is the result if one uses Nearest[Thread[pos -> Rescale[logGSP]]]
as the coloring function:
ListPlot3D[]
, but colored with (apparently) the "Portland" colormap? (Also, can you maybe post (a small sample of) your data to Pastebin?) $\endgroup$