필터 지우기
필터 지우기

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 CenterFile Exchange에서 Red에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by