log axis using gsn_csm_contour

From: James Correia <jimmyc42_at_nyahnyahspammersnyahnyah>
Date: Mon, 29 Sep 2008 08:53:29 -0700

Hi all-
I am trying to construct my plot to be a log-log plot. I tried setting the
log axis options for gsn_csm_contour but it did not ork presumably because I
have not specified the axis to have the values I am labeling. Rather the
axis is defined in terms of grid points. Is there a way to modify this?
Thanks
jimmyc

Here is the code I am using:
    wmin = 10.
    wmax = 10000.
    wcint= 100.

    rmin = 0.
    rmax = 46.
    rcint= 2.

    flag = 1. ; 1:log of occurences or 0:just number of occurences
     nn = doubletointeger(((wmax-wmin)/wcint)+1)
     mm = doubletointeger(((rmax-rmin)/rcint)+1)

    if(flag .eq. 1)then
     result = log(result+1.)
    end if

    levels = fspan(wmin+wcint/2.,wmax+(wcint/2.)-wcint,6)
    level = fspan(rmin+(rcint/2.),rmax+(rcint/2.)-rcint,3)
    aaxis = fspan(0,nn-1,6)
    baxis = fspan(0,mm-1,3)

;set up mapping resources
    wks = gsn_open_wks("ps", "tsdiag")
    res = True
    res_at_cnLinesOn = True
    res_at_cnLineLabelsOn = True
    res_at_cnLevelSpacingF = .75 ;set lower if you want more levels
    res_at_cnMaxLevelCount = 10
    res_at_gsnDraw = True
    res_at_cnFillOn = True
    res_at_gsnSpreadColors = True
    res_at_gsnMaximize = True
colors =
(/"white","black","white","blue","pink","Green","Yellow","Orange","Red","purple","Violet","brown"/)
    gsn_define_colormap(wks,colors)

; res_at_trXLog = True
; res_at_trYLog = True
    res_at_trXAxisType = "LogAxis"
    res_at_trYAxisType = "LogAxis"
    res_at_tmXBMode = "Explicit"
    res_at_tmXBValues = aaxis
    res_at_tmXBLabels = levels
    res_at_tmYLMode = "Explicit"
    res_at_tmYLValues = baxis
    res_at_tmYLLabels = level

    plot = gsn_csm_contour(wks,result,res)

-- 
James Correia Jr.
Post Doc
Climate Physics Group, PNNL

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Sep 29 2008 - 09:53:29 MDT

This archive was generated by hypermail 2.2.0 : Mon Sep 29 2008 - 13:35:43 MDT