Differential dot in legend using Tex interpreter

32 ビュー (過去 30 日間)
Andrea Costantino
Andrea Costantino 2021 年 3 月 17 日
編集済み: Adam Danz 2021 年 4 月 17 日
Hi!
I would like to put a derivative dot on a letter in my legend.
I did it in a previous code using LaTeX interpeter but now I would like to use Tex interpreter since all the graphs of the work should have the same style.
Do you know I could do it?
Thank you!

採用された回答

Adam Danz
Adam Danz 2021 年 3 月 17 日
編集済み: Adam Danz 2021 年 4 月 17 日
To use an overdot as a legend string with TeX interpreter, use a unicode diacritic character (see resources below).
For example, I copied the unicode characters and from the links below and attained its numeric representation in Matlab using,
double('V̇') % Copy-pasted character
ans = 1×2
86 775
double('Ṫ') % Copy-pasted character
ans = 7786
Rather than storing those characters in your code, just use the numeric equivilants.
Convert back to char and assign the value to the DisplayName properties of the graphics objects that should appear in the legend. The 2nd line shows how to combine the overdot character with other characters.
hold on
h(1) = plot(0:.1:1, rand(1,11), 'DisplayName', char([86 775]));
h(2) = plot(0:.1:1, rand(1,11), 'DisplayName', ['(' char(7786) 'G)/X']);
lh = legend(h, 'FontSize', 14);
lh.Interpreter
ans = 'tex'
Resources: Overdot characters
  1 件のコメント
Andrea Costantino
Andrea Costantino 2021 年 3 月 18 日
Thank you! It is a very interesting (and quick) solution. I will implement it in my code.
Thank you very much

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

その他の回答 (1 件)

Cris LaPierre
Cris LaPierre 2021 年 3 月 17 日
編集済み: Cris LaPierre 2021 年 3 月 17 日
I do not believe \dot is supported by the tex interpreter. You can find a list of the supported Greek letters and special characters here.
  3 件のコメント
Andrea Costantino
Andrea Costantino 2021 年 3 月 17 日
It is not feasible to modify all the previous plots...I fixed it adding a text with a single dot just above the character. Not so elegant, but it works!
Adam Danz
Adam Danz 2021 年 3 月 17 日
> I fixed it adding a text with a single dot just above the character
Isn't that exactly what you wanted to do?

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by