How to set even spacing between preset tick marks

51 visualizaciones (últimos 30 días)
Luis Reig Buades
Luis Reig Buades el 13 de Mayo de 2022
Respondida: Jan el 13 de Mayo de 2022
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 comentario
dpb
dpb el 13 de Mayo de 2022
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...

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 13 de Mayo de 2022
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.

Más respuestas (0)

Categorías

Más información sobre Polar Plots en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by