Getting a point from a heatmap.

I create a heatmap, but would then like to be able to click a point and have this create a variable of the x and y labels at this point.
for example:
a = [ 0.7143 1.6667 1.2500 1.4286 0 0 0
0.7143 0 0 1.8750 1.4286 1.4286 2.5000
0 0 0.7143 0.5556 0.8333 0.7143 0
1.0000 0 0.7143 1.2500 0.7143 1.4286 0];
heatmap(a)
When I create this heatmap I can hover my mouse over a box to give the X and Y coordinates, but how can I click to create these as a variable?

댓글 수: 1

Adam Danz
Adam Danz 2019년 1월 24일
Heatmap is a special plot that does not share the same set of properties as many other plots. For example, in a regular plot, you can right click anywhere on an axis and select "Export Cursor Data to Workspace" which will store the selected coordinate to a variable in your workspace. However, when you right click on a heatmap, nothing happens.
One way around this is to use imagesc() instead of heatmap() but then you lose some of the features that are helpful in heatmap().

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

제품

릴리스

R2018b

태그

질문:

2019년 1월 24일

댓글:

2019년 1월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by