رسم نمودار میله ای (bar graph) افقی، با دستور barh در متلب :
با استفاده از دستور barh در متلب، می توانیم یک نمودار میله ای (bar graph) افقی رسم کنیم. نمودار میله ای افقی را می توانیم به شکل های مختلفی رسم کنیم که در ادامه، خود مثال های نرم افزار متلب را ذکر می کنیم.
مثال :
close all
clc
y = [75.995 91.972 105.711 123.203 131.669 ...
150.697 179.323 203.212 226.505 249.633 281.422];
figure;
barh(y);
نتیجه :
مثال :
در کد زیر، پهنای هر میله (bar) را برابر 0.4 قرار می دهیم :
close all
clc
y = [75.995 91.972 105.711 123.203 131.669 ...
150.697 179.323 203.212 226.505 249.633 281.422];
figure;
barh(y,0.4);
نتیجه :
مثال :
close all
clc
y = [75.995 91.972 105.711 123.203 131.669 ...
150.697 179.323 203.212 226.505 249.633 281.422];
figure;
subplot(2,2,1); barh(y,'grouped');
subplot(2,2,2); barh(y,'stacked');
subplot(2,2,3); barh(y,'hist');
subplot(2,2,4); barh(y,'histc');
نتیجه :
مثال :
close all
clc
y = [75.995 91.972 105.711 123.203 131.669 ...
150.697 179.323 203.212 226.505 249.633 281.422];
figure;
barh(y,'r')
نتیجه :
مثال :
close all
clc
y = [75.995 91.972 105.711 123.203 131.669 ...
150.697 179.323 203.212 226.505 249.633 281.422];
figure;
barh(y,'g','EdgeColor',[1 0.5 0.5]);
نتیجه :
مثال :
close all
clc
y = [75.995 91.972 105.711 123.203 131.669 ...
150.697 179.323 203.212 226.505 249.633 281.422];
x = [1900:10:2000];
figure;
barh(x,y);
نتیجه :
مثال :
close all
clc
a = -2.9:0.2:2.9;
barh(a,exp(-a.*a),'r')
نتیجه :
مثال :
close all
clc
load count.dat;
yMat = count(1:6,:);
figure;
barh(yMat);
نتیجه :
مثال :
close all
clc
load count.dat;
yMat = count(1:6,:);
figure;
hMulti = barh(yMat);
set(hMulti,'LineWidth', 2, 'LineStyle',':');
نتیجه :
مثال :
close all
clc
Y = randn(3,5);
h = barh(Y);
set(get(h(1),'BaseLine'),'LineWidth',2,'LineStyle',':')
colormap summer % Change the color scheme
نتیجه :
رسم نمودار میله ای (bar graph) عمودی به صورت سه بعدی، با دستور bar3 در متلب :
با استفاده از دستور bar3 در متلب، می توانیم یک نمودار میله ای (bar graph) عمودی سه بعدی را رسم کنیم. نمودار میله ای عمودی سه بعدی را می توانیم به شکل های مختلفی رسم کنیم که در ادامه، خود مثال های نرم افزار متلب را ذکر می کنیم.
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3(y,'detached');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3(y,0.5,'detached');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
subplot(1,2,1);
bar3(y,'detached');
title('Detached');
subplot(1,2,2);
bar3(y,0.5,'detached');
title('Width = 0.5');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3(y,'grouped');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3(y,0.25,'grouped');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
subplot(1,2,1);
bar3(y,'grouped');
title('Grouped');
subplot(1,2,2);
bar3(y,0.25,'grouped');
title('Width = 0.25');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3(y,'stacked');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3(y,0.25,'stacked');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
subplot(1,2,1);
bar3(y,'stacked');
title('Stacked');
subplot(1,2,2);
bar3(y,0.25,'stacked');
title('Width = 0.25');
نتیجه :
رسم نمودار میله ای (bar graph) افقی به صورت سه بعدی، با دستور bar3h در متلب :
با استفاده از دستور bar3h در متلب، می توانیم یک نمودار میله ای (bar graph) افقی سه بعدی را رسم کنیم. نمودار میله ای افقی سه بعدی را می توانیم به شکل های مختلفی رسم کنیم که در ادامه، خود مثال های نرم افزار متلب را ذکر می کنیم.
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3h(y,'detached');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3h(y,0.5,'detached');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
subplot(1,2,1);
bar3h(y,'detached');
title('Detached');
subplot(1,2,2);
bar3h(y,0.5,'detached');
title('Width = 0.5');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3h(y,'grouped');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3h(y,0.25,'grouped');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
subplot(1,2,1);
bar3h(y,'grouped');
title('Grouped');
subplot(1,2,2);
bar3h(y,0.25,'grouped');
title('Width = 0.25');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3h(y,'stacked');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
bar3h(y,0.25,'stacked');
نتیجه :
مثال :
close all
clc
load count.dat;
y = count(1:10,:); % Loading the dataset creates a variable 'count'
figure;
subplot(1,2,1);
bar3h(y,'stacked');
title('Stacked');
subplot(1,2,2);
bar3h(y,0.25,'stacked');
title('Width = 0.25');
نتیجه :
The post نمودار میله ای در متلب appeared first on سیم پاور.