help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plotting Multiple Disconnected Lines in one call of line function


From: Ben Abbott
Subject: Re: Plotting Multiple Disconnected Lines in one call of line function
Date: Sat, 31 Dec 2011 11:29:11 -0500

On Dec 31, 2011, at 8:16 AM, onur güngör wrote:

> Hi,
> 
> I'm trying to run code
> 
> line([34 34 40 40], [0 35 0 35], 'color', 'y')
> 
> to produce two vertical lines on 34 and 40 in x-axis. I suspect this is
> working in Matlab because this code is borrowed from a colleague who
> uses Matlab. Sorry, I don't have Matlab to check it.
> 
> Actually, the function does what it is supposed to do, it connects each
> pair. But how can I make it connects only in triples?
> 
> line([34 34], [0 35], 'color', 'y') also works as expected.
> 
> Thanks,
> Onur

The command you gave is working correctly. To get more than one line you should 
place the data in separate columns (implies different lines), or explicitly 
plot them as different lines.

The implicit approach is ...

        plot ([34 40; 34 40], [0 0; 35 35], "y")

The explicit version is ...

        plot ([34 34], [0 35], "y", [40 40], [0 35], "y")

Ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]