Change colormap in app designer using Spinner

9 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Red 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by