<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236202</link>
    <title>MATLAB Central Newsreader - Add to a subplot</title>
    <description>Feed for thread: Add to a subplot</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 18 Sep 2008 22:30:37 -0400</pubDate>
      <title>Add to a subplot</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236202#600940</link>
      <author>Aaron Fude</author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
The subplot help states that invoking subplot(m, n, p) deletes the&lt;br&gt;
contents and I have found myself unable to add to a subplot without&lt;br&gt;
deleting the contents. How does one do it? (E.g. on a figure that was&lt;br&gt;
obtained with the help of an open() command.)&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
Aaron</description>
    </item>
    <item>
      <pubDate>Thu, 18 Sep 2008 23:16:55 -0400</pubDate>
      <title>Re: Add to a subplot</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236202#600948</link>
      <author>Walter Roberson</author>
      <description>Aaron Fude wrote:&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;gt; The subplot help states that invoking subplot(m, n, p) deletes the&lt;br&gt;
&amp;gt; contents and I have found myself unable to add to a subplot without&lt;br&gt;
&amp;gt; deleting the contents. How does one do it?&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; help subplot&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;If a SUBPLOT specification causes a new axis to overlap an&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;existing axis, the existing axis is deleted - unless the position&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;of the new and existing axis are identical.  For example,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;the statement SUBPLOT(1,2,1) deletes all existing axes overlapping&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;the left side of the Figure window and creates a new axis on that&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;side - unless there is an axes there with a position that exactly&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;matches the position of the new axes (and 'replace' was not specified),&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;in which case all other overlapping axes will be deleted and the &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;matching axes will become the current axes.&lt;br&gt;
&lt;br&gt;
&amp;gt;  (E.g. on a figure that was&lt;br&gt;
&amp;gt; obtained with the help of an open() command.)&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; help subplot&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SUBPLOT('position',[left bottom width height]) creates an&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;axis at the specified position in normalized coordinates (in &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;in the range from 0.0 to 1.0).&lt;br&gt;
&lt;br&gt;
So if you have an existing axis that you want to match the position of,&lt;br&gt;
you can get() and record the Units of that existing axes, set() the Units to&lt;br&gt;
'normalized', get() and record the Position of the existing axes,&lt;br&gt;
set() the Units of the existing axes back to the recorded Units. The&lt;br&gt;
recorded position could then be passed to subplot(). On the other hand,&lt;br&gt;
doing that would just amount to doing the same thing as using axes() to&lt;br&gt;
make the existing axes the &quot;current&quot; axes.&lt;br&gt;
&lt;br&gt;
So... why not just findobj(TheFigureHandle, 'Type', 'axes') or something&lt;br&gt;
similar to find the -existing- axes, and make that existing axes the&lt;br&gt;
current axes ??</description>
    </item>
    <item>
      <pubDate>Thu, 18 Sep 2008 23:32:25 -0400</pubDate>
      <title>Re: Add to a subplot</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236202#600951</link>
      <author>Aaron Fude</author>
      <description>On Sep 18, 7:16=A0pm, Walter Roberson &amp;lt;rober...@hushmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Aaron Fude wrote:&lt;br&gt;
&amp;gt; &amp;gt; The subplot help states that invoking subplot(m, n, p) deletes the&lt;br&gt;
&amp;gt; &amp;gt; contents and I have found myself unable to add to a subplot without&lt;br&gt;
&amp;gt; &amp;gt; deleting the contents. How does one do it?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; help subplot&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; =A0 =A0 If a SUBPLOT specification causes a new axis to overlap an&lt;br&gt;
&amp;gt; =A0 =A0 existing axis, the existing axis is deleted - unless the position&lt;br&gt;
&amp;gt; =A0 =A0 of the new and existing axis are identical. =A0For example,&lt;br&gt;
&amp;gt; =A0 =A0 the statement SUBPLOT(1,2,1) deletes all existing axes overlappin=&lt;br&gt;
g&lt;br&gt;
&amp;gt; =A0 =A0 the left side of the Figure window and creates a new axis on that&lt;br&gt;
&amp;gt; =A0 =A0 side - unless there is an axes there with a position that exactly&lt;br&gt;
&amp;gt; =A0 =A0 matches the position of the new axes (and 'replace' was not speci=&lt;br&gt;
fied),&lt;br&gt;
&amp;gt; =A0 =A0 in which case all other overlapping axes will be deleted and the&lt;br&gt;
&amp;gt; =A0 =A0 matching axes will become the current axes.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; =A0(E.g. on a figure that was&lt;br&gt;
&amp;gt; &amp;gt; obtained with the help of an open() command.)&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; help subplot&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; =A0 =A0 SUBPLOT('position',[left bottom width height]) creates an&lt;br&gt;
&amp;gt; =A0 =A0 axis at the specified position in normalized coordinates (in&lt;br&gt;
&amp;gt; =A0 =A0 in the range from 0.0 to 1.0).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; So if you have an existing axis that you want to match the position of,&lt;br&gt;
&amp;gt; you can get() and record the Units of that existing axes, set() the Units=&lt;br&gt;
&amp;nbsp;to&lt;br&gt;
&amp;gt; 'normalized', get() and record the Position of the existing axes,&lt;br&gt;
&amp;gt; set() the Units of the existing axes back to the recorded Units. The&lt;br&gt;
&amp;gt; recorded position could then be passed to subplot(). On the other hand,&lt;br&gt;
&amp;gt; doing that would just amount to doing the same thing as using axes() to&lt;br&gt;
&amp;gt; make the existing axes the &quot;current&quot; axes.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; So... why not just findobj(TheFigureHandle, 'Type', 'axes') or something&lt;br&gt;
&amp;gt; similar to find the -existing- axes, and make that existing axes the&lt;br&gt;
&amp;gt; current axes ??&lt;br&gt;
&lt;br&gt;
How do you get the existing axis from a particular subplot? Not sure&lt;br&gt;
what to call get() on. And then how do you make the obtained axes the&lt;br&gt;
current axes? I know how to get them but not how to set them.</description>
    </item>
    <item>
      <pubDate>Thu, 18 Sep 2008 23:52:26 -0400</pubDate>
      <title>Re: Add to a subplot</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236202#600954</link>
      <author>Scott Seidman</author>
      <description>Aaron Fude &amp;lt;aaronfude@gmail.com&amp;gt; wrote in news:bf4db45e-1a07-4cfd-a7a2-&lt;br&gt;
761bb080180f@d45g2000hsc.googlegroups.com:&lt;br&gt;
&lt;br&gt;
&amp;gt; How do you get the existing axis from a particular subplot? Not sure&lt;br&gt;
&amp;gt; what to call get() on. And then how do you make the obtained axes the&lt;br&gt;
&amp;gt; current axes? I know how to get them but not how to set them.&lt;br&gt;
&lt;br&gt;
You keep track of things before its too late!!&lt;br&gt;
&lt;br&gt;
h = subplot(...)&lt;br&gt;
&lt;br&gt;
returns the handle of the axes of the subplot when its created.  Handle &lt;br&gt;
graphics, in general, is just a matter of bookkeeping.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Other than that, you'd need to use Findobj on the figure to pull out all &lt;br&gt;
the axes, and then figure out somehow (by position maybe??) what handle &lt;br&gt;
matches what axes.&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Scott&lt;br&gt;
Reverse name to reply</description>
    </item>
    <item>
      <pubDate>Fri, 19 Sep 2008 05:16:41 -0400</pubDate>
      <title>Re: Add to a subplot</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/236202#600977</link>
      <author>ControlTheoryPro@gmail.com</author>
      <description>If you are opening a figure that already exists and you need to add&lt;br&gt;
another subplot then I think you will need to actually create another&lt;br&gt;
figure.  In the new figure you will want to copy the data from the old&lt;br&gt;
figure to a new subplot on the figure.&lt;br&gt;
&lt;br&gt;
When you open up the old figure then you can use gca to get the handle&lt;br&gt;
to the 1 axis on the figure (assuming there is only 1).  If there are&lt;br&gt;
more than one you will need to use a = get(gcf, 'children').  The&lt;br&gt;
variable a will get all the children of the figure and some of those&lt;br&gt;
children will be of &quot;Type&quot; axes.  Once you get the handle to desired&lt;br&gt;
axis you can use get(h, 'children') where h is the handle to that&lt;br&gt;
desired axis.&lt;br&gt;
&lt;br&gt;
The plotted data will be children of the desired axis and most likely&lt;br&gt;
of the type &quot;line&quot;.  The XData, YData, and ZData properties of the&lt;br&gt;
line object will have the data necessary for replotting on the new&lt;br&gt;
figure and new subplot.  Then you can add data the subplots you are&lt;br&gt;
adding.&lt;br&gt;
&lt;br&gt;
Gabe&lt;br&gt;
The MATLAB category of my Control Systems wiki:&lt;br&gt;
&lt;a href=&quot;http://wikis.controltheorypro.com/index.php?title=Category:MATLAB&quot;&gt;http://wikis.controltheorypro.com/index.php?title=Category:MATLAB&lt;/a&gt;</description>
    </item>
  </channel>
</rss>

