打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
New line in axis tick labels in Matlab

I am not sure how long it has been around, but at least in R2015b the axes objects have a 'TickLabelInterpreter' property, which can be specified to set how the tick labels are interpreted. If you choose a LaTeX interpreter, it is possible to have multiline ticklabels quite easily by wrapping them in a tabular environment.

Example:

figure;plot(rand(10,1));%// Tick label with arbitrary number of lines in tabular environmentxtl = '\begin{tabular}{c} line 1 \\ line 2 \\ line 3\\ line 4\end{tabular}';%// use the tick label at location 5 on the x axisset(gca,'xtick', 5, 'XTickLabel', xtl, 'TickLabelInterpreter', 'latex');

Output:

Of course, the drawback here is that you need to use the LaTeX interpreter which somewhat changes the appearance of the figure. But I believe some people (such as me) actually prefer the way the LaTeX interpreted figure annotations look! As an added bonus, you can use whatever other LaTeX markup you desire (equations, etc.) in the labels.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
LaTeX新人教程,30分钟从完全陌生到基本入门
在Matlab中,如何实现xticklabel的旋转?转
Qt Plotting Widget QCustomPlot
python
latex 让表格中的单元格换行
Python图表绘制:matplotlib绘图库入门
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服