1
$\begingroup$

I have the following 3D function.

minMax = {0, 1}; 
col = {RGBColor[0, 0, 0.65], RGBColor[0, 0, 1], RGBColor[0, 0.5, 1],RGBColor[0, 0.75, 1], RGBColor[0, 1, 1], RGBColor[0.5, 1, 0.5],RGBColor[1, 1, 0], RGBColor[1, 0.75, 0], RGBColor[1, 0.5, 0], RGBColor[1, 0, 0], RGBColor[0.65, 0, 0]};
colAll = Blend[col, Rescale[#, minMax]] &;

    With[{is = 4, p = 9},  Plot3D[(i1^p/(is^p + i1^p)) (i2^p/(is^p + i2^p)), {i1, 0, 8}, {i2, 0,8}, ColorFunction -> colAll, Mesh -> 8,   PlotTheme -> "Scientific"]]

enter image description here

But when I used built in function ColorFunction -> "TemperatureMap" I am getting desired result.

enter image description here

Why my custom color only works one way? How can I fix this? Thanks..

$\endgroup$
  • $\begingroup$ use ColorFunction -> (colAll[#3] &)? $\endgroup$ – kglr Apr 23 '17 at 0:30
  • $\begingroup$ ... or change # to #3 in the definition of colAll. $\endgroup$ – kglr Apr 23 '17 at 0:38
  • $\begingroup$ That works. Thank you.. $\endgroup$ – OkkesDulgerci Apr 23 '17 at 0:40
  • $\begingroup$ I will use ColorFunction -> (colAll[#3] &) since I have 2D figures so I can use ColorFunction -> (colAll[#2] &) Thanks again.. $\endgroup$ – OkkesDulgerci Apr 23 '17 at 0:43
1
$\begingroup$

Changing either the setting for ColorFunction to

ColorFunction -> (colAll[#3] &)

or the definition of colAll to

colAll = Blend[col, Rescale[#3, minMax]] &;

gives

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.