Thread Subject: Plotting an infinite line.

Subject: Plotting an infinite line.

From: MRR

Date: 9 Jan, 2009 12:34:02

Message: 1 of 6

Hi everybody,

How can i plot an infinite line? I am using an axes object, and sometimes i use the pan and zoom functions. I need to have plotted a line (y = k*x) everytime is change the axes limits. So, i think i have to plot an "infinite line", or use a callback for the pan function that replot this line when the axes limits change.

Any idea?

Regards

Subject: Plotting an infinite line.

From: fburton@nyx.net (Francis Burton)

Date: 9 Jan, 2009 14:15:31

Message: 2 of 6

In article <gk7g7q$gkb$1@fred.mathworks.com>,
MRR <mario_ruz@hotmail.com> wrote:
>How can i plot an infinite line? I am using an axes object, and
>sometimes i use the pan and zoom functions. I need to have plotted a
>line (y = k*x) everytime is change the axes limits. So, i think i have
>to plot an "infinite line", or use a callback for the pan function that
>replot this line when the axes limits change.

Would a very, very long line work instead? (Long enough that
panning would not reach either end in normal circumstance.)

Francis

Subject: Plotting an infinite line.

From: Husam Aldahiyat

Date: 9 Jan, 2009 15:28:01

Message: 3 of 6

Use the line function.

help line

Subject: Plotting an infinite line.

From: Walter Roberson

Date: 9 Jan, 2009 17:28:46

Message: 4 of 6

MRR wrote:

> How can i plot an infinite line? I am using an axes object, and sometimes i use
> the pan and zoom functions. I need to have plotted a line (y = k*x) everytime
> is change the axes limits. So, i think i have to plot an "infinite line", or use a
> callback for the pan function that replot this line when the axes limits change.

Yes, exactly, use a callback. Use the ActionPostCallback properties that
pan() and zoom() provide, and modify the X and Y properties of the line() object
according to the current axis limits.

--
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Subject: Plotting an infinite line.

From: MRR

Date: 9 Jan, 2009 17:31:03

Message: 5 of 6

fburton@nyx.net (Francis Burton) wrote in message <1231510530.931628@irys.nyx.net>...
> In article <gk7g7q$gkb$1@fred.mathworks.com>,
> MRR <mario_ruz@hotmail.com> wrote:
> >How can i plot an infinite line? I am using an axes object, and
> >sometimes i use the pan and zoom functions. I need to have plotted a
> >line (y = k*x) everytime is change the axes limits. So, i think i have
> >to plot an "infinite line", or use a callback for the pan function that
> >replot this line when the axes limits change.
>
> Would a very, very long line work instead? (Long enough that
> panning would not reach either end in normal circumstance.)
>
> Francis

Hi Francis,

I am using that solution, but it?s not what i want because in this cause the x and y vectors are too long, and we are using unnecesary memory. I think i have to figure out how to plot only what is dislplayed, after using the pan tool. So i?ll have to create a callback.

Thanks??

Subject: Plotting an infinite line.

From: Jos

Date: 9 Jan, 2009 19:33:02

Message: 6 of 6

"MRR" <mario_ruz@hotmail.com> wrote in message <gk81kn$5h1$1@fred.mathworks.com>...
> fburton@nyx.net (Francis Burton) wrote in message <1231510530.931628@irys.nyx.net>...
> > In article <gk7g7q$gkb$1@fred.mathworks.com>,
> > MRR <mario_ruz@hotmail.com> wrote:
> > >How can i plot an infinite line? I am using an axes object, and
> > >sometimes i use the pan and zoom functions. I need to have plotted a
> > >line (y = k*x) everytime is change the axes limits. So, i think i have
> > >to plot an "infinite line", or use a callback for the pan function that
> > >replot this line when the axes limits change.
> >
> > Would a very, very long line work instead? (Long enough that
> > panning would not reach either end in normal circumstance.)
> >
> > Francis
>
> Hi Francis,
>
> I am using that solution, but it?s not what i want because in this cause the x and y vectors are too long, and we are using unnecesary memory. I think i have to figure out how to plot only what is dislplayed, after using the pan tool. So i?ll have to create a callback.
>
> Thanks??

Too long?? A line takes only two points. And the solution suggested by Francis is therefore an excellent one. As an example:

x = [-1000 1000] ; % maximum limits
y = 3 * x ;

plot(10*randn(10),10 * randn(10),'ro') ;
line(x,y,'color','b')
set(gca,'xlim',[-10 500],'ylim',[-200 30]) ; % whatever

hth
Jos

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

Contact us at files@mathworks.com