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.
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