如何在颜色条刻度中添加数学符号
我可以获得 colorbar
刻度,
figure;
hbar=colorbar;
ticks=get(hbar,'ytick');
现在如何将 tick(end)
处的刻度标签设置为 ∞
?
I can get the colorbar
ticks as
figure;
hbar=colorbar;
ticks=get(hbar,'ytick');
Now how do I set the tick labels at tick(end)
to be ∞
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很棘手。通常,对于轴标签和标题,您可以使用 TeX 或 LaTeX 格式,因为它们是 文本对象 因此有一个
'Interpreter'
属性:但是,axes 对象本身不会出现有办法对其 tick 标签使用 Tex 或 LaTeX 格式。一种解决方案是从 格式刻度标签下载提交内容/www.mathworks.com/matlabcentral/fileexchange/authors/29071" rel="noreferrer">Alexander Hayes 上的 MathWorks 文件交换e,它将用格式化的文本对象替换轴刻度标签。
另一个解决方案是更改
'FontName'
属性轴的 为'Symbol'
字体,其中第 165 个字符是无穷大符号。这是一个示例:颜色条如下所示:
This is tricky. Normally, for axes labels and titles you can use TeX or LaTeX formatting since they are text objects and thus have an
'Interpreter'
property:However, axes objects themselves don't appear to have a way to use Tex or LaTeX formatting for their tick labels. One solution is to download the submission Format Tick Labels from Alexander Hayes on the MathWorks File Exchange, which will replace the axes tick labels with formatted text objects.
Another solution is to change the
'FontName'
property of the axes to the'Symbol'
font, the 165th character of which is the infinity symbol. Here's an example:And here's what the colorbar will look like: