How to make the axes equal

6 visualizaciones (últimos 30 días)
Eliska Paulikova
Eliska Paulikova el 7 de Mzo. de 2023
Comentada: Dyuman Joshi el 7 de Mzo. de 2023
axes_x = htabulka(:,1);
axes_y = htabulka(:,2);
plot(axes_x, axes_y)
Dolx=Sp(:,1)-82.5;
Dopx=Sp(:,1)+82.5;
Doly=Sp(:,2)-82.5;
Dopy=Sp(:,2)+82.5;
xlim([Dolx Dopx])
ylim([Doly Dopy])
xtick=([Dolx Dopx])
ytick=([Doly Dopy])
conversion=0.145; % in mm/pixel
addMM=@(x) sprintf('%.f mm',x*conversion);
xticklabels(cellfun(addMM,num2cell(xticks'),'UniformOutput',false));
yticklabels(cellfun(addMM,num2cell(yticks'),'UniformOutput',false));
Hello, I have this code, which works perfect for me, but it gives me the axes, which is not equal, I would like to make the axes from 0 to 24, but as you can see, it is not perfekt.
  3 comentarios
Eliska Paulikova
Eliska Paulikova el 7 de Mzo. de 2023
They dont, that is the problem, I would like to make the axes fix from 0 to 24
Dyuman Joshi
Dyuman Joshi el 7 de Mzo. de 2023
%Either manually define the limits in xlim and ylim
xlim([0 24])
ylim([0 24])
%or use axis
axis([0 24 0 24])

Iniciar sesión para comentar.

Respuestas (1)

Arka
Arka el 7 de Mzo. de 2023
Editada: Arka el 7 de Mzo. de 2023
Hi,
Since I do not have access to the variables htabulka and Sp, I cannot run the MATLAB code on my end.
I used a custom dataset to generate the plot.
theta = linspace(0, 2*pi, 100);
axes_x = cos(theta)*round(1/0.145)+4/0.145;
axes_y = sin(theta)*round(1/0.145)+4/0.145;
plot(axes_x, axes_y)
%xlim([0 round(25/0.145)])
%ylim([0 round(25/0.145)])
xtick=([0 round(25/0.145)*1/3 round(25/0.145)*2/3 round(24/0.145)])
xtick = 1×4
0 57.3333 114.6667 166.0000
ytick=([0 round(25/0.145)*1/3 round(25/0.145)*2/3 round(24/0.145)])
ytick = 1×4
0 57.3333 114.6667 166.0000
conversion=0.145; % in mm/pixel
addMM=@(x) sprintf('%.f mm',x*conversion);
xticklabels(cellfun(addMM,num2cell(xtick'),'UniformOutput',false));
yticklabels(cellfun(addMM,num2cell(ytick'),'UniformOutput',false));
Hope this is what you were looking for.

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by