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.

 채택된 답변

Image Analyst
Image Analyst 2015년 5월 9일

0 개 추천

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

댓글 수: 11

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 2015년 5월 9일
편집: Al 2015년 5월 9일
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?
Al
Al 2015년 5월 9일
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.
Al
Al 2015년 5월 10일
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'
Al
Al 2015년 5월 11일
편집: Al 2015년 5월 11일
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');

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

질문:

Al
2015년 5월 9일

댓글:

Al
2015년 5월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by