[ncl-talk] Fwd: Could I add some FillPatterns effect such asobliquelines to a raster fill plot ?
Adam Phillips
asphilli at ucar.edu
Mon Aug 24 12:04:00 MDT 2015
Hi Lin,
(ncl-talk included)
Method #2 is the way to go, and I still think you should be able to do it
by modifying and using trial and error on the following lines:
sig = where(sig.le.0.05,sig,0.06)
res2 at cnLevels = 0.05
For instance, I would try the following:
sig = where(sig.le.0.05,sig,0.15)
res2 at cnLevels = 0.045
and if that doesn't work try this:
sig = where(sig.le.0.05,sig,0.055)
res2 at cnLevels = 0.045
You should notice the range of the the pattern fill changing.
You might have to try modifying the above two settings several times before
you get it right, but it should be quite possible to match up the 2 plots.
I am also wondering whether this line is correct:
plot(i) = gsn_csm_contour(wks, y, res)
I think it should be:
plot(i) = gsn_csm_contour(wks, sig, res)
as you want to compare the exact same field raster and color filled to one
pattern filled. The array y is based on this line:
y = where(sig.le.0.05,dtr,-999.) ; significant trend
and contains dtr data as opposed to sig data.
If you cannot get the plot or do not wish to go through the trial and error
process you can attempt to draw polylines through each significant grid
box, but as I indicated previously this can get tedious.
If you have any further questions please respond to ncl-talk.
Adam
On Sun, Aug 23, 2015 at 10:13 AM, xianglin72 <xianglin72 at icloud.com> wrote:
> Hi, Adams,
>
>
> I've tried for sometimes, but it seems that this problem is
> unresolvable.
>
>
> 1、
>
> res at cnFillMode = "RasterFill"
>
> plot(i) = gsn_csm_contour(wks, y, res)
> opt = True
> opt at gsnShadeFillType = "pattern" ; pattern fill
> opt at gsnShadeMid = 3 ; use pattern #2
> plot(i) = gsn_contour_shade(plot(i), -0.01, 0.05, opt)
> ……..
> no fillPattern will be done.
>
> 2、
> y = where(sig.le.0.05,dtr,-999.) ; significant
> trend
> y at _FillValue = -999.
> res at cnFillMode = "RasterFill" ; “CellFill“
> plot(i) = gsn_csm_contour(wks, y, res)
>
> sig = where(sig.le.0.05,sig,0.06)
> res2 at cnFillMode = "AreaFill" ;"AreaFill"
> res2 at cnMonoFillPattern = True
> res2 at cnFillPattern = 3
> res2 at cnMonoFillColor = False
> res2 at cnFillColors = (/"black","black","white","white"/)
> res2 at cnLevelSelectionMode = "ExplicitLevels"
> res2 at cnLevels = (/0.,0.05,0.1/)
> iplot = gsn_csm_contour(wks, sig, res2)
> overlay(plot(i),iplot)
> …...
> Then the cnFillPattern can not be shown as preferred. (see the attached
> fig file, All the significant values have been raster filled in the
> corresponding rectangular cell, all the shaded lines should also be added
> within these cells as expected, )
>
>
> Thanks
>
> LIn
>
>
>
>
>
>
> 原始邮件
> *发件人:* Adam Phillips<asphilli at ucar.edu>
> *收件人:* xianglin72<xianglin72 at icloud.com>
> *抄送:* ncl-talk at ucar.edu<ncl-talk at ucar.edu>
> *发送时间:* 2015年8月23日(周日) 12:24
> *主题:* Re: [ncl-talk] Could I add some FillPatterns effect such
> asobliquelines to a raster fill plot ?
>
> Hi Lin,
> You are correct, you cannot raster fill and pattern fill at the same time.
> However, I remembered that I replied to someone with this issue in April.
> See the response here:
> http://mailman.ucar.edu/pipermail/ncl-talk/2015-April/002370.html
> In short: you need to manipulate the values of the boxes that are not
> hatched so that the pattern fill only covers the boxes that you want. Note
> in the example coding that the user had _FillValue(s); you may or may not
> have that set for the boxes you do not want pattern filled.
>
> The above referenced method requires trial and error, but it is possible
> to do what you want.
>
> An alternative to the above would be to make many calls to
> gsn_add_polyline, drawing a line across each grid box, but that method may
> be intensive to implement as well.
>
> Good luck. If you have any other inquires please respond to ncl-talk.
> Adam
>
> On Aug 21, 2015, at 10:05 PM, xianglin72 <xianglin72 at icloud.com> wrote:
>
> Hi, Adam
>
>
> Thank you the reply. I've tried what you have told before sending
> the first mail( see the attached script), however, I can not get what you
> and I expect ( see the attached plot).
>
> I've checked the explaination on the resource of "raster fill", and
> found the following :
>
>
> The following resources can be used to control fill features when
> *cnFillMode* is set to RasterFill:
>
> - *cnFillColors*
> - *cnGridBoundFillColor*
> - *cnMissingValFillColor*
> - *cnOutOfRangeFillColor*
> - *cnRasterSmoothingOn*
> - *cnRasterMinCellSizeF*
> - *cnRasterSampleFactorF*
> - *cnRasterCellSizeF*
>
>
> So you can find that the cnMonoFillColor and cnFillPattern can not
> work for this mode, which I've said in the first mail.
>
>
> Since the "AreaFill" mode can not get the same effect and the "cnFillPattern"
> resource can not be used for "CellFill" and
>
> "rasterfill" mode, I still don't know how to add some shading effect for
> the chosen raster grids.
>
>
> Thanks
>
>
> Lin
>
>
>
>
> 原始邮件
> *发件人:* Adam Phillips<asphilli at ucar.edu>
> *收件人:* xianglin72<xianglin72 at icloud.com>
> *抄送:* ncl-talk at ucar.edu<ncl-talk at ucar.edu>
> *发送时间:* 2015年8月22日(周六) 02:19
> *主题:* Re: [ncl-talk] Could I add some FillPatterns effect such as
> obliquelines to a raster fill plot ?
>
> Hi Lin,
> You can always do an overlay where you create two images:
> 1) Create a RasterFill plot with colors. (You already have this plot.)
> 2) Create a RasterFill plot with pattern fill (not color fill).
>
> Then you would overlay 2) on 1) using the overlay procedure.
>
> See example #10 here:
> http://www.ncl.ucar.edu/Applications/overlay.shtml#ex10
>
> Note that for plot 2) (or plot_shade in example 10) you would want to set
> the following resources:
> res at cnFillPattern = 3
> res at cnMonoFillColor = True
> res at lbLabelBarOn = False ; no labelbar needed
>
> Available fill patterns:
> http://www.ncl.ucar.edu/Document/Graphics/Images/fillpatterns.png
>
> Hope that helps. If not, please respond to ncl-talk.
> Adam
>
>
>
>
> On Fri, Aug 21, 2015 at 8:44 AM, xianglin72 <xianglin72 at icloud.com> wrote:
>
>> Hi, all
>>
>>
>> I've made a raster fill plot ( see the attachment), and I want to
>> add some FillPattern effect for some chosen cells in the plot.
>>
>>
>> However, I found that the resource of cnFillPattern can not work for the
>> raster fill plot. How could I do to add some effect,
>>
>>
>> for example, some oblique lines to the chosen rectanglar cells?
>>
>>
>>
>> Thanks
>>
>>
>>
>> Lin
>>
>>
>> _______________________________________________
>> 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>
>
> <test2.eps>
>
> <dtr_sat_raster.ncl>
>
>
--
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/20150824/ffbe09fe/attachment.html
More information about the ncl-talk
mailing list