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
2015 年 5 月 9 日
You need to manually build a non linear colormap. Attach your data and script so people can show you how.
11 件のコメント
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
2015 年 5 月 9 日
I think after you clicked "Choose file" you forgot to click "Attach file" because your data never got attached.
see attached file. Thank you!
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
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
2015 年 5 月 9 日
Right but try with surf(Xm, Ym, log(Zm)) with the the axis set to linear instead of log.
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'

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.
Al
2015 年 5 月 20 日
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 についてさらに検索
製品
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
