Multiple Legends Multiple Colours

조회 수: 1 (최근 30일)
DARLINGTON ETAJE
DARLINGTON ETAJE 2021년 6월 15일
답변: Aghamarsh Varanasi 2021년 6월 18일
See code below. I want to label each colomn in a and b in the plot. The lines from variable a should have same colour theme variations and the line in b should have same colour theme variations....please please help me. dark yellow, yellow, gold...and so on.
a=rand(10,5);
b=rand(10,5);
c=rand(10,1);
d=rand(10,1);
hold(app.UIAxes,'on')
plot(app.UIAxes,a,c);
plot(app.UIAxes,b,c);
plot(app.UIAxes,d,c,'-b');
hold(app.UIAxes,'off')
legend(app.UIAxes)

답변 (1개)

Aghamarsh Varanasi
Aghamarsh Varanasi 2021년 6월 18일
Hi,
The color of the lines in the legend section is the same color that we use to plot the lines. To plot a line with a custom color (as an array of r,g,b values), refer to this documentation link.
For more information, refer to the documentation of ColorSpec and LineSpec.
Hope this helps

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by