Borrar filtros
Borrar filtros

Legend displays labels with correct colors

5 visualizaciones (últimos 30 días)
Mark Reed
Mark Reed el 20 de Jul. de 2020
Respondida: Star Strider el 20 de Jul. de 2020
I have 10 arrays of data. Each array creates 10 lines (data: 181X10) on a plot in the same color using plot(freq(:,i),data(:,:,i),ss{i}, 'LineWidth', 3). This give me 10 groups of 10 lines on the plot with each group color specified by SS. SS is a cell array that specifies the color used for each set of 10 lines: ss = {'b', 'g', 'r', 'c', 'm', 'y', 'k', 'b--', 'g--', 'r--', 'c--', 'm--', 'y--', 'k--', 'b*--', 'g*--', 'r*--', 'c*--', 'm*--', 'y*--', 'k*--'}. this all is contained in a FOR loop from 1:10. Labels are contained in a cell array: mb = {'data1' 'data2' .....}.
For example the first array of data plots 10 lines all in blue, the second array plots 10 lines all in green and so on up to 10 arrays (last array is 'g--'). My issue is how do you get the legend to display the correct label and cooresponding color for each group of 10 lines for the 10 arrays so the plot, legend color and style match ?

Respuestas (1)

Star Strider
Star Strider el 20 de Jul. de 2020
See if the approach in When specifying the color of points, legend does not match works in your application.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by