MATLAB bar3h in MATLAB®
Learn how to make 4 bar3h charts in MATLAB, then publish them to the Web with Plotly.
Create 3-D Horizontal Bar Graph
Load the data set count.dat
, which returns a three-column matrix, count
. Store Y
as the first ten rows of count
.
load count.dat Y = count(1:10,:);
Create a 3-D horizontal bar graph of Y
. By default, the style is detached
.
figure bar3h(Y) fig2plotly('TreatAs', 'bar3h')
![](https://raw.githubusercontent.com/plotly/ssim_baselines/main/out_matlab/matlab/code-examples/discrete-data-plots/bar3h/plot_0_0_create_3_d_horizontal_bar_graph_ssim_map.png)
![](https://raw.githubusercontent.com/plotly/ssim_baselines/main/out_matlab/matlab/code-examples/discrete-data-plots/bar3h/plot_0_0_create_3_d_horizontal_bar_graph_montage.png)
Specify Bar Width for 3-D Horizontal Bar Graph
Load the data set count.dat
, which returns a three-column matrix, count
. Store Y
as the first ten rows of count
.
load count.dat; Y = count(1:10,:);
Create a 3-D horizontal bar graph of Y
and set the bar width to 0.5.
width = 0.5; figure bar3h(Y,width) title('Width of 0.5') fig2plotly('TreatAs', 'bar3h')
![](https://raw.githubusercontent.com/plotly/ssim_baselines/main/out_matlab/matlab/code-examples/discrete-data-plots/bar3h/plot_1_0_specify_bar_width_for_3_d_horizontal_bar_graph_ssim_map.png)
![](https://raw.githubusercontent.com/plotly/ssim_baselines/main/out_matlab/matlab/code-examples/discrete-data-plots/bar3h/plot_1_0_specify_bar_width_for_3_d_horizontal_bar_graph_montage.png)
3-D Horizontal Bar Graph with Grouped Style
Load the data set count.dat
, which returns a three-column matrix, count
. Store Y
as the first ten rows of count
.
load count.dat Y = count(1:10,:);
Create a 3-D horizontal bar graph of Y and specify the style option as grouped
.
figure bar3h(Y,'grouped') title('Grouped Style Option') fig2plotly('TreatAs', 'bar3h')
![](https://raw.githubusercontent.com/plotly/ssim_baselines/main/out_matlab/matlab/code-examples/discrete-data-plots/bar3h/plot_2_0_3_d_horizontal_bar_graph_with_grouped_style_ssim_map.png)
![](https://raw.githubusercontent.com/plotly/ssim_baselines/main/out_matlab/matlab/code-examples/discrete-data-plots/bar3h/plot_2_0_3_d_horizontal_bar_graph_with_grouped_style_montage.png)
3-D Horizontal Bar Graph with Stacked Option
Load the data set count.dat
, which returns a three-column matrix, count
. Store Y
as the first ten rows of count
.
load count.dat Y = count(1:10,:);
Create a 3-D horizontal bar graph of Y and specify the style option as stacked
.
figure bar3h(Y,'stacked') title('Stacked Style Option') fig2plotly('TreatAs', 'bar3h')
![](https://raw.githubusercontent.com/plotly/ssim_baselines/main/out_matlab/matlab/code-examples/discrete-data-plots/bar3h/plot_3_0_3_d_horizontal_bar_graph_with_stacked_option_ssim_map.png)
![](https://raw.githubusercontent.com/plotly/ssim_baselines/main/out_matlab/matlab/code-examples/discrete-data-plots/bar3h/plot_3_0_3_d_horizontal_bar_graph_with_stacked_option_montage.png)