Positioning bar and image in the same figure
Afficher commentaires plus anciens
I'm trying to print an image above a bar plot in the same figure, manually changing their position using the set command with the OuterPosition option.
This works only if the vertical coordinate of the image is at least 0.42, in fact if it is below this value then the image disappears.
How can I place the image below 0.42?
subplot(2,1,1)
imshow( imread('https://i.imgur.com/TVlQhpj.jpg') )
set(gca, 'OuterPosition', [.3 .42 .4 .4]);
subplot(2,1,2)
bar(1:10)
set(gca, 'OuterPosition', [.3 0 .35 .23]);

4 commentaires
Rik
le 1 Mai 2020
Why are you using the OuterPosition property? Is there a particular reason you aren't using the Position property?
giannit
le 1 Mai 2020
Rik
le 1 Mai 2020
I tend to use the Position property. Also, you can store the handle generated by subplot, so you can avoid gca. You can also directly create the axes in the position you want it with the axes function.
giannit
le 1 Mai 2020
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Printing and Saving dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!