Re: switching color maps in multi-panel plots

From: Adam Phillips (asphilli AT XXXXXX)
Date: Tue Jun 03 2003 - 13:19:05 MDT

  • Next message: Christian Pagé: "Plot tephigrams?"

    >I'm trying to draw a two-panel plot where each panel has a different
    >color map. I've defined one workstation, then switch color map
    >definitions when building each plot to the same workstation. It appears
    >that only portions of the colormaps are replaced, and gsnSpreadColors
    >fails to function properly. Relevent portions of my code follow... Any
    >suggestions?
    >
    >Paul Nutter

    Hi Paul,

    I have recently done this. There might be a better way, but I did it by not
    using gsn_panel. I instead used vpYF and vpHeightF to specify the location of
    each plot on the page. I did not need to define a 2nd workstation.
    ;----------------------------------------------
    wks = gsn_open_wks("ps","fig5")
    gsn_define_colormap(wks,"BlWhRe")

    sres = True
    sres@vpYF = 0.9
    sres@vpHeightF = 0.2
    sres@gsnDraw = False
    sres@gsnFrame = False
    map = gsn_csm_contour_map_ce(wks,z3trend,sres)
    draw(map) ;<--- I think this is the trick, the 1st plot must be drawn

    sres@vpYF = 0.65
    gsn_define_colormap(wks,"WhBlGrYeRe")
    map2 = gsn_csm_contour_map_ce(wks,ppttrend,sres)
    draw(map2)
    frame(wks)
    end
    ;----------------------------------------------

    Hopefully that helps...
    Adam

    -----
    >
    > gsn_define_colormap (xwks,"ncview_default")
    > getvalues xwks
    > "wkColorMap" : cmap1
    > end getvalues
    > cmap1(0,:) = (/1.,1.,1./)
    > cmap1(1,:) = (/0.,0.,0./)
    >
    > gsn_define_colormap (xwks,"rainbow")
    > getvalues xwks
    > "wkColorMap" : cmap2
    > end getvalues
    > cmap2(0,:) = (/1.,1.,1./)
    > cmap2(1,:) = (/0.,0.,0./)
    > cmap2(2,:) = (/1.,1.,1./)
    >
    > twopanel = new(2,graphic)
    >
    > gsn_define_colormap(xwks,cmap1)
    >
    > twopanel(0) = gsn_csm_contour_map_ce(xwks,VORT,rsrc1)
    >
    > gsn_define_colormap(xwks,cmap2)
    >
    > twopanel(1) = gsn_csm_contour_map_ce(xwks,TPCP,rsrc4)
    >
    > gsn_panel(xwks,twopanel,(/2,1/),False) ; Draw as one plot
    >
    >
    >_______________________________________________
    >ncl-talk mailing list
    >ncl-talk@ucar.edu
    >http://mailman.ucar.edu/mailman/listinfo/ncl-talk

    -------------------------------------------------------------
    Adam Phillips email: asphilli@ucar.edu
    Climate and Global Dynamics Division tel: (303) 497-1726
    National Center for Atmospheric Research fax: (303) 497-1333
    P.O. Box 3000
    Boulder, CO 80307-3000 http://www.cgd.ucar.edu/~asphilli

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



    This archive was generated by hypermail 2b29 : Tue Jun 03 2003 - 13:38:53 MDT