[ncl-talk] 回复: Significance with contour: positive in solidlineandnegative in dash line

Adam Phillips asphilli at ucar.edu
Thu Aug 23 11:15:02 MDT 2018


Hi Zhen,
It looks to me like dashed lines are being drawn over negative areas, and
solid lines are being drawn over positive areas in the test.pdf output
file. Is this not what you want? The dashes, though, are rather large and
unless you zoom in they can be hard to see. Are they dash pattern #14? I
would switch to using dash pattern #2.

If I am completely not understanding what you are asking, please respond to
ncl-talk with your complete script (in its' current state), the output, and
a clear explanation of what you would like to change.
Adam

On Thu, Aug 23, 2018 at 6:46 AM 刘振 <286909655 at qq.com> wrote:

> Dear Mary,
>
>   May I know how is the test now. Thanks.
>
> Best regards,
> zhen
>
> ------------------
> 刘振
> 中山大学
> 环境科学与工程学院
> 大气科学系
> Phone: +86-15013246049
> Liu  Zhen
> Department of Atmospheric Science
> School of Environmental Science and Engineering
> Sun Yat-sen University
> Email address: liuzhen9 at mail2.sysu.edu.cn
>
>
>
> ------------------ 原始邮件 ------------------
> *发件人:* "刘振"<286909655 at qq.com>;
> *发送时间:* 2018年8月21日(星期二) 中午1:43
> *收件人:* "Mary Haley"<haley at ucar.edu>;
> *抄送:* "ncl-talk"<ncl-talk at ucar.edu>;
> *主题:* 回复: [ncl-talk] Significance with contour: positive in
> solidlineandnegative in dash line
>
> Dear Mary,
>
>   I am really sorry about the confusing code before and have make a clean
> script attached with the output (test.pdf) also.
>   The color fill actually is not induce by my commented code. I got the
> color fill because I load a script (res_zhen.ncl) externally on the first
> line in which I save some plot properties. So I also enclose the
> res_zhen.ncl in attachment for your reference.
>   Here comes my questions. The contour lines in file 'var.pdf' represent
> the correct significant areas. I want to make the lines in dash pattern
> when the color shading denotes negative. However, with the attached script,
> the contour line, magnify the signigicant areas.
>   I hope I have made my points clearly. Please feel free to give me any
> suggestions and comments. Many thanks.
>
> Best regards,
> zhen
>
> ------------------
> 刘振
> 中山大学
> 环境科学与工程学院
> 大气科学系
> Phone: +86-15013246049
> Liu  Zhen
> Department of Atmospheric Science
> School of Environmental Science and Engineering
> Sun Yat-sen University
> Email address: liuzhen9 at mail2.sysu.edu.cn
>
>
>
> ------------------ 原始邮件 ------------------
> *发件人:* "Mary Haley"<haley at ucar.edu>;
> *发送时间:* 2018年8月21日(星期二) 凌晨5:33
> *收件人:* "刘振"<286909655 at qq.com>;
> *主题:* Re: [ncl-talk] Significance with contour: positive in
> solidlineandnegative in dash line
>
> Dear Zhen,
>
> It is hard for me to debug this script because there's a lot of code
> commented out, and without being able to run it, I can't tell what the
> values of the arrays are that you are plotting.
>
> Also, in the script you sent me, "cnFillOn" is never set to True, so I'm
> not sure how you got color fill in the first place.  You do have a section
> where cnFillOn is set to True, but it's commented out. This makes it
> extremely hard for me to debug, because I don't know which code is supposed
> to be uncommented.
>
> If you want me to debug your code without being able to run it, then at a
> minimum, you need to send me a *clean* script that doesn't have a bunch of
> commented resources.  Also, send me the new image that is a result of your
> clean script, and explain in more detail what is wrong with the image so I
> know where in your code I can try to find the error.  It is still not clear
> to me what you are trying to do.
>
>
> --Mary
>
>
>
>
>
>
> On Sat, Aug 18, 2018 at 12:23 AM, 刘振 <286909655 at qq.com> wrote:
>
>> Dear Mary,
>>
>>   I am sorry I forgot to enclose my script. You are right that I got two
>> contour plots. But I don't think I mix them.
>>   One contour plot in shading represent differences and the p values for
>> significance is based on the differences. The second contour plot represent
>> the p value I calculate. As you know, the p value is positive. In order to
>> plot the negative differences with dashed p contour line. I reset the p
>> value to negative when the differences is negative using "prob=where(var
>> .lt.0,-prob,prob)". The problem is the significant area in contour
>> (T2.pdf) totally changed.
>>   The corresponding script is attached for your reference. The data is in
>> several giga bites. It is not easy to attach the data directly. Hope you
>> can get some idea from my script. Looking forward to your reply. Thanks.
>>
>> Best regards,
>> zhen
>>
>> ------------------
>> 刘振
>> 中山大学
>> 环境科学与工程学院
>> 大气科学系
>> Phone: +86-15013246049
>> Liu  Zhen
>> Department of Atmospheric Science
>> School of Environmental Science and Engineering
>> Sun Yat-sen University
>> Email address: liuzhen9 at mail2.sysu.edu.cn
>>
>>
>>
>> ------------------ 原始邮件 ------------------
>> *发件人:* "Mary Haley"<haley at ucar.edu>;
>> *发送时间:* 2018年8月17日(星期五) 晚上10:43
>> *收件人:* "刘振"<286909655 at qq.com>;
>> *抄送:* "NCL"<ncl-talk at ucar.edu>;
>> *主题:* Re: [ncl-talk] Significance with contour: positive in solid
>> lineandnegative in dash line
>>
>> Zhen,
>>
>> I would need to see your script, and maybe your data (which you can email
>> if it's small) in order to understand what's going on. It looks like you
>> have two contour plots overlaid. Is it possible you are applying the wrong
>> set of resources to the wrong data?
>>
>> --Mary
>>
>>
>> On Thu, Aug 16, 2018 at 8:43 PM, 刘振 <286909655 at qq.com> wrote:
>>
>>> Dear Mary,
>>>
>>>   Thanks a lot for you reply and very good suggestions.
>>>   Your methods perfectly solve my second problem.
>>>   But, for the first one, it is, somehow, a little tricky. The contour
>>> line I want to plot represents p value (according to student's t test),
>>> which is always positive. In order to plot the positive (value in shading)
>>> with solid line while negative with dash line, I use ‘prob=where(var.lt.
>>> 0,-prob,prob)’ in my script to change the p value (i.e., prob) first.
>>> Then I plot the p value using contour with negative p value in dash. But
>>> the region at 95% significant area totally changed. Please check the
>>> differences between the two outputs attached. The var.pdf should be the
>>> right one. Could you please help me to solve this issue. Thanks.
>>>
>>> Best regards,
>>> zhen
>>>
>>> ------------------
>>> 刘振
>>> 中山大学
>>> 环境科学与工程学院
>>> 大气科学系
>>> Phone: +86-15013246049
>>> Liu  Zhen
>>> Department of Atmospheric Science
>>> School of Environmental Science and Engineering
>>> Sun Yat-sen University
>>> Email address: liuzhen9 at mail2.sysu.edu.cn
>>>
>>>
>>>
>>> ------------------ 原始邮件 ------------------
>>> *发件人:* "Mary Haley"<haley at ucar.edu>;
>>> *发送时间:* 2018年8月17日(星期五) 上午7:49
>>> *收件人:* "刘振"<286909655 at qq.com>;
>>> *抄送:* "ncl-talk"<ncl-talk at ucar.edu>;
>>> *主题:* Re: [ncl-talk] Significance with contour: positive in solid line
>>> andnegative in dash line
>>>
>>> Dear Zhen,
>>>
>>> One way to find out if there's an example for something specific you are
>>> trying to do, you can use the "tips" link on the examples page:
>>>
>>> List of tips <http://www.ncl.ucar.edu/Applications/concepts_list.shtml>,
>>>  resources <http://www.ncl.ucar.edu/Applications/res_list.shtml>,
>>> functions/procedures
>>> <http://www.ncl.ucar.edu/Applications/func_list.shtml> and the example
>>> scripts they appear in.
>>>
>>>
>>> Which takes you to this page:
>>>
>>> http://www.ncl.ucar.edu/Applications/concepts_list.shtml
>>>
>>> You can then use your browser search to search for "negative" or
>>> "positive".  You will find this under the search for "negative":
>>>
>>> *Drawing negative contour lines as dashed lines*
>>>     conOncon_1.ncl
>>> <http://www.ncl.ucar.edu/Applications/Scripts/conOncon_1.ncl> (contours
>>> on contours <http://www.ncl.ucar.edu/Applications/conOncon.shtml#ex1>)
>>>     conOncon_2.ncl
>>> <http://www.ncl.ucar.edu/Applications/Scripts/conOncon_2.ncl> (contours
>>> on contours <http://www.ncl.ucar.edu/Applications/conOncon.shtml#ex2>)
>>>     conOncon_4.ncl
>>> <http://www.ncl.ucar.edu/Applications/Scripts/conOncon_4.ncl> (contours
>>> on contours <http://www.ncl.ucar.edu/Applications/conOncon.shtml#ex4>)
>>>     coneff_3.ncl
>>> <http://www.ncl.ucar.edu/Applications/Scripts/coneff_3.ncl> (contour
>>> effects <http://www.ncl.ucar.edu/Applications/coneff.shtml#ex3>)
>>>     coneff_5.ncl
>>> <http://www.ncl.ucar.edu/Applications/Scripts/coneff_5.ncl> (contour
>>> effects <http://www.ncl.ucar.edu/Applications/coneff.shtml#ex5>)
>>>     coneff_6.ncl
>>> <http://www.ncl.ucar.edu/Applications/Scripts/coneff_6.ncl> (contour
>>> effects <http://www.ncl.ucar.edu/Applications/coneff.shtml#ex6>)
>>>     coneff_9.ncl
>>> <http://www.ncl.ucar.edu/Applications/Scripts/coneff_9.ncl> (contour
>>> effects <http://www.ncl.ucar.edu/Applications/coneff.shtml#ex9>)
>>>
>>>
>>> I recommend clicking on the link inside the "(...)" and not the actual
>>> NCL script, because this way you can see the description of the example,
>>> the image, and the link to the script. A good example to start with is
>>> "coneff_3.ncl":
>>>
>>> http://www.ncl.ucar.edu/Applications/coneff.shtml#ex3
>>>
>>> which mentions two resources, gsnContourNegLineDashPattern and
>>> gsnContourPosLineDashPattern
>>>
>>>
>>> http://www.ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnContourNegLineDashPattern
>>>
>>> http://www.ncl.ucar.edu/Document/Graphics/Resources/gsn.shtml#gsnContourPosLineDashPattern
>>>
>>> which should hopefully answer your first question.
>>>
>>> To answer your second question, you can also use the "tips" page, but
>>> this time search for "dot" or "stipple". In this case, "dot" gives you the
>>> best results, and "coneff_11.ncl" may be the best example to look into.
>>> The resources cnFillScaleF and cnFillDotSizeF may help you with the density
>>> and size of your dots.
>>>
>>> http://www.ncl.ucar.edu/Applications/coneff.shtml#ex
>>> <http://www.ncl.ucar.edu/Applications/coneff.shtml#ex11>11
>>>
>>> If this doesn't help, please post back to ncl-talk.
>>>
>>> Thanks,
>>>
>>> --Mary
>>>
>>>
>>> On Thu, Aug 16, 2018 at 8:02 AM, 刘振 <286909655 at qq.com> wrote:
>>>
>>>> Dear Sir/Madam,
>>>>
>>>>   I use the script attached to plot the significance area (student's t
>>>> test) with contour lines. I am wondering if there is a way to make the
>>>> positive area (shading) in solid line while negative area in dash line. The
>>>> output is also attached. Thanks.
>>>>   For another output named T2-CTLF-CTL-sum.pdf, most of the area are at
>>>> 95% significant. By contrast, only region not significant show with
>>>> contours. Could you also tell me how to deal with such kind of situation. I
>>>> try to use dot instead of contour to show significant area. But all the
>>>> plot become black because of the data at a high resolution. Here comes the
>>>> question that how to decrease the density of the dots? Thanks.
>>>>
>>>> Best regards,
>>>> zhen
>>>>
>>>> ------------------
>>>> 刘振
>>>> 中山大学
>>>> 环境科学与工程学院
>>>> 大气科学系
>>>> Phone: +86-15013246049
>>>> Liu  Zhen
>>>> Department of Atmospheric Science
>>>> School of Environmental Science and Engineering
>>>> Sun Yat-sen University
>>>> Email address: liuzhen9 at mail2.sysu.edu.cn
>>>>
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180823/8ea6b8cc/attachment.html>


More information about the ncl-talk mailing list