[ncl-talk] smooth option for xy plots?
Dennis Shea
shea at ucar.edu
Tue Feb 21 11:42:16 MST 2017
To answer an offline query sent to me:
Yes. you did post this question before. However, it was a holiday
yesterday.
---
The EXCEL plot looks nice *but* is it 'correct?' The orange line between
'x' values 4 and 6 is above 4.5. Is that correct? Likely, some
interpolation method was used 'under-the-hood' prior to drawing the curve.
How else can you get the values between (say) x=4 and x=6?
---
http://www.ncl.ucar.edu/Document/Functions/Built-in/ftcurv.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/ftsetp.shtml
xi = (/.../)
yi = (/.../)
nx = dimsizes(xi)
N = 5*nx ; arbitrary
xo = fspan(min(x), max(x), N)
;*ftsetp*("sig",0.9) ; you may have to 'play' with this
; default is 1.0
yo = *ftcurv*(xi, yi, xo)
plot xo,yo
===BETTER===
undef("mimic_excel")
function mimic_excel(xi[*]:numeric, yi[*]:numeric, N[1]:integer,
sig[1]:numeric)
local xo, yo
begin
xo = fspan(min(xi), max(xi), N)
if (sig.ne.1.0) then
* ftsetp*("sig",sig)
end if
yo = *ftcurv*(xi, yi, xo)
return( [/ xo, yo/] ) ; return as list variable
end
;==== MAIN
xi = (/.../)
yi = (/.../)
nx = dimsizes(xi)
N = 5*nx ; 5 is arbitrary
sig = 1.0 ; default
xyo = mimic_excel(xi, yi, N, sig)
xo = xo[0]
yo = yo[1]
Good luck
On Mon, Feb 20, 2017 at 1:39 PM, xiaoming Hu <yuanfangcan at hotmail.com>
wrote:
> Hello
>
>
> I am wondering if NCl provide a smooth option for xy plots like Excel:
>
> In NCL, it seems only straight lines are allowed between data points.
>
>
> Thanks
>
> Xiaoming
>
>
>
> _______________________________________________
> 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/20170221/c2c01013/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 28215 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170221/c2c01013/attachment.png
More information about the ncl-talk
mailing list