Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


dpb
Posts:
8,250
Registered:
6/7/07


Re: Looped inset plot
Posted:
Jan 16, 2013 2:01 PM


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 "openenough" space, etc., etc., etc., ... but it's the basic way to get what I think is the effect you're after.



Date

Subject

Author

1/16/13


dpb

1/16/13


dpb

1/16/13


dpb

1/18/13


dpb

1/18/13


dpb

1/18/13


dpb


