Legends as pointers in matlab plot

11 visualizaciones (últimos 30 días)
ANKUR KUMAR
ANKUR KUMAR el 24 de Oct. de 2017
Respondida: Walter Roberson el 24 de Oct. de 2017
I have plotted a India map and over that, I have used geoshow to show few stations. I have assigned all the plane stations by blue dots and other stations by black triangular dots. How can I put these two things in the legend in matlab plot?

Respuesta aceptada

Walter Roberson
Walter Roberson el 24 de Oct. de 2017
The easiest way is to create a fake graphics object with coordinates NaN, NaN but with the appropriate shape and color and line attributes; do this repeatedly for each entry and record the handles. Then legend() against those handles with appropriate text in a cell array.
For example,
L(1) = plot(nan, nan, 'b.', 'MarkerSize', 5);
T{1} = 'Urmar Tanda';
L(2) = plot(nan, nan, 'b*', 'MarkerSize', 5);
T{2} = 'Pattamundai';
L(3) = plot(nan, nan, 'kv', 'MarkerSize', 8);
T{3} = 'Lakheri';
L(4) = plot(nan, nan, 'k^', 'MarkerSize', 8);
T{4} = 'Sirsa';
legend(L, T)

Más respuestas (0)

Categorías

Más información sobre Legend en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by