Plotting a cell
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I asked before about plotting a cell and need some clarification.
What I have is the ability to load up to 6 data files. Say I call the cell f, and it is frequency v. time. Data file 1 is stored in {1,1} and {1,2} which is (x1,y1), data file 2 is stored in {1,3} and {1,4} (x2,y2), etc, up to {1,11} and {1,12} (x6,y6).
I gather I can simply use:
plot(f{:})
As far as I can see, it automatically assumes column 1 is x1, column 2 is y1, 3 is x2, etc? Also, it will ignore empty columns?
How can I change the line style, marker type and color of each? I know how to do it when using multiple inputs in the plot command, but this is just 1 input.
0 comentarios
Respuesta aceptada
Walter Roberson
el 2 de Nov. de 2011
If your line style and marker and color can be represented using the standard short encoding such as 'r--o' then use triples, as if from executing
f{1} = x1;
f{2} = y1;
f{3} = linespec1; %eg., 'b--o'
f{4} = x2;
f{5} = y2;
f{6} = linespec2; %eg., 'r--s'
Then
plot(f{:})
However, if your specifications cannot be encoded in this form, such as if you wish to use a color other than 'b' 'c' 'g' 'k' 'm' 'r' 'w' 'y', then it is not possible to do everything in just one plot() call. In such a case, encode what you can in the f cell array, then
h = plot(f{:});
Then set() the properties of the lineseries handles returned:
set(h(1), 'Color', [0.2 .8 .5]) %example
set(h(2), 'Color', 'g'); %example
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!