Declaring plot arguments/options beforehand

조회 수: 1 (최근 30일)
Pankaj
Pankaj 2018년 10월 6일
답변: Bruno Luong 2018년 10월 6일
I would like to declare arguments of plot function once and beforehand, so than I can use them in a loop or for many plots, which would avoid clutter. I need something like optimset.
I want something like following
lineColor = {'k', 'r', 'b', 'm'};
linestyle = {'-'; '--'; ':'; '-.'};
options = {'color',lineColor{j}, 'LineStyle', linestyle{j}}
for j = 1:4
plot(X(:,j), Y(:,j), options)
end

채택된 답변

Bruno Luong
Bruno Luong 2018년 10월 6일
lineColor = {'k', 'r', 'b', 'm'};
linestyle = {'-'; '--'; ':'; '-.'};
for j = 1:4
options = {'color',lineColor{j}, 'LineStyle', linestyle{j}};
plot(X(:,j), Y(:,j), options{:})
end

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by