フィルターのクリア

Coloring Function for mesh

2 ビュー (過去 30 日間)
Eli
Eli 2012 年 6 月 21 日
編集済み: SGUNITN 2020 年 12 月 2 日
Hey,
In default, when you make a graph via mesh(), the colouring scheme is a gradient from cold to hot as the z-axis increases in value (as z increases, the colour gets warmer). Instead, I'd like the gradient to work as a function of a 2d distance (specifically, as x^2+y^2 increases, the colour should get colder). Is there a relatively simple way to do this? Thanks!

回答 (2 件)

Sean de Wolski
Sean de Wolski 2012 年 6 月 21 日
Sure:
L = membrane; %sample data
ax = mesh(L); %mesh it!
sz = size(L,1); %how big?
set(ax,'cdata',bsxfun(@hypot,(1:sz)',1:sz),'cdatamapping','scaled'); %what color?
colormap(flipud(jet)); %colder is bigger

SGUNITN
SGUNITN 2020 年 12 月 2 日
編集済み: SGUNITN 2020 年 12 月 2 日
I am trying to plot features vs. observation (2-D data with 60 rows and 14 columns). Is it possible to use different colors for each features?

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by