How to change axis label position on a figure in MATLAB?
65 次查看(过去 30 天)
显示 更早的评论
Hello
Dear all,
In a scatter plot I changed the ax.XAxisLocation and ax.YAxisLocation to be 'origin', however, I do not want the x-axis and y-axis label be inside the plot. I want to move it outside (like the picture below) and also rotate it if necessary. I appreciate it you help me.'
Thank you.
0 个评论
回答(1 个)
Star Strider
2020-7-23
It is not possible to re-position them, so use text objects to create the axis labels in the appropriate positions.
Try something like this example:
figure
scatter(randn(1,50), randn(1,50))
set(gca, 'XAxisLocation','origin', 'YAxisLocation','origin')
xl = xlim;
yl = ylim;
text(min(xl), 0, 'Prediction of proposed probabalistic model', 'Rotation',90, 'VerticalAlignment','bottom', 'HorizontalAlignment','center')
text(0, min(yl), 'Experimental data', 'VerticalAlignment','top', 'HorizontalAlignment','center')
It will likely be necessary to change only the string objects (desired axis labels) in this code.
It may be necessary to make a few other adjustments to get the desired appearance.
.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!