begin ; ; Create some dummy data for the contour plot. ; N=25 T = new((/N,N/),float) jspn = ispan(-N/2,N/2,1)^2 ispn = ispan(-N/2,N/2,1)^2 do i = 0, dimsizes(ispn)-1 T(i,:) = ispn(i) + jspn end do T = 100.0 - sqrt(8^2 * T) ; ; Create an X workstation. ; wid = create "wks" xWorkstationClass defaultapp end create ; ; Create some dummy data for the Y axis that is NOT regularly spaced. ; y = (/ 10, 50, 100, 150, 250, 500, 750, 1000, 1100, 1300, 1500, \ 1750, 2000, 2200, 2400, 2600, 3000, 4000, 4500, 5000, 5100, 5500, \ 7000, 9000,10000/) ; ; Create a data object with irregularly spaced data for the Y ; axis. Whenever you set the sfYArray or sfXarray resource, this signals ; that that particular axis is now irregularly spaced, regardless of ; whether the data used for these resources is irregularly spaced. ; dataid = create "data" scalarFieldClass defaultapp "sfDataArray" : T ; Contour data. "sfYArray" : y ; Coordinates for Y axis. end create ; ; Create a ContourPlot object and draw it to show what the plot ; looks like with a linear X axis and an irregular Y axis. ; cnid = create "ContourPlot" contourPlotClass wid "cnScalarFieldData" : dataid "tiXAxisString" : "linear" ; Label for X axis. "tiYAxisString" : "irregularly spaced" ; Label for Y axis. end create draw(cnid) ; Draw plot. frame(wid) ; Advance frame. ; ; Create a LogLin plot in which the ContourPlot will be overlaid in ; order to get the irregular Y axis in log scaling. This is the only ; way you can currently get an irregularly spaced axis to be in log ; coordinates. ; llid = create "loglin" logLinPlotClass wid "trXMinF" : 0. ; Set the min and max for "trXMaxF" : N-1 ; the X axis. "trYMinF" : min(y) ; Set the min and max for "trYMaxF" : max(y) ; the Y axis. "trYLog" : True ; Set the Y axis to be log. end create setvalues cnid "tiYAxisString" : "log" ; Change label for Y axis. end setvalues ; ; By overlaying the ContourPlot on this LogLinPlot, the ContourPlot ; will be transformed to the coordinates of the LogLinPlot; that is, ; the Y axis will be in log scaling. ; overlay(llid,cnid) draw(llid) ; Draw the LogLinPlot, which will include the ContourPlot. frame(wid) ; Advance the frame. end