How can I specify the colors of multiple lines in a plot?

26 Ansichten (letzte 30 Tage)
I have a matrix of 100 columns that I want to plot a separate line for each column.
Can I specify a different color for each column using 100 triplets of RGB values, e.g. 'jjj' below? If so, how?
>> qran = cumsum(randn(200,100));
>> figure;
>> plot(qran)
>> jjj = colormap(jet(100))

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 20 Jul. 2018
You can do this in MATLAB by setting the 'Color' property in a cell array:
>> qran = cumsum(randn(200,100));
>> jjj = colormap(jet(100))
>>
>> figure;
>> ax = plot(qran);
>> set(ax,{'Color'},num2cell(jjj,2))

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by