How do I get some part of my boxplot labels italic? I can not change the Interpreter to 'tex' somehow? Why? How can I work around?

3 ビュー (過去 30 日間)
I kind of have the same problem, which was asked here:
I want to have some parts of labels for boxplot italic but it just writes "\it" out. Somehow I cannot change the Interpreter to 'text'.
Also why is there no proper handle for the boxplot function like for any other plot?
This solution does not work! (MATLAB R2017a) The labels are still NOT italic and \it is still written there.
dados = rand(100,2);
boxplot(dados,'labels',{'\bf\it{IDEB}_2_0_0_7','\bf Efficiencies'})
h = findobj(gca, 'type', 'text');
set(h, 'Interpreter', 'tex');

採用された回答

Star Strider
Star Strider 2019 年 4 月 21 日
Use the 'TickLabelInterpreter' property:
dados = rand(100,2);
boxplot(dados,'labels',{'\bf\it{IDEB}__{2007}','\bf Efficiencies'});
set(gca, 'TickLabelInterpreter', 'tex');
That worked when I tested it.
  2 件のコメント
Tom Cook
Tom Cook 2019 年 4 月 23 日
Thanks, it worked.
Still, don't understand why boxplot has no proper figure handle. Annoying.
Star Strider
Star Strider 2019 年 4 月 23 日
As always, my pleasure.
A handle to boxplot just returns the data it plots, and nothing about the statistics or anything else that it calculates. The labels are simply axis tick labels.

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

その他の回答 (1 件)

Tom Cook
Tom Cook 2019 年 4 月 23 日
編集済み: Tom Cook 2019 年 4 月 23 日
Not even that.^^
If I run the code down here.
data_1 = rand(20,);
h_plot = plot(data_1);
h_boxplot = boxplot(data_1);
I get for h_plot a nice handle(may be it's the wrong word?) which I can modify like:
h_boxplot.LineWidth = 2.5
For h_boxplot I get a useless double with numbers counting up...that's it. I don't see the point why the function boxplot doen't behave like any other plotting function.
  1 件のコメント
Star Strider
Star Strider 2019 年 4 月 23 日
The information on the boxplot is actually availble. It’s not obvious, and I had to dig for it.
Example —
dados = rand(100,2);
hb = boxplot(dados,'labels',{'\bf\it{IDEB}_{2007}','\bf Efficiencies'});
set(gca, 'TickLabelInterpreter', 'tex');
hbp = get(gca);
BoxPlotInfo = hbp.Children.Children
producing (in this instance):
BoxPlotInfo =
14×1 Line array:
Line (Outliers)
Line (Outliers)
Line (Median)
Line (Median)
Line (Box)
Line (Box)
Line (Lower Adjacent Value)
Line (Lower Adjacent Value)
Line (Upper Adjacent Value)
Line (Upper Adjacent Value)
Line (Lower Whisker)
Line (Lower Whisker)
Line (Upper Whisker)
Line (Upper Whisker)
Then to get the first box information:
FirstBox = BoxPlotInfo(5)
I didn’t dig deeper than that.
I invite you to explore those properties at your leisure.

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

タグ

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by