I've just updated from R2018b to R2019b, and now every time I click on a plot, it prints a new Data Tip without my asking it to. So just clicking on a plot to make the axes current or pan or zoom ends up creating a mess like this:
Screen Shot 2020-01-02 at 12.25.41 PM.png
Is there any way to disable this behavior?

 채택된 답변

Mustafa Abu-Mallouh
Mustafa Abu-Mallouh 2020년 1월 2일
편집: Mustafa Abu-Mallouh 2020년 1월 2일

2 개 추천

There are a few ways to go about this. To do this for individual plots, you can use the disableDefaultInteractivity command as below:
x = 0:0.01:10;
y = sin(x);
figure(1)
plot(x,y)
disableDefaultInteractivity(gca)
If you would like to do it for all of the created plots in a session, use
>> set( groot , 'defaultAxesCreateFcn' , 'disableDefaultInteractivity(gca)' )
However, with that method it will reset everytime you start up MATLAB.
If you would like this to apply whenever you open MATLAB, you'll need to implement it into your startup.m file. Here is an example of how you could implement it (MATLAB version 9.7 is 2019b)
if ~verLessThan('MATLAB','9.7')
set( groot , 'defaultAxesCreateFcn' , 'disableDefaultInteractivity(gca)' )
end

댓글 수: 8

Chad Greene
Chad Greene 2020년 1월 2일
Nope! That's the first thing I tried, but it apparently has no effect in 2019b.
Mustafa Abu-Mallouh
Mustafa Abu-Mallouh 2020년 1월 2일
Apologies, I glossed over the 2019b remark. I edited the answer with 3 implementations that should answer your question.
Chad Greene
Chad Greene 2020년 1월 2일
Ah, brilliant! That works perfectly! Thanks Mustafa! I've added your suggested if statement to my startup.m.
Thanks again!
Bjorn Gustavsson
Bjorn Gustavsson 2020년 8월 28일
Thank you very much. Definitely a solution providing great relief.
There is a bug with this solution that will cause some strange and unexpected behaviors.
The issue is the call to gca, which will only work if the axes has HandleVisibility set to 'on' and if the parent figure of the axes also has HandleVisibility set to 'on'. Otherwise, gca will create a new axes instead of operating on the axes you think it should. This is particularly troublesome for App Designer, because the figure has HandleVisibility set to 'off' by default.
The better way to achieve the same goal is to use a function handle and set the DefaultAxesCreateFcn like this:
if ~verLessThan('MATLAB','9.7')
set(groot, 'defaultAxesCreateFcn', @(ax,~) disableDefaultInteractivity(ax))
end
The difference here is that the axes handle itself is passed directly to disableDefaultInteractivity so it is no longer dependent upon gca working.
Nils Tilton
Nils Tilton 2021년 4월 13일
I also cant stand the data tips. I tried this solution, but it didnt change anything. Any advice? Maybe I didn't edit my startup.m properly...
Chad Greene
Chad Greene 2021년 4월 14일
Yeah, none of the proposed solutions are working for me these days either. Just have to keep swatting them away.
Tong D
Tong D 2021년 4월 22일
right click and delete all data tips

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

릴리스

R2019b

태그

질문:

2020년 1월 2일

댓글:

2021년 4월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by