Why does a SUBPLOT on top of another plot remove the underlying plots?

I want to create a set of 4 plots on top of which a fifth plot is created in the center. In order to accomplish this, I have tried to use the SUBPLOT command:
for i = 1:4
subplot(2, 2, i)
plot(rand(1, 10));
end
subplot('Position', [.35, .35, .3, .3]);
imshow('canoe.tif')
However, the result is just an image of the canoe. The other plots are gone.

 Respuesta aceptada

This change has been incorporated into the documentation in Release 2009b (R2009b). For previous releases, read below for any additional information:
This is intended behaviour of the SUBPLOT command when different SUBPLOT axes are overlapping as described in the doucmentation. In order to avoid deletion of the first four plots, you should avoid using SUBPLOT for the top plot. For example create a new axes instead:
for i = 1:4
subplot(2, 2, i)
plot(rand(1, 10));
end
axes('Position', [.35, .35, .3, .3]);
imshow('canoe.tif')

Más respuestas (0)

Productos

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by