Declaring plot arguments/options beforehand

1 visualización (últimos 30 días)
Pankaj
Pankaj el 6 de Oct. de 2018
Respondida: Bruno Luong el 6 de Oct. de 2018
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

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by