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 件のコメント

Al
Al 2015 年 5 月 9 日
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);
Image Analyst
Image Analyst 2015 年 5 月 9 日
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!
Walter Roberson
Walter Roberson 2015 年 5 月 9 日
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)
Walter Roberson
Walter Roberson 2015 年 5 月 9 日
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)
Walter Roberson
Walter Roberson 2015 年 5 月 10 日
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
Walter Roberson
Walter Roberson 2015 年 5 月 11 日
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.
Al
Al 2015 年 5 月 20 日
The one you asked for works. Thank you.
surf(Xm, Ym, Zm, log10(Zm)); set(gca,'ZScale','log');

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, 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