Different color for each line
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Rachele Franceschini
el 13 de Abr. de 2022
Comentada: Rik
el 13 de Abr. de 2022
I would lilke to get for each line a different color.
the table features by 10 columns and 20 rows.
new_table = [t1 medienews]
plot(new_table{1, 2:end}', new_table{2:end, 2:end}',"LineWidth",2,'color',);
legend(new_table.t1{2:end}, 'location', 'eastoutside')
2 comentarios
Respuesta aceptada
Chunru
el 13 de Abr. de 2022
% generate some random data
x = rand(10, 20);
% Generate different colors
cmap = jet(20);
% Change the colororder
colororder(cmap);
plot(x)
legend(string(1:20), "Location", "eastoutside")
2 comentarios
Stephen23
el 13 de Abr. de 2022
Editada: Stephen23
el 13 de Abr. de 2022
For distinguishable colors you will need to use a more suitable colormap, e.g. TAB20 here:
https://www.mathworks.com/matlabcentral/fileexchange/62729-matplotlib-perceptually-uniform-colormaps
or perhaps generate your own colormap to suit your document colorscheme:
Más respuestas (0)
Ver también
Categorías
Más información sobre Colormaps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!