3D Horizontal Bar Plots in MATLAB®
How to make 3D Horizontal Bar Plots in MATLAB® with Plotly.
Plotly is known for its graphing libraries, but it's also a broader ecosystem for building interactive data apps, AI data analysis tools, and deploying and hosting Dash apps. Explore the full set of tools and platforms designed to help turn data into action. Discover Plotly.
Note: We are retiring documentation for R, MATLAB, Julia, and F#. Learn more about this change here.
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.
Create a 3-D horizontal bar graph of Y. By default, the style is detached.
load count.dat
Y = count(1:10,:);
figure
bar3h(Y)
fig2plotly(gcf, 'TreatAs', 'bar3h');
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.
Create a 3-D horizontal bar graph of Y and set the bar width to 0.5.
load count.dat;
Y = count(1:10,:);
width = 0.5;
figure
bar3h(Y,width)
title('Width of 0.5')
fig2plotly(gcf, 'TreatAs', 'bar3h');
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.
Create a 3-D horizontal bar graph of Y and specify the style option as grouped.
load count.dat
Y = count(1:10,:);
figure
bar3h(Y,'grouped')
title('Grouped Style Option')
fig2plotly(gcf, 'TreatAs', 'bar3h');
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.
Create a 3-D horizontal bar graph of Y and specify the style option as stacked.
load count.dat
Y = count(1:10,:);
figure
bar3h(Y,'stacked')
title('Stacked Style Option')
fig2plotly(gcf, 'TreatAs', 'bar3h');