How to get more color gradient on a surface plot?

I have made a surface plot. The color gradient is mostly dark blue. How can I adjust the color gradient to get more colors?
Adjusting the color map in the plot tools does not work.

 Accepted Answer

You need to manually build a non linear colormap. Attach your data and script so people can show you how.

11 Comments

xm=linspace(min(Data1),max(Data1),10)
ym=linspace(min(Data2),max(Data2),10)
[Xm,Ym]=meshgrid(xm,ym)
Zm=reshape(Data3, [10,10])
%figure
% Create axes
axes1 = axes('Parent',figure,'ZScale','log','ZMinorTick','on',...
'ZMinorGrid','on');
view(axes1,[67.5 4]);
grid(axes1,'on');
hold(axes1,'all');
surf(Xm,Ym,Zm);
I think after you clicked "Choose file" you forgot to click "Attach file" because your data never got attached.
Al
Al on 9 May 2015
Edited: Al on 9 May 2015
see attached file. Thank you!
Question: if you switch to linear scale for your Z but you surf on log(Zm) then does your plot come out better?
When I switch to the linear scale the color gradient stays exactly the same but it looks like the color gradient is a good match for the linear scale. Since it is so flat. (see attached picture)
Right but try with surf(Xm, Ym, log(Zm)) with the the axis set to linear instead of log.
That did it!. Thank you. Do you know how I can get the Z axis to have the correct scale. I tried to scale it. That took care of the positive values but not the negative. (scaled version not shown)
Okay, now try this:
surf(Xm, Ym, Zm, log10(Zm));
with ZScale set to 'log'
It gave some errors and no plot output
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In rotate3d>localRotateOrbitMotionFcn at 981
In rotate3d>rotaMotionFcn at 909
In hgfeval at 62
In uitools.uimode.schema>localEvaluateMotionCallback at 265
In uitools.uimode.schema>@(obj,evd)(localEvaluateMotionCallback(obj,evd,valueProposed)) at 247
Warning: Negative data ignored
> In plotchild at 26
In toolsmenufcn>LUpdateToolsMenu at 280
In toolsmenufcn at 110
In editmenufcn>localPost at 214
In editmenufcn at 38
Warning: Negative data ignored
> In plotchild at 26
In toolsmenufcn>LUpdateToolsMenu at 280
In toolsmenufcn at 110
In editmenufcn>localPost at 214
In editmenufcn at 38
Warning: Negative data ignored
> In plotchild at 26
In toolsmenufcn>LUpdateToolsMenu at 280
In toolsmenufcn at 110
In editmenufcn>localPost at 214
In editmenufcn at 38
Warning: Negative data ignored
> In getfigurefordesktopclient>fig2client at 21
In getfigurefordesktopclient at 12
Warning: Negative data ignored
> In graphics\private\prepare at 43
In print>LocalPrint at 264
In print at 233
In C:\Program Files\MATLAB\R2014a\toolbox\matlab\graphics\hgexport.p>hgexport at 895
In filemenufcn>localSaveExportHelper at 214
In filemenufcn>localSaveExport at 333
In filemenufcn at 56
Warning: Negative data ignored
I don't think you did what I asked. I think you did
surf(Xm, Ym, log10(Zm)); set(gca,'ZScale','log');
or else
surf(Xm, Ym, log10(Zm), Zm); set(gca,'ZScale','log');
or else
surf(Xm, Ym, log10(Zm), log10(Zm)); set(gca,'ZScale','log');
but what I asked for was
surf(Xm, Ym, Zm, log10(Zm)); set(gca,'ZScale','log');
You would only get the error you did if you had negative Zm or negative log10(Zm) in the third position in conjunction with log axis.
The one you asked for works. Thank you.
surf(Xm, Ym, Zm, log10(Zm)); set(gca,'ZScale','log');

Sign in to comment.

More Answers (0)

Products

Asked:

Al
on 9 May 2015

Commented:

Al
on 20 May 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!