Return to Ferret FAQ

2D log plots


How can I generate a 2D log (or log-log) plot?


[Output Graphic]


The PlotPlus LOG axis transforms (PPL AXTYPE) are not applicable to the 2D plots (CONTOUR,VECTOR,SHADE, and FILL). Do NOT do this:
yes? ppl axtype 1,2    ! WRONG
yes? contour my_data   ! WRONG
Instead, define a new axis with the LOG transform of the X coordinates.


The figure above was created with:
set win/size=.4/aspect=1.2
define view/x=0:1/y=0.6:1.0 top
define view/x=0:1/y=0.3:0.7 mid
define view/x=0:1/y=0.0:0.4 bot

! suppose you have some data on a grid x=1:100:1, y=1:100:1
define axis/x=1:100:1 xax
define axis/y=1:100:1 yax
let/title="test data" a = LOG(x[gx=xax]/8)+y[gy=yax]/100    ! some made up data

set view top

! plot untransformed data
contour/set a
go remove_logo
ppl contour

! define a new axis with the LOG transform of the X coordinates
define axis/from/name=xlog/x LOG(x[gx=xax])

! plot LOG-transformed data in the upper plot
! NOTE: X axis labels will be LOG values rather than exponents
set view mid
contour/set a[gx=xlog@asn]
go remove_logo
ppl contour

! *** here's how to do a nicely labeled plot *** ... in the lower plot
set view bot

! base plot with large tics, only, unlabelled
contour/set/xlimits=0:2:1/title="New tic marks" a[gx=xlog@asn]
ppl axlabp 0
go remove_logo
ppl contour

! add 2 decades of minor tics
repeat/j=1:2:1 (repeat/i=1:10:1 ppl aline 1,`LOG(i)+j-1`,0,`LOG(i)+j-1`,-4)

! label the major tics with powers of 10
repeat/j=1:3:1 label `j-1`,-13,0,0,.1 "@SR10^`j-1`"

! label 2,3,5 of the minor tics
repeat/j=1:2:1 label `LOG(2)+j-1`,-10,0,0,.08 "@SR2"
repeat/j=1:2:1 label `LOG(3)+j-1`,-10,0,0,.08 "@SR3"
repeat/j=1:2:1 label `LOG(5)+j-1`,-10,0,0,.08 "@SR5"

Last modified: Aug 5, 1999