[Thread Prev][Thread Next][Index]
Re: [ferret_users] tickmark
Hi Baris,
I'm sure that there might be a simpler way, but I have a script (below) that adds a given y-axis label for when I make log pressure plots. For example, I might want to make a "500" hPa tic mark at the ln(500) position, or I might want a to label the 10hPa position (at the top of the yaxis) as "hPa".
You should be able to edit it to do what you want….as well as hack it a bit more to do the x-axis labels. It works by drawing a line ("ppl aline") and then adding the label (with the "label" command). The positions on the plots are all taken from the ferret-defined symbols (e.g. ($ppl$xmin) etc). The label should be centered over the tic mark.
Finally, if you want a inward facing tic mark just give a negative value for the length parameter.
Hope it helps,
Paul
\cancel mode verify
!
! Description: Label specific point on logp axis
!
! logp_label_missing.jnl
!
! PURPOSE:
! Control labelling for z axis on log P type plot. Use in conjunction
! with logp_plot.jnl.
!
! ARGUMENTS:
! $1 val to label (e.g. 1000 hPa). Defines position.
! $2 size for z axis labels (e.g. 0.11)
! $3 xmin, left hand point on x-axis (default is $ppl$xmin)
! $4 xmax, right hand point on x-axis (default is $ppl$xmax)
! $5 Show numeric label (default is 1)
! $6 Tic length (default is 4)
! $7 Alternative label for the tic mark (instead of $1)
! $8 label right hand axis instead of left?
!
! HISTORY:
! 16-SEP-2011 Added "lpl" to internal variables (and cancelled them
! at the end) to avoid possible conflicts. PY
! 23-MAR-2011 1. Added correct placement of tic labels (centered
! vertically)
! 2. Added argument $7. PY
! 22-MAR-2011 Added fix to deal with negative tic lengths (i.e.
! inward pointing tics). PY
! 15-MAR-2011 Added arg #6, PY
! 01-NOV-2010 Added arg #5. PY
! 08-Jan-2009 Separated out from Glenn's plot_lnp.jnl. PY
!! INPUT PARAMETERS
!!
let/quiet lpl_val = $1 !Pressure value
let/quiet lpl_size = $2 !Label text size
let/quiet lpl_xmin = $3#($ppl$xmin)# !Tic start (LH axis)
let/quiet lpl_xmax = $4#($ppl$xmax)# !Tic start (RH axis)
let/quiet lpl_showLab = $5#1# !Display label?
let/quiet lpl_ticLen = $6#4# !Tic length
![See below for $7]
let/quiet lpl_labRight = $8#0# !Lab RH axis?
!! CALCULATE TIC POSITIONS
!!
let/quiet lpl_len_left = `lpl_xmin`-`lpl_ticLen` !tic mark lengths
let/quiet lpl_len_right = `lpl_xmax`+`lpl_ticLen`
!! DRAW TIC MARKS
!!
let/quiet lpl_logval = `ln(lpl_val)`
ppl aline 1,`lpl_xmin`,`lpl_logval`,`lpl_len_left`,`lpl_logval`
ppl aline 1,`lpl_xmax`,`lpl_logval`,`lpl_len_right`,`lpl_logval`
!! TIC LABEL JUSTIFICATION
!!
if `lpl_labRight` then
let/quiet lpl_justify = -1
let/quiet lpl_lab_pos = if (`lpl_ticLen` lt 0) then (`lpl_xmax`+0.5*abs(`lpl_ticLen`)) else (`lpl_xmax`+`lpl_ticLen`-0.2*`lpl_ticLen`)
else
let/quiet lpl_justify = 1
let/quiet lpl_lab_pos = if (`lpl_ticLen` lt 0) then (`lpl_xmin`-0.5*abs(`lpl_ticLen`)) else (`lpl_xmin`-`lpl_ticLen`-0.2*`lpl_ticLen`)
endif
!! TIC LABEL POSITION
!!
let lpl_yRange = `($yaxis_max)` - `($yaxis_min)` !Y-range (data units)
let lpl_posFactor = `($ppl$ylen)`/`lpl_yRange` !axis length (inches) / range (data)
let lpl_ticPos = (`($yaxis_max)`-`lpl_logval`)*`lpl_posFactor` !tic position (inches)
let lpl_txtPos1 = `lpl_ticPos` - `0.5*lpl_size` !Txt pos (inches)
let lpl_txtPos = `($yaxis_max)` - (`lpl_txtPos1`/`lpl_posFactor`) !Txt pos (data)
!! ADD TIC LABELS
!!
if `lpl_showLab` then
label `lpl_lab_pos`, `lpl_txtPos`, `lpl_justify`, 0, `lpl_size`, $7#"`lpl_val`"#
endif
cancel variable lpl_* ! clean up local variables
set mode/last verify
On 13 Aug 2014, at 09:52, baris onol <onolba@xxxxxxxxxx>
wrote:
> Hi there,
> How can I put the tickmarks for irregular increment along the x-axis or
> y-axis?
> I would like to put tickmarks for points like {31,62,180,221} over the
> xaxis.
> I've already tried ppl options but I couldn't make it.
>
> Thanks
>
> Baris
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement