triggering changes in plot with zoom function

1 回表示 (過去 30 日間)
Ulrich
Ulrich 2011 年 11 月 18 日
Hello,
I am trying to generate an interactive plot using the zoom feature of matlab. The plot is a scatter plot with serveral points.
In this plot I would like to change some of the displayed items as a function of the zoom level.
For example when I zoom to a certain level of detail, I would like to display labels for some of the data points. When I zoom out again, these labels should again disappear.
Can someone point me in the right direction where I should start looking?
Even better, does anybody have an example file where they are doing something similar?
All the best and many thanks in advance,
Ulrich

採用された回答

Jan
Jan 2011 年 11 月 18 日
From the help text of zoom:
h = zoom;
set(h, 'ActionPreCallback', @myprecallback);
set(h, 'ActionPostCallback', @mypostcallback);
function myprecallback(h, eventdata)
disp(eventdata)
function mypostcallback(h, eventdata)
disp(eventdata)
This means, that you can attach functions, which are called before and after zooming.
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 11 月 18 日
In my experience, the ActionPostCallback is the one you want to work with, in order to change the plot to reflect the zoom level the user has requested. The ActionPreCallback seems to be more for deciding whether a particular zoom is to be allowed or not.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Exploration についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by