Add a bar above a character in axis labels

30 views (last 30 days)
I am using the MATLAB figure editor where you can click on graph elements to edit them, eg. axis label etc. How do you add a bar above a character in axis labels, as in to denote an average quantity for instance?

Accepted Answer

Star Strider
Star Strider on 23 Mar 2024
Try this —
figure
ylabel('$\bar{c}$', 'Interpreter','latex')
.

More Answers (1)

SUBAL BEURA
SUBAL BEURA on 25 Nov 2024
Alternatively, From Figure window, you can open property editor for the whole diagram. Then find "Text" menu for axis. Edit the interpreter from "tex" to "latex". This method will also work if you want to change the interpreter for legends.
  2 Comments
Walter Roberson
Walter Roberson on 25 Nov 2024
You need to edit the String property as well, to insert the \bar{ } in the appropriate place.
Yassir
Yassir on 13 Mar 2025
I have tried the solution and it is working!
Many thanks to all of you.
One comment: I had to put the latex script within $ $ (example: $\bar{w}_c^{a,i}$).

Sign in to comment.

Categories

Find more on Labels and Annotations in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!