Why will quiver not overlay an imshow figure of uiaxes in appdesigner?

5 Ansichten (letzte 30 Tage)
Hi, I have a basic dicom viewer app I'm working on and want to be able to overlay a quiver arrow onto the same uiaxes as the image displayed using imshow. I have looked through similar questions which seem to imply this is quite straightforward, and can be achieved by writing them to the same axes (app.UIAxes), with a 'hold on' in between to enable overwrites. This does not work for me however, using:
imshow(image,gray,'parent',app.UIAxes);
hold on
quiver(app.UIAxes,256,256,-1,-1) % just some dummy numbers
I appreciate I haven't set axis limits, but I would still expect to have only 1 figure, even if I couldn't see the arrow. How can I force the arrow and image to share the same axes?/What am I failing to understand?
Cheers, C
  2 Kommentare
Voss
Voss am 8 Feb. 2022
What specific behavior do you observe that tells you it's not working?
Cameron Starling
Cameron Starling am 9 Feb. 2022
1) If I use the imshow line first followed by hold on then quiver, the arrow shows in the uiaxes on the app window, and a blank axes pops out in a new figure (I cant see my image). 2) If I remove the hold on line the blank pop out no longer shows, only the arrow in the app window.
3) If I use the quiver line first followed by hold on and imshow, I can see my image in the app window and another blank axes pops out, and i can't see the arrow. 4) When I remove hold on with quiver first, I only see my image, as expected. The first 3 of 4 behaviours don't make sense to me.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 9 Feb. 2022
hold on
You have not told hold which axes to work against. It is going to search for the active axes to change the properties of. It is only going to search traditional axes in traditional figures, and will never look at the uifigure uiaxes to determine if it is active. Then, not seeing an active traditional figure, it is going to create one...
You need
hold(app.UIAxes, 'on')

Weitere Antworten (0)

Kategorien

Mehr zu Vector Fields finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by