[ncl-talk] emphasize every parts of a line with different colors according to its y value.
Rick Brownrigg
brownrig at ucar.edu
Fri Dec 30 09:35:33 MST 2016
Hi,
I don't know of any way of doing this other than to draw the line
piecewise. What about something like:
datadims = dimsizes(data) ; assuming your data is 2xN
numlinesegs = datadims(1) - 1
linesegs = new((/ numlinesegs/), graphic)
do i=1,numlinesegs
color = ....appropriate logic to determine the color here...
res at gsLineColor = color
linesegs(i) = gsn_add_polyline(wks, plot, data(0, i-1:i), data(1, i-1:i),
res)
end do
This is not particularly efficient, and there may be better ways of doing
this, but that should work.
HTH...
Rick
On Fri, Dec 30, 2016 at 12:48 AM, grace <313695096 at qq.com> wrote:
> Hi:
> All,I am trying to draw a line that emphasize every parts of it with
> different colors.
> I have found the example xy_12.ncl which highlight the wanted part by
> split the data.
> But I want to draw a line which have different colors according to its y
> numberical value,just like the plot below.
> If I split the data ,that would be a huge work.
> Have anybody drawed plot like this ?Any information will be appreciated.
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161230/f67a68d9/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0356412F at 5DA70B25.65116658.png
Type: application/octet-stream
Size: 17701 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161230/f67a68d9/attachment.obj
More information about the ncl-talk
mailing list