Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Adding New Axes Object to a Figure

Subject: Adding New Axes Object to a Figure

From: jk Wang

Date: 28 Jan, 2008 03:07:01

Message: 1 of 6

Hi,guys,

I want to write a program that can adding new axes, but
without changing the other axes existing on the figure. All
of these axes display different images.

So how can I keep the former axes (and their images)
unchanged while adding a new one? Help me please~

Thank you!!!

JK Wang

Subject: Re: Adding New Axes Object to a Figure

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 28 Jan, 2008 04:44:36

Message: 2 of 6

In article <fnjgsl$g4q$1@fred.mathworks.com>,
jk Wang <wjk1984@gmail.com> wrote:

>I want to write a program that can adding new axes, but
>without changing the other axes existing on the figure. All
>of these axes display different images.

>So how can I keep the former axes (and their images)
>unchanged while adding a new one? Help me please~

Just do it. The axes() function does not clear the figure.
--
  "There are some ideas so wrong that only a very intelligent person
  could believe in them." -- George Orwell

Subject: Re: Adding New Axes Object to a Figure

From: jk Wang

Date: 28 Jan, 2008 16:03:02

Message: 3 of 6

Hi, George

I thought axes() won't change previous axes objects, but
when I tried the following codes, the image displayed were
cleared by an new axes.

Here's my code,
 
figure;
h1 = gcf;
axes(h1)
imshow(imread('lego08.gif')) %display an image
figure(h1);axes %create another axes.

By the way, if there's no way to add axes without affecting
previous axes objects. Is it possible to display multiple
images on the same axes without overlapping?

Thanks!

JK Wang


roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <fnjmjk$34v$1@canopus.cc.umanitoba.ca>...
> In article <fnjgsl$g4q$1@fred.mathworks.com>,
> jk Wang <wjk1984@gmail.com> wrote:
>
> >I want to write a program that can adding new axes, but
> >without changing the other axes existing on the figure. All
> >of these axes display different images.
>
> >So how can I keep the former axes (and their images)
> >unchanged while adding a new one? Help me please~
>
> Just do it. The axes() function does not clear the figure.
> --
> "There are some ideas so wrong that only a very
intelligent person
> could believe in them." --
George Orwell

Subject: Re: Adding New Axes Object to a Figure

From: Vihang Patil

Date: 28 Jan, 2008 16:15:03

Message: 4 of 6



<I want to write a program that can adding new axes, but
without changing the other axes existing on the figure. >

You probably would need subplot
doc subplot
HTH
Vihang

Subject: Re: Adding New Axes Object to a Figure

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 28 Jan, 2008 17:00:29

Message: 5 of 6

In article <fnkubm$l0k$1@fred.mathworks.com>,
jk Wang <wjk1984@gmail.com> top-posted:

Please do not post your reply above the text you are replying to:
it makes it difficult to hold a conversation.

>roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
>message <fnjmjk$34v$1@canopus.cc.umanitoba.ca>...
>> In article <fnjgsl$g4q$1@fred.mathworks.com>,
>> jk Wang <wjk1984@gmail.com> wrote:

>> >I want to write a program that can adding new axes, but
>> >without changing the other axes existing on the figure. All
>> >of these axes display different images.

>> >So how can I keep the former axes (and their images)
>> >unchanged while adding a new one? Help me please~

>> Just do it. The axes() function does not clear the figure.

>I thought axes() won't change previous axes objects, but
>when I tried the following codes, the image displayed were
>cleared by an new axes.

>Here's my code,

>figure;
>h1 = gcf;
>axes(h1)

That should be axes('Parent',h1);

>imshow(imread('lego08.gif')) %display an image
>figure(h1);axes %create another axes.

That does not clear the existing axes or image. Instead, it is
putting the new axis right on top of the old one, as you did not
specify a position or size for the new axis. If you look closely,
you will probably notice that the x and y axis labels are doubled,
two sets of labels in the same area.
--
  "I will speculate that [...] applications [...] could actually see a
  performance boost for most users by going dual-core [...] because it
  is running the adware and spyware that [...] are otherwise slowing
  down the single CPU that user has today" -- Herb Sutter

Subject: Re: Adding New Axes Object to a Figure

From: jk Wang

Date: 29 Jan, 2008 16:32:05

Message: 6 of 6

Got it! Thank you~

JK Wang

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <fnl1nd$oc4$1@canopus.cc.umanitoba.ca>...
> In article <fnkubm$l0k$1@fred.mathworks.com>,
> jk Wang <wjk1984@gmail.com> top-posted:
>
> Please do not post your reply above the text you are
replying to:
> it makes it difficult to hold a conversation.
>
> >roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
> >message <fnjmjk$34v$1@canopus.cc.umanitoba.ca>...
> >> In article <fnjgsl$g4q$1@fred.mathworks.com>,
> >> jk Wang <wjk1984@gmail.com> wrote:
>
> >> >I want to write a program that can adding new axes, but
> >> >without changing the other axes existing on the
figure. All
> >> >of these axes display different images.
>
> >> >So how can I keep the former axes (and their images)
> >> >unchanged while adding a new one? Help me please~
>
> >> Just do it. The axes() function does not clear the figure.
>
> >I thought axes() won't change previous axes objects, but
> >when I tried the following codes, the image displayed were
> >cleared by an new axes.
>
> >Here's my code,
>
> >figure;
> >h1 = gcf;
> >axes(h1)
>
> That should be axes('Parent',h1);
>
> >imshow(imread('lego08.gif')) %display an image
> >figure(h1);axes %create another axes.
>
> That does not clear the existing axes or image. Instead, it is
> putting the new axis right on top of the old one, as you
did not
> specify a position or size for the new axis. If you look
closely,
> you will probably notice that the x and y axis labels are
doubled,
> two sets of labels in the same area.
> --
> "I will speculate that [...] applications [...] could
actually see a
> performance boost for most users by going dual-core
[...] because it
> is running the adware and spyware that [...] are
otherwise slowing
> down the single CPU that user has today" --
Herb Sutter

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics