- 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 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
nick
2024-1-4
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!