How to make LEGEND adapt when a plot is zoomed?

5 ビュー (過去 30 日間)
marcel hendrix
marcel hendrix 2019 年 6 月 29 日
コメント済み: Walter Roberson 2019 年 6 月 30 日
I have quite a 'busy' plot with potentially up to 50 or more curves on it. I made a (large :-) legend box that allows the user to identify which curve is which.
The 'problem' is that when zooming into this figure, many of the curves become invisible. However, the number of items in the legend box does not adapt. Is it possible to show the label in the legend box only for these lines that are actually visible, or turn off labels for those lines that have become invisible because of the zooming? This would greatly enhance the clarity of the plot.
-marcel
  7 件のコメント
dpb
dpb 2019 年 6 月 30 日
You might be able to adapt some of the Image Processing TB functions? (I think there are some tools there about intersection spaces altho I don't have it to know for certain.) Then there's rectint in base product that could possibly be helpful. In that case would depend greatly on the form of the data lines methinks as the bounding rectangle could enclose but there still a section being shown in part...
Walter Roberson
Walter Roberson 2019 年 6 月 30 日
If all x is less than plot lower x or all x is greater than plot upper x or likewise for y, then the object is off screen.
There is no built-in for this, you will need to iterate over all of the graphics objects in your zoom callback.
Be careful not to test for
all(x in range) and all(y in range)
If you do that then you incorrectly exclude objects that cross from side to side.

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

回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by