overlaying a bar chart on a XY contour

From: Ertl, John (John.Ertl AT XXXXXX)
Date: Tue Sep 21 2004 - 12:03:18 MDT

  • Next message: Paulo de Melo Gonçalves: "ThickMark labels on Polar Maps"

    All,

    I have a meteogram that shows a vertical slice along a path with respect to
    time. I am trying to add the ground level to the meteogram. My first
    attempt was to overlay a bar chart on the meteogram and this almost works.
    The problem I am having is the bars are not filled in. I get a great
    outline but I need to have the bars filled in. If I use the same code but
    do not overlay the bar chart but just draw it then I get the bars colored
    but the scales are different...I can fix this but it is a lot of extra stuff
    to ad to the res. I am just trying to keep it as simple as possible.

    Note...The terrain bars are visible as red outlined bars (on attached
    image). Also the terrain is a test array at this point so it has no
    relation to the rest of the image including the map.

    Below is, I think, the relevant NCL code chunks.

    Any ideas? Thanks,

    John Ertl
     
      rh_res = True
      temp_res = True
      uv_res = True
      rain_res = True
      tempsfc_res = True
      ground_res = True
    ;
    ; Here are the resources that rh_res, temp_res, and uv_res share.
    ;
      rh_res@trYReverse = True ; Reverse the Y values.
      rh_res@gsnDraw = False ; Don't draw individual plot.
      rh_res@gsnFrame = False ; Don't advance frame.
    ; rh_res@gsnMaximize = True ; Maximize plot in frame.
      rh_res@vpXF = 0.15 ; x location
      rh_res@vpYF = 0.76 ; y location
      rh_res@vpWidthF = 0.7 ; width
      rh_res@vpHeightF = 0.44 ; height
      rh_res@cnInfoLabelOn = False ; turn off cn info label

      temp_res = rh_res
      uv_res = rh_res
      ground_res = rh_res

    ; ---------------------- Relative humidity resources
      rh_res@sfXArray = taus ; Define X/Y axes values that
      rh_res@sfYArray = levels ; all three data fields are on
      rh_res@tiYAxisString = "Pressure (mb)" ; Y axes label.
    ; rh_res@gsnYAxisIrregular2Log = True ; added for log

      rh_res@tmYLMode = "Explicit" ; Define own tick mark labels.
      rh_res@tmYLLabelFont = 25 ; Change the font.
      rh_res@tmYLValues = levels
      rh_res@tmYLLabels = levels
    ; rh_res@tmYLLabels =
    (/"1000","975","950","925","850","800","700","600","500","400"/)
      rh_res@tmYLMinorOn = False ; No minor tick marks.
    ; ----------------------
    ; rh_res@tiXAxisString = "Forecast hour" ; X axes label.

    ; rh_res@tmXBLabelsOn = True ; have tick mark labels
      rh_res@tiXAxisString = "" ; X axes label.
      rh_res@tmXBMode = "Explicit" ; Define own tick mark labels.
      rh_res@tmXBLabelFont = 25 ; Change the font.
      rh_res@tmXBValues = taus
      rh_res@tmXBLabelFontHeightF = .016 ; Font size
      rh_res@tmXBLabels =
    (/"Sep21","12z","Sep22","12z","Sep23","12z","Sep24"/) ; insert a list
      rh_res@tmXBLabelAngleF = 90. ; change label angle
      rh_res@tmXBMinorOn = False ; No minor tick marks.

      rh_res@tmXUseBottom = False ; Keep top axis independent of bottom.
      rh_res@tmXTLabelsOn = True ; have tick mark labels
      rh_res@tmXTOn = True ; have tick marks
      rh_res@tmXTMode = "Explicit" ; Define own tick mark labels.
      rh_res@tmXTLabelFont = 25 ; Change the font.
      rh_res@tmXTValues = taus
      rh_res@tmXTLabelFontHeightF = .016 ; Font size
      rh_res@tmXTLabels =
    (/"37.0:-122.0","35.0:-125.0","31.0:-130.0","28.0:-141.0","25.0:-150.0","23.
    0:-153.0","21.0:-158.0"/) ; insert a list

      rh_res@tmXTLabelAngleF = 65. ; change label angle
      rh_res@tmXTMinorOn = False ; No minor tick marks.

    ; -----------------------
      rh_res@gsnSpreadColors = True
      rh_res@gsnSpreadColorEnd = 11 ; only use the first 12 colors (count starts
    at 0)
                                    ; for the color fill of RH
      rh_res@cnFillOn = True ; turns on color fill
      rh_res@cnLineLabelsOn = True ; no contour labels
      rh_res@tiMainString = "Meteogram for Mission Test, 21/00Z"
      rh_res@cnFillOn = True ; turns on the color

    ; ---------------------- temperature resources
      temp_res@sfXArray = taus ; Define X/Y axes values that
      temp_res@sfYArray = levels ; all three data fields are on
      temp_res@vcRefAnnoOn = False ; turns off the ref box
      temp_res@cnLevelSpacingF = 10. ; contour spacing

      temp_res@cnLineLabelsOn = True ; no contour labels
      temp_res@cnLineThicknessF= 3.0 ; line thickness
      temp_res@cnLineColor = "Red"
      temp_res@cnMonoLineLabelFontColor = True
      temp_res@cnLineLabelFontColor = "Red"

    ; ---------------------- wind barbs resources
      uv_res@vfXArray = taus ; Define X/Y axes values that
      uv_res@vfYArray = levels ; all three data fields are on
      uv_res@vcRefAnnoOn = False ; turns off the ref box
      uv_res@vcRefLengthF = 0.040
      uv_res@vcGlyphStyle = "WindBarb"
    ; uv_res@vcMinDistanceF = 0.025
      uv_res@vcMonoWindBarbColor = True ; color the windbarbs with
                                        ; respect to speed use False
    ; ---------------------- ground height
    ; ground_res@gsnFrame = False
      ground_res@cnFillOn = False ; turns on the color
      ground_res@sfXArray = taus ; Define X/Y axes values that
      ground_res@sfYArray = levels ; all three data fields are on
      ground_res@xyLineThicknesses = 2
      ground_res@xyLineColor = "red"
      ground_res@gsnYRefLine = 1000.0 ; create a reference line
      ground_res@gsnBelowYRefLineColor = "red" ; Below (but vertical is upside
    down) ref line fill color
      ground_res@gsnAboveYRefLineColor = "red" ; above ref line fill color
      ground_res@gsnXYBarChart = True

    ; Create the four plots (they won't get drawn here, because gsnDraw
    ; was set to False for all three of them.
    ;
      rhfill = gsn_contour(wks,smothrh,rh_res)
      templine = gsn_contour(wks,smothtemp,temp_res)
      windlayer = gsn_vector(wks,ugrid,vgrid,uv_res)
      ground = gsn_csm_xy(wks,taus,PresAtSfc,ground_res)
    ; ---------------------- overlay, draw, and advance frame
      overlay(rhfill,templine) ; overlay makes rhfill = (rhfill,templine)
      overlay(rhfill,windlayer); overlay makes rhfill = ((rhfill,templine) +
    windlayer)
      overlay(rhfill,ground)
      draw(rhfill)
      frame(wks)




    _______________________________________________
    ncl-talk mailing list
    ncl-talk AT ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Thu Sep 23 2004 - 10:09:11 MDT