Re: How to add straight line on xyplot?

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri Nov 04 2011 - 17:56:26 MDT

Hi Louis,
If you want a horizontal straight line you can add the gsnYRefLine
resource to your resource list:
res@gsnYRefLine = 0.0
Note that multiple lines can be added this way:
res@gsnYRefLine = (/ 0.0, 2.5, 3.0 /)

If you want to add a line that varies with X, you can do the following:

data = asciiread("saved_data", (/2, 50/), "float")
data2 = new((/3,50/),typeof(data)
data2(:1,:) = (/ data /)
data2(2,:) = ispan(1,50,1) ; create new (straight) line
<snip>
plot = gsn_csm_xy (wks, data(0,:), data(1:,:), res) ; create plot

Hope that helps. If not, please let ncl-talk know.
Adam

On 11/04/2011 10:06 AM, louis Vonder wrote:
> Dear NCL-users,
>
> I have a simple xy_plot which appear in blue below.
>
> I am trying to overlay a first bisectrix on this graph but I am very
> confuse.
>
> There is any simple way to do it?
>
> Thanks for your help
>
> Louis
>
>
> ; ***********************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ;************************************************
> begin
> ;************************************************
> ; read in data
> ;************************************************
>
> data = asciiread("",
>
> data = asciiread("saved_data", (/2, 50/), "float")
>
>
> ;************************************************
> wks = gsn_open_wks ("ps", "xy")
>
> res = True
>
> res@xyDashPattern = 0
> res@xyMarkLineMode = "MarkLines"
> res@xyMarkers = (/6/)
> res@xyMarkerColors = (/"back/)
>
> plot = gsn_csm_xy (wks, data(0,:), data(1,:), res) ; create plot
>
>
> end
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 4 17:56:32 2011

This archive was generated by hypermail 2.1.8 : Tue Nov 08 2011 - 15:54:50 MST