Control Chart Interactivity: cannot Pan outside of the images in 2021b

1 visualizzazione (ultimi 30 giorni)
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?

Risposte (1)

nick
nick il 4 Gen 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:
  1. Retrieve the height and width of the image using imfinfo.
  2. Set the height and width of UIAxes to the image's height and width.
  3. Set the InitialMagnification to 'fit' as a Name-Value pair in imshow.
  4. 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:
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

Categorie

Scopri di più su Data Exploration in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by