rotate3d disabling datatips (probable bug)

2 次查看(过去 30 天)
I have a figure with two subplots. In subplot 1, I want to rotate the axes, while in subplot 2 I want data tips when I hover over the points. Due to a bug, this doesn't seem possible however?
When I enable rotate3d on subplot 1, it disables datatips in subplot 2. When I then disable rotate3d in subplot 1, the datatips appear in subplot 2 again. This seems like a bug to me, as a property of one subplot (not the parent figure!) affects the behavior of another (supposedly independent) subplot.
This behavior is the same in both R2019b and R2022a, so I assume it's the same in other versions too.
Code to reproduce the problem:
figure
%plot something in one subplot
hAx1=subplot(2,1,1);
x=1:3;
scatter3(hAx1,x,x,x);
%enable rotation in hAx1
h = rotate3d(hAx1);
h.Enable = 'on';
%plot something in another subplot
hAx2=subplot(2,1,2);
scatter(hAx2,x,x);
setAllowAxesRotate(rotate3d(hAx2),hAx2,0); %should disable rotation in hAx2, allowing data tips
enableDefaultInteractivity(hAx2); %enable default interactions, including data tips
hAx2.Interactions = dataTipInteraction; %enable only data tips, but this doesn't actually work
Now data tips do not show in hAx2.
When rotate3d is disabled for hAx1, the datatips again show up for hAx2:
h = rotate3d(hAx1);
h.Enable = 'off';

回答(1 个)

Shlok
Shlok 2024-7-19
Hi,
I tried replicating the issue, and I was able to reproduce it. It appears that the "Rotate 3D" option gets enabled in both subplots, even though the second subplot has its rotation disabled.
However, there is a workaround for this issue. In the figure window, you can disable the "Rotate 3D" option from the axes toolbar to access the data tips upon hovering. And re-enable this "Rotate 3D" option in order to achieve 3D rotation of the figure.
For more information regarding "rotate3d", you can refer to the following documentation link:
Hope this helps.

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by