adjacent boxplots on same figure

14 visualizaciones (últimos 30 días)
Matthew
Matthew el 7 de Mzo. de 2014
Respondida: Sean de Wolski el 10 de Mzo. de 2014
I can make multiple horizontal boxplots in Matlab like:
| _____
| |-[_|__]-|
| ____
| |---[__|_]-|
-------------------------
But I want the two boxplots to be adjacent (on the same line), like this:
|
|
| ____ _____
| |---[__|_]-| |-[_|__]-|
-------------------------
How do I do that?

Respuestas (1)

Sean de Wolski
Sean de Wolski el 10 de Mzo. de 2014
hb = boxplot(1:10,[zeros(1,5) ones(1,5)], 'colorgroup', [0 1], 'colors', 'rb', 'orientation', 'horizontal');
Get each graphics object's handle (second column is second box) and set its 'YData' to be the former ydata I the index
for ii = 1:size(hb,1)-1
set(hb(ii,2),'YData',get(hb(ii,2),'YData')-1)
end
This would extend as the number of boxes grows too.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by