Is it possible to create a plot from a table?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hans Lipton
el 1 de Nov. de 2021
Comentada: Star Strider
el 1 de Nov. de 2021
I have a table and I'd like to create several plots from it.
Is it easier to create a plot from a table or matrix?
0 comentarios
Respuesta aceptada
Star Strider
el 1 de Nov. de 2021
Creating a plot from a table is straightforward, although the references are different —
T1 = array2table(randi(99, 5,3), 'VariableNames',{'Column 1','X','v'})
figure
plot(T1.('Column 1'), T1.X, 'p')
hold on
plot(T1.('Column 1'), T1.v, 's')
hold off
grid
If the first column is a datetime array, this is also straightforward —
T2 = table(datetime([2021 11 01])+days(0:4).', rand(5,1), randn(5,1))
figure
plot(T2{:,1}, T2{:,2}, 'p')
hold on
plot(T2{:,1}, T2{:,3}, 's')
hold off
grid
.
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D 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!