採用された回答

Walter Roberson
Walter Roberson 2017 年 11 月 10 日

1 投票

If it is acceptable to change the line color as well as the numbers, then change the axes numeric ruler Color property: https://www.mathworks.com/help/matlab/ref/matlab.graphics.axis.decorator.numericruler-properties.html#property_d119e713466
Otherwise, you will need to set the axes *TickLabel property to a cell array of character vectors in which each label uses tex or latex color specifications to color that one label. See https://www.mathworks.com/matlabcentral/answers/278997-matlab-label-with-different-colors-on-the-string-using-latex-interpreter

4 件のコメント

Erwin Avendaño
Erwin Avendaño 2017 年 11 月 10 日
THX
Walter Roberson
Walter Roberson 2017 年 11 月 11 日
You created a duplicate Question on this topic showing a diagram with the tick numbering circled. The solution to that is my second paragraph, above:
"Otherwise, you will need to set the axes *TickLabel property to a cell array of character vectors in which each label uses tex or latex color specifications to color that one label. See https://www.mathworks.com/matlabcentral/answers/278997-matlab-label-with-different-colors-on-the-string-using-latex-interpreter"
For example,
ax = gca;
set(ax, 'xticklabel', sprintfc('\\color{red}%g', get(ax,'xtick')))
set(ax, 'yticklabel', sprintfc('\\color{red}%g', get(ax,'Ytick')))
Erwin Avendaño
Erwin Avendaño 2017 年 11 月 11 日
sorry is that I thought it would serve what they answered me so I accepted the answer but it did not work so I put the question again but more specific thx
Walter Roberson
Walter Roberson 2017 年 11 月 11 日
The technique did work: I proved that with the above example. It is possible that your implementation did not work, in which case you should have posted your implementation and asked questions.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Graphics Object Properties についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by