Effacer les filtres
Effacer les filtres

ImagePosition, FigPosition, and AxisPosition perplexity

1 vue (au cours des 30 derniers jours)
francois heslot
francois heslot le 4 Avr 2023
Commenté : Rik le 4 Avr 2023
Hello,
How to get the coordinates of the 4 corners of an image within a figure,
and how it relates to the figure position, the axis position, the xlimits, the ylimits, and possibly the PlotBoxAspectRatio.
also:
imshow('saturn.png');
% then eventually manipulate the figure position, the axis position, the xlim, the ylim.
%
% Why the following code below fails to get the proper image corners (lower left x-y point, width, height),
% in pixel units ?
axlim = get(gca,'Position')
fglim = get(gcf,'Position')
x1 = axlim(1)*fglim(3) + fglim(1);
x2 = (axlim(1)+axlim(3))*fglim(3) + fglim(1);
y1 = axlim(2)*fglim(4) + fglim(2);
y2 = (axlim(2)+axlim(4))*fglim(4) + fglim(2);
Thanks,
  1 commentaire
Rik
Rik le 4 Avr 2023
I'm not entirely certain the size of the axes object will change if the image requires a smaller window. You might need to get the position of the image object (perhaps by querying the XData and YData properties).

Connectez-vous pour commenter.

Réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by