필터 지우기
필터 지우기

How to set even spacing between preset tick marks

조회 수: 36 (최근 30일)
Luis Reig Buades
Luis Reig Buades 2022년 5월 13일
답변: Jan 2022년 5월 13일
Hello,
I am trying to evenly space tick marks that I have set using set(gca,'XTick',[]) in order to better capture regions of high change in my plot:
LineColor1 = 'b';
el1=readmatrix("element152322_bimodal.csv");
plot(el1(:,1),el1(:,2),LineColor1,'LineWidth',LineWidth)
xlim([60 100])
set(gca,'XTick',[60.7 60.9 91.1 91.3])
I have not been able to find a way to do this. Is there any way to do it withour modifying my data, or an easy way to modify it for this purpose?
  댓글 수: 1
dpb
dpb 2022년 5월 13일
Ticks don't change the range, they simply are shown on the axis at the positions given; to expand a region you would have to set xlim or use the zoom feature.
Unfortunately, MATLAB graphics axis object does not support a broken/split axis automagically to be able to blow up two disparate areas such as you have simultaneously; it maintains a continuous x axis between the limits and draws the data at the actual x values.
It would take drawing the two sections on separate axes to show both simultaneously.
There may be some submissions on the File Exchange that could facilitate this; it's another one of those obvious enhancements that just hasn't ever made it...

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

채택된 답변

Jan
Jan 2022년 5월 13일
What do you exactly want as output?
Beside the possibility to do this in Matlab, think twice if the person can understand the output on first view. An irregulare scaling with some magnified areas is a perfect way to present confusing data.
One way to show the areas of interest is to show the areas of interest:
LineColor1 = 'b';
el1=readmatrix("element152322_bimodal.csv");
t = el1(:, 1);
y = el1(:, 2);
m1 = (t >= 60.7) & (t <= 60.9);
ax1 = subplot(1,2,1);
plot(t(m1), y(m1));
xlim([60.7, 60.9]);
m1 = (t >= 91.1) & (t <= 91.3);
ax2 = subplot(1,2,2);
plot(t(m1), y(m1));
xlim([91.1, 91.3]);
Another option is to use a logarithmic scaling for the y axis.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by