subplot disappearing after changing left edge position
Show older comments
Hi everyone, thanks for your help in advance.
I have the following code to generate a series of subplots (to animate some data).
num_plot = 3;
x0 = [0];
y0 = [0];
y1 = [0.1 0.2 0.3 0.4 0.5 0.4 0.3 0.2 0.1];
y2 = [0.2 0.4 0.6 0.7 0.8 0.7 0.6 0.4 0.2];
x3 = [-0.5 -0.4 -0.3 -0.2 0 0.2 0.3 0.4 0.5];
y3 = [0 0.1 0.2 0.3 0.4 0.3 0.2 0.1 0];
set(0, 'DefaultFigurePosition', [200, 100, 1500, 800]);
figure;
xi10 = 0.12;
yi10 = 0.10;
xi11 = -0.01;
yi11 = 0.10;
xi12 = 0.05;
yi12 = 0.13;
for k = 1: length(y1)
clf;
subplot(num_plot,1,1);
bar(y1(k), 'b');
axis off;
set(subplot(num_plot,1,1), 'Position', [xi10, yi10, 0.01, 0.2]);
axis([0.6, 1.2, 0, 2]);
subplot(num_plot,1,2);
barh(-y2(k), 'g');
axis off;
set(subplot(num_plot,1,2), 'Position', [xi11, yi11, 0.15, 0.01]);
axis([-2, 0, 0.9, 1.1]);
subplot(num_plot,1,3);
plot([x0, x3(k)], [y0, y3(k)],'r', 'LineWidth', 5);
axis off;
set(subplot(num_plot,1,3), 'Position', [xi12, yi12, 0.1, 0.1]);
axis([-1, 1, 0, 1]);
pause(0.75);
end;
Since the bar and the barh charts don't line up nicely, I tried to shift the position slightly by setting xi10 = 0.125. However doing so caused the bar chart to disappear. Does anyone know how the Positions of the left edges affect the subplots? More precisely, how should the left edges be defined so that both subplots show up? Thanks so much for your help!
Accepted Answer
More Answers (0)
Categories
Find more on Discrete Data Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!