change the hyphen (-) into minus sign (−, “U+2212”)

665 views (last 30 days)
Hi,
How can I change the hyphen (-) into minus sign (−, “U+2212”) in Matlab plot!
the figure above generated from matlab which has the defalt minus sign. how can I change -20 -40 and -60 to −20 −40 and −60
  2 Comments
SALEH ALHUMAID
SALEH ALHUMAID on 17 Jun 2022
Edited: SALEH ALHUMAID on 17 Jun 2022
I am not following you. I am using Latex to write my article, and I am attaching the matlab figures as eps to Latex. The publisher asked me to change the minus sign in the matlab figure from - to −. I don't know if I should do it through matlab or through latex!

Sign in to comment.

Accepted Answer

Chunru
Chunru on 17 Jun 2022
set(groot,'defaultAxesTickLabelInterpreter','latex');
plot(randi([-60 60], [20, 1]))
xticks(-60:20:60)
yticklabels(strrep(yticklabels,'-','$-$'));

More Answers (2)

Walter Roberson
Walter Roberson on 17 Jun 2022
plot(randi([-60 60], [20, 1]))
xticks(-60:20:60)
set(gca, 'TickLabelInterpreter', 'latex', '
ytickformat('$%g$')
  3 Comments
Walter Roberson
Walter Roberson on 23 Aug 2022
[cmat, h] = contour(....);
clabel(cmat, h);
set(h.TextPrims, 'Interpreter', 'latex');
Have a look at that and see if it does what you need. If not, then it might be necessary to modify the h.TextPrims 'String' properties.

Sign in to comment.


Changliang Xiong
Changliang Xiong on 23 Aug 2022
I recommend to save the .fig as *.pdf.Then,adobe illustrator could be used to directly modify the sign.

Categories

Find more on Results, Reporting, and Test File Management in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by