comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » plots?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
plots? [message #31799] Mon, 19 August 2002 15:33 Go to next message
bin_zheng_99 is currently offline  bin_zheng_99
Messages: 6
Registered: July 2002
Junior Member
Hello, All,

I have a problem about using plots. I want to use two plots for two
different data sets at the same time. If I just use one plots for one
data set, there is no problem. But when I use two, it doesn't work. It
seems the two plots interrupt each other. I want to know why?

Thanks very much for any kind of help!

I attach my simple program below:

;*****************
pro testPlots
arrayT = fltarr(11)
arrayX = fltarr(11)
arrayY = fltarr(11)
window, 1
x1 = !X & y1 = !Y & p1 = !P
window,2
x2 = !X & y2 = !Y & p2 = !P
for i=0, 10 Do begin
arrayY[i] = cos(i+1)
arrayX[i] = sin(i+1)
arrayT[i] = i
wset, 1
!X = x1 & !Y = x1 & !P = p1
plots,arrayT[i], arrayX[i], /continue
wset, 2
!X = x2 & !Y = y2 & !P = p2
plots,arrayT[i], arrayY[i], /continue

endfor

end

;****************************
Re: plots [message #52821 is a reply to message #31799] Fri, 02 March 2007 08:13 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>
>> These are integer pixel coordinates which form a closed boundary of an
>> object, so each pixel will have at least two neighbours. I guess my
>> question is how do you trace the boundary of an object if the all you
>> have is an 2D array of noncontiguous pixel coordinates.
>
> I think the answer was, you don't. At least not in
> any unique way. If you DO want a unique path, you
> are going to have to come up with something other than
> this. :-)

One possibility might be to find the convex hull of these
points. This is not the polygon formed by the points, but rather
the polygon that encloses all the points. Maybe that's good
enough for what you have in mind.

If so, here is an article:

http://www.dfanning.com/tips/convex_hull.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: plots [message #52822 is a reply to message #31799] Fri, 02 March 2007 08:05 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
ashraf writes:

> These are integer pixel coordinates which form a closed boundary of an
> object, so each pixel will have at least two neighbours. I guess my
> question is how do you trace the boundary of an object if the all you
> have is an 2D array of noncontiguous pixel coordinates.

I think the answer was, you don't. At least not in
any unique way. If you DO want a unique path, you
are going to have to come up with something other than
this. :-)

You can always look for the point that is closest
to the point you are sitting on, but there is absolutely
no guarantee that this is the *next* point in any meaningful
sense.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: plots [message #52823 is a reply to message #31799] Fri, 02 March 2007 07:57 Go to previous messageGo to next message
ashraf is currently offline  ashraf
Messages: 4
Registered: March 2007
Junior Member
These are integer pixel coordinates which form a closed boundary of an
object, so each pixel will have at least two neighbours. I guess my
question is how do you trace the boundary of an object if the all you
have is an 2D array of noncontiguous pixel coordinates.
Cheers
ashraf.

Paolo Grigis wrote:

> I don't believe there is a unique solution,
> how would you connect these points?
>
> x=[0,1,1,0,0.5]
> y=[0,0,1,1,0.5]
>
>
> Ciao,
> Paolo
>
> ashraf wrote:
>> Hello,
>> I have col and row coordinates of a polygon that I would like to plot
>> on an image using PLOTS function, but the data is noncontiguous, how
>> can I re-arrange the data so that it is contiguous, i.e. starting from
>> an arbitrary point on the polygon, the next point is the one coonected
>> to the first point say by moving anticlockwise and so on. Otherwise is
>> there another function in IDL that can plot noncontiguous data over an
>> image?
>> Thanks.
>>
>> ashraf.
>>
Re: plots [message #52828 is a reply to message #31799] Fri, 02 March 2007 05:18 Go to previous messageGo to next message
Paolo Grigis is currently offline  Paolo Grigis
Messages: 171
Registered: December 2003
Senior Member
I don't believe there is a unique solution,
how would you connect these points?

x=[0,1,1,0,0.5]
y=[0,0,1,1,0.5]


Ciao,
Paolo

ashraf wrote:
> Hello,
> I have col and row coordinates of a polygon that I would like to plot
> on an image using PLOTS function, but the data is noncontiguous, how
> can I re-arrange the data so that it is contiguous, i.e. starting from
> an arbitrary point on the polygon, the next point is the one coonected
> to the first point say by moving anticlockwise and so on. Otherwise is
> there another function in IDL that can plot noncontiguous data over an
> image?
> Thanks.
>
> ashraf.
>
Re: plots [message #52918 is a reply to message #52821] Tue, 06 March 2007 07:59 Go to previous message
ashraf is currently offline  ashraf
Messages: 4
Registered: March 2007
Junior Member
again I must strees that these are noncontiguous but discreet
coordinates which form a closed polygon, for example let
x = [0,1,1,0,0,2,2,2]
y = [0,1,2,2,1,0,1,2]
These points can be uniquely re-arranged as
x = [0,1,2,2,2,1,0,0]
y = [0,1,0,1,2,2,2,1]
to form a closed non-intersecting outline. My question is how can I re-
arrange these points effeciently?
Thanks.

David Fanning wrote:

> David Fanning writes:
>
>>
>>> These are integer pixel coordinates which form a closed boundary of an
>>> object, so each pixel will have at least two neighbours. I guess my
>>> question is how do you trace the boundary of an object if the all you
>>> have is an 2D array of noncontiguous pixel coordinates.
>>
>> I think the answer was, you don't. At least not in
>> any unique way. If you DO want a unique path, you
>> are going to have to come up with something other than
>> this. :-)
>
> One possibility might be to find the convex hull of these
> points. This is not the polygon formed by the points, but rather
> the polygon that encloses all the points. Maybe that's good
> enough for what you have in mind.
>
> If so, here is an article:
>
> http://www.dfanning.com/tips/convex_hull.html
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: make and read a subset of a tiff image
Next Topic: plots

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:18:00 PDT 2025

Total time taken to generate the page: 0.00637 seconds