Re: simple plot

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri, 24 Feb 2006 10:57:58 -0700

Hi Roni,

Take a look at:
http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_xy.shtml

You can input 2 lines into gsn_xy by inputting the x and y arrays with
dimensions (2,ntim). For instance:

a = asciiread("file.asc",(/40,2/),"float")
x = new((/2,21/),"float") ; add cyclic pt
y = x
x(0,:19) = a(:19,0)
x(1,:19) = a(20:,0)
y(0,:19) = a(:19,1)
y(1,:19) = a(20:,0)

x(0,20) = x(0,0) ; add cyclic pt.
x(1,20) = x(1,0)
y(0,20) = y(0,0)
y(1,20) = y(1,0)

Notice I created new arrays x,y with sizes(2,21), so as to add a cyclic
point so that the circle completes itself.

To fill your circle, take a look at:
http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_add_polygon.shtml

You should be able to pass in the same x,y arrays described above into
gsn_add_polygon, but don't forget to not advance the frame in the gsn_xy
plot call (res_at_gsnFrame = False)... After you call gsn_add_polygon, call
frame: frame(wks)
Good luck!
Adam

rravia_at_po-box.mcgill.ca wrote:
> Hi,
> I have an ascii file with two columns (say x and y).
> There are, say, 20 rows, then an empty row, and then another 20 rows.
>
> The first 20 rows represent points of circle 1 and the next 20 rows,
> points of circle 2.
>
> When I plot it with gsn_xy, how do I tell NCL to treat the next 20 rows
> (the rows after the empty line) as a different line (so it won't connect
> the last point of circle 1 with the first point of circle 2)?
>
> Also, is there a way to tell NCL to connect the first point of circle 1
> with the last point of circle 1?
>
> Last question is whether I can fill the circle with a color?
>
> Thanks!
> Roni
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Feb 24 2006 - 10:57:58 MST

This archive was generated by hypermail 2.2.0 : Mon Feb 27 2006 - 09:24:43 MST