Return to Ferret FAQ


Values associated with pixels


Question:

Is there any way to plot the value of each pixel on the plot?

Example:

[Output Graphic]

 

Explanation:

Actually, there's two different ways to get values associated with pixels.

Solution:

! etopo5 is a 5 minute bathymetry
use etopo5

! a region of the Indonesian through flow
set region/x=118:120/y=-6:-4

! I could use the repeat command with /x= and /y= but then
! Ferret would be interpolating so I'd like to find out what
! indices are associated with the region of interest. Then
! the plotted values will lie on top of the grid cells. Here's
! an easy way to get a listing of indices and values in the
! region of interest. The output will be
!
! world_coordinate / index: value
let xi= x[g=rose]
let yj = y[g=rose]
list xi
list yj

! a nice palette and levels for bathymetries
palette dark_land_sea
shade/lev=(-10500,-5500,5000)(-5500,0,500)(0,2000,250)(2000,6000,1000)
rose

! Now use a nested repeat with the indices we just obtained.
! By default, the Label command places labels at world coordinate
! positions. The back tics force x[g=rose] and y[g=rose] be
! evaluated before they are passed to the label command. In
! the context of the REPEAT loop, `rose` will be evaluated at
! each I and J position and this number will be passed to the
! label command as a string.
repeat/i=1180:1196:1 (repeat/j=1010:1022:1 label `x[g=rose]` `y[g=rose]` 0 0 .06 "`rose`")


Last modified: Thu Apr 27 2000