Re: @gsFillOpacityF does not work

From: H.Dang <danghy_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 26 2013 - 16:31:54 MST

Hi Rick,

I added these new lines in my code, but the resulted graph is same as my
former one. I just plot out the shade+line by plotting the shade before
plotting the curves. But it's strange that I can't get the correct shade
if the two curves are plotted together in a 2-D array.

303 data_stddev = new((/2,35/),"float",-999.)
304 data_stddev(0,:) = ozone_season - 5
305 data_stddev(1,:) = ozone_season + 5
306
307 delete(res@gsnXYFillColors)
308 delete(res@xyLineColors)
309 ;
310 ;rgba = new( (/1,4/), float)
311 ;rgba(:,0:2) = namedcolor2rgb("cornflowerblue") ; note lack of space
in name!
312 ;rgba(:,3) = 0.2
313 ;res@gsnXYFillColors = rgba(0,:) ; or possibly just " = rgba"
314 ;
315 res@gsnXYFillColors = "cornflower blue"
316 res@gsFillOpacityF = 0.5
317 res@xyLineColor = -1 ; We don't want
the line, so make it transparent.
318 std_plot = gsn_csm_xy(wks,data_stddev(0:1,:),pressure_sonde,res) ;
Create filled XY plot.
319
320
321 res@xyLineColors = (/"blue","red","blue","blue"/) ;
change line color
322 res@xyLineThicknesses = (/1.0,1.0,0.8,0.8/)
323 res@xyDashPatterns = (/0,0,2,2/) ; change line color
324
325 data = new((/2,35/),float, -999.)
326 data(0,:) = ozone_season
327 data(1,:) = model_ozone_season
328
329 plot=gsn_csm_xy(wks,data,pressure_sonde,res)

By using line 329, the plot is like "Resolute_single_line_wrong_shade.png"
(please see attached). According to line 305, the right-hand-side shade
should have the same width as the left-hand-side. So something is wrong
here. To solve this problem, I commented out line 329, and added the
following code:

330 plot=gsn_csm_xy(wks,ozone_season,pressure_sonde,res)
331
332 res@xyLineColors = (/"red","blue","blue","blue"/) ;
change line color
333
334 plot=gsn_csm_xy(wks,model_ozone_season,pressure_sonde,res)

Then I got "Resolute_single_line_correct_shade.png" (attached). It's okay
for me to plot the curves separately, but I don't know why they can't be
plotted together.

Best
Hongyan
On Tue, Feb 26, 2013 at 5:38 PM, Rick Brownrigg <brownrig@ucar.edu> wrote:

> What about trying the following:
>
> rgba = new( (/1,4/), float)
> rgba(:,0:2) = namedcolor2rgb("cornflowerblue") ; note lack of space in
> name!
> rgba(:,3) = 0.5
> res@gsnXYFillColors = rgba(0,:) ; or possibly just " = rgba"
>
> Untested, but it might get you what you need -- please let us know.
>
> Rick
>
> On Feb 26, 2013, at 3:01 PM, "H.Dang" <danghy@gmail.com> wrote:
>
> Hi dear NCL'er,
>
> I wanted to add shades besides the blue curve on the graph
> "Resolute_line.png" (please see attached). The way I plot this graph is
> through:
>
> data = new((/2,35/),float, -999.)
> data(0,:) = ozone_season
> data(1,:) = model_ozone_season
> plot=gsn_csm_xy(wks,data,pressure_sonde,res)
>
> When I tried to add shades, I added the following code:
>
> data_stddev = new((/2,35/),"float",-999.)
> data_stddev(0,:) = ozone_season - 5
> data_stddev(1,:) = ozone_season + 5
> delete(res@gsnXYFillColors)
> delete(res@xyLineColors)
> res@gsnXYFillColors = "cornflower blue"
> res@gsFillOpacityF = 0.5
> res@xyLineColor = -1 ; We don't want the
> line, so make it transparent.
> std_plot = gsn_csm_xy(wks,data_stddev(0:1,:),pressure_sonde,res) ;
> Create filled XY plot.
> overlay(std_plot,plot)
>
> But res@gsFillOpacityF doesn't work for me, so the blue curve in
> Resolute_line.png is totally covered by shades (please see attached
> Resolute_shade.png). The warning message is:
>
> warning:gsFillOpacityF is not a valid resource in
> /Fall_SON_modelEY_ozonesonde024_Resolute_xy at this time.
>
> The version of NCL that I'm using is 6.1.0-beta. Is there a way to add
> the blue line on the shade in this version? Thank you!
>
> Hongyan
> <Resolute_line.png><Resolute_shade.png>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Resolute_single_line_correct_shade.png Resolute_single_line_wrong_shade.png Resolute_single_line.png
Received on Tue Feb 26 16:32:56 2013

This archive was generated by hypermail 2.1.8 : Thu Feb 28 2013 - 14:47:31 MST