How to set even spacing between preset tick marks
36 ビュー (過去 30 日間)
古いコメントを表示
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])
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/996875/image.png)
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
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
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Polar Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!