begin ; ; Define a Y array to plot. ; y = (/2.0,0.9,2.2,4.3,3.9,4.6,4.8,4.8,4.6,3.5,3.9,2.5,2.0/) ; ; Define an array of randomly spaced pressure values. These are the ; values that we want to go on the right Y axis. ; pressure = (/1000, 925, 875, 800, 700, 575, 450, 350, 200, 175, 75, 50/) ; ; Create an X workstation. ; wid = create "xwid" xWorkstationClass defaultapp end create ; ; Create a data object. ; dataid = create "xyData" coordArraysClass defaultapp "caYArray": y end create ; ; Create an XY plot. ; plotid = create "xyPlot" xyPlotClass wid "xyCoordData" : dataid "trYMinF" : min(y) ; Make sure the min/max of our Y axis "trYMaxF" : max(y) ; is the same as our data. "tmYUseLeft" : False ; Don't use tick marks on the right side ; that are used on left side. "tmYRMode" : "Explicit" ; Explicitly define where we want tick ; marks and what labels we want at them. ; ; Place the pressure values at equal intervals along the right Y axis. ; Note that the pressure values themselves are NOT equally spaced, but ; they will be placed at equal intervals on the axis. ; "tmYRValues" : fspan(min(y),max(y),dimsizes(pressure)) "tmYRLabels" : pressure "tmYRLabelsOn" : True ; We have to turn on labels for the right axes, ; otherwise they won't appear. end create draw(plotid) ; Draw the XY plot. ; ; Create a text item to label the left Y axis. ; txid = create "text" textItemClass wid "txPosXF" : 0.10 ; X pos. of text "txPosYF" : 0.50 ; Y pos. of text "txFontHeightF" : 0.02 ; Change the size of the font. "txAngleF" : 90.0 ; Rotate the text 90 deg. counter-clockwise. "txString" : "Height (km)" end create draw(txid) ; Draw the text item. ; ; Change some values of previous text item to create a new label for ; the right Y axis. ; setvalues txid "txPosXF" : 0.9 ; X pos. of text (use same Y position as before) "txAngleF" : -90.0 ; Rotate the text 90 deg. clockwise "txString" : "Pressure (mb)" end setvalues draw(txid) ; Draw the text item. frame(wid) ; Advance the frame end