How to make LEGEND adapt when a plot is zoomed?
조회 수: 5 (최근 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
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
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 Exchange에서 Legend에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!