help-octave
[Top][All Lists]
Advanced

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

Re: Drawing shapes / non-function plots in Octave?


From: Quentin Spencer
Subject: Re: Drawing shapes / non-function plots in Octave?
Date: Tue, 08 Jun 2004 08:48:11 -0500
User-agent: Mozilla Thunderbird 0.6 (X11/20040519)

edA-qa mort-ora-y wrote:

Is it possible to draw shapes using the plot functions in octave? In particular I want to visualize the vector work that I am doing, but it doesn't conform to a simple x=y mapping.

I am aware that I can do this:
    hold on;
    gplot( [ P1; P2 ] );
    gplot( [ P3; P4 ] );
to draw lines between arbitrary points. But this starts going extremely slow after about 50 lines or so.

Is there a better way to do this?

I added an example at http://wiki.octave.org/wiki.pl?SimpleExamples of on of my problems I want to visualize -- using the above notation.

I looked at your example on the wiki, but it didn't work for me because of a undefined function call to "unit", which I suspect is your own code that you forgot to include. If you want to plot lines between multiple arbitrary points with one plot command, it's easier to just do
plot([x1a,x2a; x1b,x2b; x1c,x2c; ...],[y1a,y2a; y1b,y2b; y1c,y2c; ...])

This draws lines from (x1a,y1a) to (x2a,y2a) etc. They will all be the same color if you include a line style argument. A quick demonstration involving a lot of lines is:
plot(rand(2,100),rand(2,100),'1');

I'm not sure what you mean by drawing shapes. I don't know how do to filled shapes, but if outlines are adequate, it seems like this method should be straightforward.

Quentin



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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