Change colormap in app designer using Spinner

3 visualizaciones (últimos 30 días)
Konvictus177
Konvictus177 el 28 de Feb. de 2022
Editada: yanqi liu el 1 de Mzo. de 2022
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)

Respuesta aceptada

yanqi liu
yanqi liu el 1 de Mzo. de 2022
Editada: yanqi liu el 1 de Mzo. de 2022
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);

Más respuestas (1)

Cris LaPierre
Cris LaPierre el 28 de Feb. de 2022
Look into using caxis.

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by