- Retrieve the height and width of the image using “imfinfo”.
- Set the height and width of “UIAxes” to the image's height and width.
- Set the “InitialMagnification” to 'fit' as a Name-Value pair in “imshow”.
- Then, set the x and y limits of “UIAxes” using “XLim” and “YLim” to some larger values. Please refer to the code snippet below, which is attached to a submit button:
Control Chart Interactivity: cannot Pan outside of the images in 2021b
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I use app designer to create UIAxes and using its default axes tool bar for interactions.
In this case I am going to drawellipse that covers the circle region, like in picture 2.
In 2021b, If the display is like in picture 1 that the images filled up the entire axes, I am not able to zoom out to picture 2 where white spaces are avaiable around it so that the ellipse can be drawn with axes bigger than the display window. This is not the case for any version before 2021b.
In the version before 2021b, if I display as in picture 1, I will use Pan tool to shift a little bit then zoom out to have like in picture 2.
Can anyone let me know what is the explicity function / code to specifiy axes bigger than the picture?
0 commentaires
Réponses (1)
nick
le 4 Jan 2024
Hello Weiwei,
I understand from your query that you need assistance with programmatically specifying axes larger than the picture.
To achieve axes larger than the image, you need to add a callback:
cImage = imread("imgonline-com-ua-ReplaceColor-jG6Xmfl8o3AoC3.png"); %example image
InfoImage = imfinfo("imgonline-com-ua-ReplaceColor-jG6Xmfl8o3AoC3.png") %Retreiving the property of the example image
hImage = imshow(cImage,'Parent',app.UIAxes, 'InitialMagnification', 'fit') %Set the image to fit in UIAxes
app.UIAxes.Position = [10 10 InfoImage.Width InfoImage.Height] %Set the height and width of Axes equal to that of image
app.UIAxes.YLim = [ -1000 1000] %Increasing the Y limit of Axes
app.UIAxes.Visible = 'on'
Here is the obtained output using an example image:
For further information on “UIAxes”, kindly refer to the following documentation:
Hope this helps,
Regards,
Neelanshu
0 commentaires
Voir également
Catégories
En savoir plus sur Data Exploration dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!