2 nested boxplots inside each other

Hello everyone,
Does anyone how I can produce 2 nested boxplots inside each other like the attached image? The purpose is to illustrate one of the boxes via a new scaled one with say a log scaled data

 採用された回答

Jan
Jan 2013 年 1 月 10 日
編集済み: Jan 2013 年 1 月 10 日

0 投票

You can simply create to axes, when you specify the position explicitly:
Axes1H = axes;
plot(1:10, rand(1, 10));
Axes2H = axes('Units', 'normalized', 'Position', [0.6, 0.6, 0.2, 0.2]);
plot(1:10, rand(1, 10));
Is it part of the question how to create a boxplot also?

7 件のコメント

Sam Alex
Sam Alex 2013 年 1 月 10 日
Does this help me to determine above what box in my boxplot I will have this extra log-scaled boxplot?
Moreover, in the plot there is no x-tick
Jan
Jan 2013 年 1 月 10 日
編集済み: Jan 2013 年 1 月 10 日
It is your job to decide, if this helps you the needed information, so I cannot answer this question.
If you miss some XTicks, add them. If you mean that my code creates too many XTicks, remove them.
Sam Alex
Sam Alex 2013 年 1 月 10 日
Ok so how do you control the position of your new boxplot? How do I determine the coordinates?
Thanks
Jan
Jan 2013 年 1 月 10 日
I'm not sure if I can follow you. Of course you determine the position by the parameter of the 'Position' property. So [0.6, 0.6, 0.2, 0.2] in my example starts the 2nd axes at the position 0.6, 0.6 in normalized units, which means 0.6 of the width and 0.6 of the height of the figure. Then the two 0.2 means, that the 2nd axes has a height of 0.2 of the height of the figure, and the same for the width.
Please try to ask more precise, when you want to know something else. Reading doc axes is strongly recommended also.
Sam Alex
Sam Alex 2013 年 1 月 10 日
Ok I have tried a lot to remove the xtick for this boxplot with no luck! DOing this did not yield anything as needed:
set(gca, 'YScale','log', 'XTickLabel','');
Jan
Jan 2013 年 1 月 10 日
To remove the XTicks, remove the 'XTick', not the 'XTickLabel'.
Using gca is prone to errors, because the current axes changes, when you click on another axes object. Better use the explicitly obtained axes handle Axes2H as shown in my code example.
Sam Alex
Sam Alex 2013 年 1 月 10 日
Thank you Jan

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

その他の回答 (0 件)

タグ

質問済み:

2013 年 1 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by