plots? [message #31799] |
Mon, 19 August 2002 15:33  |
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 #52823 is a reply to message #31799] |
Fri, 02 March 2007 07:57   |
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   |
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  |
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.")
|
|
|