How can I specify the colors of multiple lines in a plot?
조회 수: 29 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2018년 7월 20일
답변: MathWorks Support Team
2018년 7월 30일
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))
채택된 답변
MathWorks Support Team
2018년 7월 20일
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))
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!