7
4

1 に答える 1

8

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:

xlabel('\infty');  %# Label the x axis with an infinity

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:

hBar = colorbar;                           %# Create the colorbar
labels = cellstr(get(hBar,'YTickLabel'));  %# Get the current y-axis tick labels
labels{end} = char(165);                   %# Change the last tick label
set(hBar,'FontName','Symbol',...           %# Change the colorbar axes font
         'YTickLabel',labels);             %#   and update the tick labels

And here's what the colorbar will look like:

enter image description here

于 2011-06-24T05:45:47.243 に答える