Special characters in datacursormode

조회 수: 5 (최근 30일)
Amit Halevi
Amit Halevi 2017년 12월 1일
댓글: Amit Halevi 2017년 12월 8일
I'm trying to use datacursormode to display a data tip with \beta_1 and \beta_2 instead of x and y.
Setting
output_text = { ['\beta_1 = ' num2str(pos(1)) ], ['\beta_2 = ' num2str(pos(2)) ]}
yields a data tip with "\beta_1 = [the x coord of the cursor]" on one line and \beta_2 on the second, whereas this precise string works as desired in a title or legend or other place.
Is there some way to get the data tip to act like other graph text? Could I even get the LaTeX interpreter to work with it?
Thanks!
  댓글 수: 1
Walter Roberson
Walter Roberson 2017년 12월 1일
The screen update done by /Applications/MATLAB_R2017b.app/toolbox/matlab/scribe/+matlab/+graphics/+shape/+internal/@PointDataTip/private/createCustomStringStrategy.p using the String property of PointDataTip objects; everything about how the strings are put onto the screen appears to be in .p files.

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

채택된 답변

Mukul Rao
Mukul Rao 2017년 12월 4일
Hi, I work for the MathWorks Technical Support team. There is no documented way to change the interpreter for the "datacursor"; For now, only standard text is supported on figure data tips. There is an existing enhancement request in place.
That being said, there are a couple undocumented workarounds you can potentially consider
Please keep in mind that since these workarounds use undocumented methods, they are not guaranteed to work in future releases of MATLAB.
  댓글 수: 1
Amit Halevi
Amit Halevi 2017년 12월 8일
Thank you. The second one worked perfectly!
You may, however, wish to update the documentation for the UpdateFcn functionality; the help page for datacursormode says that the first argument is unused, whereas it seems in practice to be the DataCursor object.
Future-proofing isn't important, as it's academic code. That's the next batch of grad students' problem!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by