Hi Arne,
I definitely think that it is possible, although decently complicated.
After filling out an array of colors, I decided the best course of
action was to draw individual lines (for each data point) and not
advance the frame. Others can chime in if they can think of a better
method.
In the following I will assume that you are manually setting the
cnFillColors = mycolors in your contour plot resource list, and I will
also assume that delta-X is a constant. Hopefully this will at least get
you on the right track. Good luck. Adam
; untested!
;
; data = 1D array with crosssection values
datacolor = new(dimsizes(data),typeof(data))
nlevels = dimsizes(myintervals)
do gg = 0,nlevels-1 ; loop thru each level
if (gg.eq.0) then
temp = ind(data.lt.myintervals(gg))
else
temp = ind(data.ge.myintervals(gg-1).and.data.lt.myintervals(gg)
end if
if (.not.ismissing(temp)) then
datacolor(temp) = mycolors(gg)
end if
if (gg.eq.(nlevels-1)) then ; special case for last contour level
temp2 = ind(data.ge.myintervals(gg))
if (.not.ismissing(temp2)) then
datacolor(temp2) = mycolor(gg+1)
delete(temp2)
end if
end if
delete(temp)
end do
deltaX = 1. ; you will have to likely change this
xarray = ispan(1,10,1) ; and this
halfdX = deltaX/2.0
res = True
res_at_gsnFrame = False
.........
do hh = 0,dimsizes(datacolor)-1
res_at_xyLineColor = datacolor(hh)
if (hh.eq.0) then
xarr = (/xarray(hh),xarray(hh)+halfdX/)
dumdata = (/data(hh),((data(hh)+data(hh+1))/2.0) /)
end if
if (hh.ge.1.and.le.(dimsizes(datacolor)-2)) then
xarr = (/xarray(hh)-halfdX,xarray(hh)+halfdX/)
dumdata=(/((data(hh-1)+data(hh))/2.0,((data(hh)+data(hh+1))/2.0)/)
end if
if (hh.eq.(dimsizes(datacolor)-1) then
xarr = (/xarray(hh)-halfdX,xarray(hh)/)
dumdata = (/((data(hh-1)+data(hh))/2.0),data(hh) /)
end if
plot = gsn_csm_xy(wks, xarr, dumdata,res)
end do
frame(wks)
Arne Melsom wrote:
>
> Hi all,
> Is there a way to apply color shading to a xy plot curve? I have a 2D
> contour plot of SSH with a shading defined by the resources
> res_at_cnLevelSelectionMode = "ExplicitLevels"
> res_at_cnLevels = myintervals
> the latter being a 1D array that's defined elsewhere. Now, I extract
> values in a crossection (i.e., along a line), and would like to display
> the extracted values as a multi-color curve in a xy plot, using the
> shading from the contour plot. Is this possible?
> Many thanks!
> -Arne
>
> _______________________________________________
> 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-talkReceived on Mon Sep 11 2006 - 13:42:08 MDT
This archive was generated by hypermail 2.2.0 : Mon Sep 11 2006 - 16:31:47 MDT