Generate an interactive heatmap

조회 수: 3 (최근 30일)
Alexander Taylor
Alexander Taylor 2018년 4월 3일
답변: KSSV 2018년 4월 3일
I've created a heatmap using "imagesc" and I now want to make the plot interactive. I want the user to be able to click on any square they want and after doing so, another plot will be generated that shows the error points made within that particular square. How would I go about doing this? Would I need to create a GUI?

답변 (1개)

KSSV
KSSV 2018년 4월 3일
[X,Y,Z] = peaks(100) ;
pcolor(X,Y,Z)
shading interp
h = imrect() ;
pos = wait(h);
% Display the part extracted
x0 = pos(1) ; y0 = pos(1) ;
L = pos(3) ; B = pos(4) ;
x1 = x0+L ;
y1 = y0+L ;
N = 500 ;
x = linspace(x0,x1,N) ;
y = linspace(y0,y1,N) ;
[Xi,Yi] = meshgrid(x,y) ;
Zi = interp2(X,Y,Z,Xi,Yi) ;
pcolor(Xi,Yi,Zi) ;
shading interp

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by