MATLAB: How to create a figure with a pie chart and a bar in the same window using subplot

subplot

How can I create a figure with a pie chart and a bar in the same window using subplot? I haven't used any inbuilt functions and I just want to know how to get them in the same window with different axis

Best Answer

X = [1 3 0.5 2.5 2];
figure
subplot(121)
bar(X)
subplot(122)
pie(X)