How to make LEGEND adapt when a plot is zoomed?

2 visualizaciones (últimos 30 días)
marcel hendrix
marcel hendrix el 29 de Jun. de 2019
Comentada: Walter Roberson el 30 de Jun. de 2019
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 comentarios
dpb
dpb el 30 de Jun. de 2019
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 el 30 de Jun. de 2019
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Graphics Object Properties en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by