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 ExchangeData 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