Change colormap in app designer using Spinner

4 ビュー (過去 30 日間)
Konvictus177
Konvictus177 2022 年 2 月 28 日
編集済み: yanqi liu 2022 年 3 月 1 日
Hi,
I would like to interactively change the colormap in an app I created with app designer.
The prefered way to do this would be by using the spinner component in app designer.
When the spinner increases the color of the colormap at 0 should be assigned symmetrically in positive and negative colormap direction.
The Spinner is supposed to act like a filter.
E.g.:
Spinner = 2; Colormap from 2 to -2 should have same color as inital color at 0 from colormap.
Spinner = 1; Colormap from 1 to -1 should have same color as initial color at 0 from colormap.
Thanks.
Z = peaks;
x = linspace(0,2*pi);
y = linspace(0,2*pi);
figure()
imagesc(x,y,Z)
colorbar
colormap
% TODO: change the colormap interactively by using a spinner in such a way
% that the color of 0 will be assigned to whatever the Spinner is set to
% for both directions (negative and positive colormap)

採用された回答

yanqi liu
yanqi liu 2022 年 3 月 1 日
編集済み: yanqi liu 2022 年 3 月 1 日
may be use colormap by self design base on data,such as
Z = peaks;
x = linspace(0,2*pi);
y = linspace(0,2*pi);
figure()
imagesc(x,y,Z)
colorbar
colormap;
% define map
figure()
imagesc(x,y,Z)
colorbar
z = colormap(jet(64));
z(1:size(z,1)/2,:) = z(size(z,1)/2+1:end,:);
colormap(z);

その他の回答 (1 件)

Cris LaPierre
Cris LaPierre 2022 年 2 月 28 日
Look into using caxis.

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by