Can we plot horizontal boxchart?

73 visualizaciones (últimos 30 días)
Suman Dhakal
Suman Dhakal el 10 de Ag. de 2022
Editada: Kevin Holly el 10 de Ag. de 2022
Example data:
X
6.00
8.00
23.00
26.00
27.00
30.00
Y
9.00
8.00
24.00
39.00
36.00
43.00

Respuestas (1)

Kevin Holly
Kevin Holly el 10 de Ag. de 2022
Editada: Kevin Holly el 10 de Ag. de 2022
You can add the option 'orientation','horizontal' to your input for boxchart or boxplot. See examples below.
load carsmall
figure
boxplot(MPG,Origin,'orientation','horizontal')
title('Miles per Gallon by Vehicle Origin')
ylabel('Country of Origin')
xlabel('Miles per Gallon (MPG)')
figure
boxplot(MPG,Origin)
title('Miles per Gallon by Vehicle Origin')
xlabel('Country of Origin')
ylabel('Miles per Gallon (MPG)')
tsunamis = readtable('tsunamis.xlsx');
idx = contains(tsunamis.Cause,'Earthquake');
earthquakes = tsunamis(idx,:);
boxchart(earthquakes.Month,earthquakes.EarthquakeMagnitude)
xlabel('Month')
ylabel('Earthquake Magnitude')
figure
boxchart(earthquakes.Month,earthquakes.EarthquakeMagnitude,'orientation','horizontal')
ylabel('Month')
xlabel('Earthquake Magnitude')
With the data you provided:
X=[6.00
8.00
23.00
26.00
27.00
30.00];
Y=[9.00
8.00
24.00
39.00
36.00
43.00];
boxplot(X,Y,'orientation','horizontal');
figure
boxplot(X,Y,'orientation','vertical');

Categorías

Más información sobre Geographic 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!

Translated by