![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/315936/image.png)
Setting Axis scale steps
190 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Youssef Darwich
el 14 de Jun. de 2020
Editada: Aditya Verma
el 15 de Jun. de 2020
Hello guys,
I'am new to Matlab and need your help
how can i set the axis such that every step is for example '8.03 units'?
thanks
0 comentarios
Respuesta aceptada
Aditya Verma
el 14 de Jun. de 2020
Editada: Aditya Verma
el 14 de Jun. de 2020
Hello,
You can set the x-axis ticks using xticks function:
x = 0:0.1:5;
plot(x, sin(x));
xticks(0:0.83:5);
xlim([0 5]);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/315936/image.png)
In a similar way you can set your y or z ticks. You can read more about it here: https://www.mathworks.com/help/matlab/ref/xticks.html
2 comentarios
Aditya Verma
el 15 de Jun. de 2020
Editada: Aditya Verma
el 15 de Jun. de 2020
The boundaries are limited by the extreme points of x which can be changed by xlim(). xticks() merely specifies a list of increasing values where the ticks should be marked, it could be out of the figure frame too! Consider the following example:
x = [4 2 6 0 -2];
plot(x, sin(x));
xticks([-4 8 10]);
You can hold and drag the graph to see those ticks.
I used xlim() because somehow 0 was being trimmed out from the graph at that moment, but now it's working fine :)
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!