Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news1.google.com!npeer02.iad.highwinds-media.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe01.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Organization: Canada Eat The Cookie Foundation
User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: Add to a subplot
References: <710ce99f-25f3-4072-917a-969f8fcbad76@k13g2000hse.googlegroups.com>
In-Reply-To: <710ce99f-25f3-4072-917a-969f8fcbad76@k13g2000hse.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 38
Message-ID: <ujBAk.14864$Dj1.9847@newsfe01.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe01.iad 1221779802 24.79.146.116 (Thu, 18 Sep 2008 23:16:42 UTC)
NNTP-Posting-Date: Thu, 18 Sep 2008 23:16:42 UTC
Date: Thu, 18 Sep 2008 18:16:55 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:490859


Aaron Fude wrote:
 
> The subplot help states that invoking subplot(m, n, p) deletes the
> contents and I have found myself unable to add to a subplot without
> deleting the contents. How does one do it?

>> help subplot

    If a SUBPLOT specification causes a new axis to overlap an
    existing axis, the existing axis is deleted - unless the position
    of the new and existing axis are identical.  For example,
    the statement SUBPLOT(1,2,1) deletes all existing axes overlapping
    the left side of the Figure window and creates a new axis on that
    side - unless there is an axes there with a position that exactly
    matches the position of the new axes (and 'replace' was not specified),
    in which case all other overlapping axes will be deleted and the 
    matching axes will become the current axes.

>  (E.g. on a figure that was
> obtained with the help of an open() command.)

>> help subplot

    SUBPLOT('position',[left bottom width height]) creates an
    axis at the specified position in normalized coordinates (in 
    in the range from 0.0 to 1.0).

So if you have an existing axis that you want to match the position of,
you can get() and record the Units of that existing axes, set() the Units to
'normalized', get() and record the Position of the existing axes,
set() the Units of the existing axes back to the recorded Units. The
recorded position could then be passed to subplot(). On the other hand,
doing that would just amount to doing the same thing as using axes() to
make the existing axes the "current" axes.

So... why not just findobj(TheFigureHandle, 'Type', 'axes') or something
similar to find the -existing- axes, and make that existing axes the
current axes ??