Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Looped inset plot
Replies: 9   Last Post: Jan 18, 2013 5:23 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,231
Registered: 6/7/07
Re: Looped inset plot
Posted: Jan 16, 2013 2:01 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 1/16/2013 9:32 AM, Josh wrote:
> dpb <none@non.net> wrote in message <kd6cql$g3s$1@speranza.aioe.org>...
>> On 1/15/2013 10:23 PM, Josh wrote:
>> > I need help trying to use an inset plot in a loop.
>> >
>> > What I have is a scatter plot and a box plot.

>> ...
>>

>> > I would like to inset the box plot into the scatter plot.
>> >
>> > The problem with all the solutions I have found is that on the second
>> > pass through, it puts the scatter plot into the inset area, rather than
>> > as the main plot. When I try to use subplots, the second plot is opaque
>> > the main plot underneath is not visible.

>> ...
>>
>> Sounds like you're not switching back to the other plot to make it the
>> current axis.
>>
>> _Minimal_ example of your loop would help...
>>
>> --

> Thanks for replying,
> Here is the basic code with some modification for simplicity and a
> random data set instead of my actual data.
>
> x = sort(abs(randn(1,100)));
> xi = chi2pdf(x,2);
> for i = 1:length(x)
> y(i) = xi(i)*abs(randn(1));
> end
>
> while true
> subplot(1,2,1)
> boxplot(y)
> subplot(1,2,2)
> plot(x,y,'*')

...

Play around w/ the following at some point when you've got some data...

>> figure
>> h1=axes; % create a main axes object
>> plot(h1,x,y,'*') % plot into it
>> h2=axes('pos',[.55 .25 .30 .50]); % now an inset set of axes
>> boxplot(h2,y) % and the boxplot therein...


Now, each loop thru, pick the proper set of axes.

You'll have to "salt to suit" dimensions and perhaps deal w/ finding an
"open-enough" space, etc., etc., etc., ... but it's the basic way to get
what I think is the effect you're after.

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.