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 "vpXF" : 0.20 ; Change the size and location of "vpYF" : 0.80 ; the XY plot in the viewport. "vpWidthF" : 0.60 "vpHeightF" : 0.60 "xyCoordData" : dataid "trYMinF" : min(y) ; Make sure the min/max of our Y axis "trYMaxF" : max(y) ; is the same as our data. "tmYROn" : False ; Turn off right Y axis tick marks. end create draw(plotid) ; Draw the XY plot. tmid = create "tickmarks" tickMarkClass wid "vpXF" : 0.20 ; Use the same size and location that "vpYF" : 0.80 ; was used for the XY plot. "vpWidthF" : 0.60 "vpHeightF" : 0.60 "tmXBDataLeftF" : 0.0 ; Set the min and max of "tmXBDataRightF" : dimsizes(y) -1 ; the bottom X axis. "tmYLDataBottomF" : max(pressure) ; Set the min and max of "tmYLDataTopF" : min(pressure) ; the left Y axis. "tmYLStyle" : "Irregular" ; Indicate that the left Y "tmYLIrregularPoints" : pressure ; axis values are irregular. ; By default, since we are ; defining the left axis, we are ; also defining the right axis. "tmXBOn" : False ; Turn off the bottom, top, and "tmXTOn" : False ; left tick marks and labels. "tmYLOn" : False "tmXBLabelsOn" : False "tmYLLabelsOn" : False "tmYRLabelsOn" : True ; Turn on the right y axis labels. "tmYLMode" : "Explicit" ; Explicitly define where we want "tmYLValues" : pressure ; tick marks and what labels we want "tmYLLabels" : pressure ; at them. end create draw(tmid) ; Draw the tick mark object. ; ; 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