Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
line on figure, not axes

Subject: line on figure, not axes

From: Jeremy

Date: 12 Apr, 2011 18:16:21

Message: 1 of 5

Hi all. I'm wondering if there's any way to draw a line object onto the grey space between two subplots. Thus it would be on a figure, not an axes. I know that line objects cannot have a figure handle as a parent, but was hoping someone knew of a way around this.

Brief explanation: I've got two related plots drawn next to each other: ax(1) and ax(2), on subplot(121) and (122), respectively. I want to draw attention to the fact that the y-axis limits are different on the two plots. I've drawn a horizontal dotted line on ax(2) to indicate where the max of ylim for ax(1) is, but I also wanted to draw a diagonal line connecting the top-right corner of ax(1) to the left side of the line that is drawn on ax(2). Make sense? Any thoughts would be appreciated. Thanks!

Subject: line on figure, not axes

From: dpb

Date: 12 Apr, 2011 21:42:41

Message: 2 of 5

On 4/12/2011 1:16 PM, Jeremy wrote:
> Hi all. I'm wondering if there's any way to draw a line object onto the
> grey space between two subplots. Thus it would be on a figure, not an
> axes. I know that line objects cannot have a figure handle as a parent,
> but was hoping someone knew of a way around this.
>
> Brief explanation: I've got two related plots drawn next to each other:
> ax(1) and ax(2), on subplot(121) and (122), respectively. I want to draw
> attention to the fact that the y-axis limits are different on the two
> plots. I've drawn a horizontal dotted line on ax(2) to indicate where
> the max of ylim for ax(1) is, but I also wanted to draw a diagonal line
> connecting the top-right corner of ax(1) to the left side of the line
> that is drawn on ax(2). Make sense? Any thoughts would be appreciated.
> Thanks!

I'm not sure I quite follow, but my thought (never let not knowing the
full question slow down an answer :) ) would be that you place and hide
another axis that covers the area you wish to draw over.

--

Subject: line on figure, not axes

From: Jeremy

Date: 12 Apr, 2011 21:55:06

Message: 3 of 5

Thanks for the reply. I had that thought, but assumed that making an axis invisible would also make it's children invisible. Maybe that was a bad assumption...I'll look into it. Thanks!

Subject: line on figure, not axes

From: dpb

Date: 12 Apr, 2011 22:05:47

Message: 4 of 5

On 4/12/2011 4:55 PM, Jeremy wrote:
> Thanks for the reply. I had that thought, but assumed that making an
> axis invisible would also make it's children invisible. Maybe that was a
> bad assumption...I'll look into it. Thanks!

Set everything you don't want to show to background color...oh, perhaps
there are multiple colors to cross? That's somewhat harder...

I'm not positive of the answer to the other ... well, lets just try and
see...

It's ok, an axis handle set to 'visible'-->'off' leaves a line child
object visible.

--

Subject: line on figure, not axes

From: Jeremy

Date: 12 Apr, 2011 23:50:19

Message: 5 of 5

I got it working exactly as planned...thanks for pointing me in the right direction!

Tags for this Thread

No tags are associated with this thread.

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.

Contact us