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

 Akzeptierte Antwort

Jan
Jan am 10 Jan. 2013
Bearbeitet: Jan am 10 Jan. 2013

0 Stimmen

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 Kommentare

Sam Alex
Sam Alex am 10 Jan. 2013
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 am 10 Jan. 2013
Bearbeitet: Jan am 10 Jan. 2013
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 am 10 Jan. 2013
Ok so how do you control the position of your new boxplot? How do I determine the coordinates?
Thanks
Jan
Jan am 10 Jan. 2013
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 am 10 Jan. 2013
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 am 10 Jan. 2013
Thank you Jan

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Gefragt:

am 10 Jan. 2013

Community Treasure Hunt

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

Start Hunting!

Translated by