How to put en dashes instead of hyphens for a negative values on the x,y-axis and colorbar numbers?
32 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
iurii nikonenko
am 25 Nov. 2019
Kommentiert: engdancili
am 20 Jul. 2022
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/250068/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/250069/image.png)
3 Kommentare
Walter Roberson
am 25 Nov. 2019
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.
Akzeptierte Antwort
Walter Roberson
am 25 Nov. 2019
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 Kommentare
Abdulaziz Abutunis
am 22 Jun. 2022
Bearbeitet: Abdulaziz Abutunis
am 22 Jun. 2022
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!