exponential notation used for uislider Major Tick Mark Labels

조회 수: 4 (최근 30일)
Nick Bennett
Nick Bennett 2022년 9월 30일
댓글: Nick Bennett 2022년 10월 3일
When using the uislider component where the limits are particularly large, as in the following code snippet
fig = uifigure;
sld = uislider(fig);
sld.Limits = [1 20000];
the major tick mark labels use exponential notation.
Is there a way of turning off this exponential notation? Since the major tick marks change when resizing the figure, it would be nice to avoid modifying the major tick mark labels in the code.

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2022년 10월 1일
How about this way of scaling:
How about defining ticks and tick labels, e.g.:
fig = uifigure;
S = uislider(fig);
S.Limits = [0, 20000];
S.MajorTicks = [0, 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000];
S.MajorTickLabels = string([0, 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000]);
  댓글 수: 1
Nick Bennett
Nick Bennett 2022년 10월 3일
Thanks for this reply. However, if you run the code you posted, all the tick mark labels overlap, meaning that you're back in the situation where your code must adaptively adjust to the screen size allocated to the slider.
I am looking whether there is some facility in MATLAB for turning this exponential notation off, as we can do with axes labels via
ax.XAxis.Exponent = 0

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

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by