Can't plot one-column stacked graph
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alexander Kurtz
el 12 de Mzo. de 2020
Comentada: Star Strider
el 12 de Mzo. de 2020
Hi everyone!
I've been using the bar command to make stacked graphs with no problems but when I try to make a one column stacked bar occurs the error 'X must be same length as Y.'
This is the code that I use and works for more than one column but not with one:
bar(1,[2 3], 'stacked')
0 comentarios
Respuesta aceptada
Star Strider
el 12 de Mzo. de 2020
It is only possible to plot two stacked bars. Hiowever, after that, it is possible to turn one of them off.
Try this:
figure
hb = bar(([2; 3]*[1 1])', 'stacked');
hb(1).XData(2) = NaN;
hb(2).XData(2) = NaN;
There may be other ways to do it as well.
2 comentarios
Star Strider
el 12 de Mzo. de 2020
My pleasure!
If my Answer helped you solve your problem, please Accept it!
Más respuestas (0)
Ver también
Categorías
Más información sobre Discrete Data 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!