フィルターのクリア

How to put en dashes instead of hyphens for a negative values on the x,y-axis and colorbar numbers?

26 ビュー (過去 30 日間)
Left picture has correct view: en dashes are used on the y-axis negative numbers.
Right picture is what I usually have: hyphens are used on the y-axis negative numbers.
I need to change this in a purpose for the publication, it`s an important note. I checked already everything and didn`t find any info besides the latex interpreter for the text function.
  3 件のコメント
iurii nikonenko
iurii nikonenko 2019 年 11 月 25 日
Tnank you really for noting this detail! So, this problem can be solved only by manual changing of the axis ticks? Is there any "auto" solution like font changing?
Walter Roberson
Walter Roberson 2019 年 11 月 25 日
I am sure that font changing would not be enough, as even if you used a different font, it would be necessary to be able to distinguish between hyphen and en-dash.

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

採用された回答

Walter Roberson
Walter Roberson 2019 年 11 月 25 日
ax = gca;
yticklabels(ax, strrep(yticklabels(ax),'--','–'));
set(ax,'ticklabelinterpreter','none') %or 'tex' but not 'latex'
The replacement character is the unicode en-dash character, U+2013
Note: the 'none' interpreter and 'tex' interpreter support unicode, but latex interpreter does not.
  6 件のコメント
Abdulaziz Abutunis
Abdulaziz Abutunis 2022 年 6 月 22 日
編集済み: Abdulaziz Abutunis 2022 年 6 月 22 日
Hi Walter,
I have the same problemI want to replace the hyphens with en dashes in a plot. I have the plot ready. I copy the code you provided in my command window but it did not work. Any suggestion.
Thanks
engdancili
engdancili 2022 年 7 月 20 日
For me it is working with the 'tex' interpreterPlot with minus sign instead of hyphen on tick labels

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by