![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1610561/image.png)
Why is matlab printing all number of digit.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
University
am 7 Feb. 2024
Kommentiert: Mathieu NOE
am 7 Feb. 2024
Please why matlab displaying all the number of digits on the y axis. See the attached figure, the code below produces the fiugre:
plot(xi, yinterceptr(:,1), 'r -*', LineWidth=1)
xlabel('activity, $\xi$','Interpreter','latex');
ylabel('$z$-intercept',' Interpreter','latex');
0 Kommentare
Akzeptierte Antwort
Mathieu NOE
am 7 Feb. 2024
your y data have all same value so the plot y scale is zoomed with a huge factor, that's why you get so many decimals in the y ticks
you can force it to another format , here for example :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1610561/image.png)
plot(x, y, 'r -*', 'LineWidth',1)
ax = gca;
ax.YAxis.TickLabelFormat = '%.2f';
2 Kommentare
Weitere Antworten (1)
Voss
am 7 Feb. 2024
"why [is] matlab displaying all the number of digits on the y axis[?]"
Because the range of the y-limits is very small, about 3e-19.
openfig('fig1.fig');
diff(ylim())
If you want, you can set the y-limits to have a larger range, e.g.:
openfig('fig1.fig');
dy = 1e-8;
ylim(-1e-6+dy*[-1 1])
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!