Heres a procedure for creating image overlaid with plot area
and a color bar based on data.
1) Note if a image s placed after the plot it will erase
the plot. Therefore place image first and then the plot(axes).
2)If a window device is used (non strechable/scalable) pixels
the image has to be first resized to size require. I've defined
the size required in normal coordinates
3) Windows does not allow values more than 234 0-234 color. Hence the
scaling of the image to a top value of 234.
Hope this helps
barr-kum
-=======================
pro mak_plot, filename, x1,y1,x2,y2
; A procedure to resize a image to specified size x1, y1..
; in normal coordinates and put a plot around it
; and a color bar
pict=bytarr(26,14) ; array to hold the image
openr, unit1, filename, /get_lun
; Read the array
readu,unit1, pict
close, unit1 & free_lun, unit1
tmin=min(pict)
tmax=max(pict)
arr_size=convert_coord(x2-x1,y2-y1,/Normal, /To_device)
if arr_size(0) gt 1000.0 then arr_size(0)=26.0 * 50.0 ; this in case postscript
if arr_size(1) gt 700.0 then arr_size(1)=14.0 * 20.0 ; which will give really large sizes
img=congrid(pict,arr_size(0),arr_size(1))
tv, bytscl(img, tmin, tmax, top=255),x1, y1, /Normal, $
xsize = x2-x1, ysize = y2-y1
;Plot lat long grid and Manus coast line
plot,[140.5, 164.5], [-5.5,6.5], /Nodata, Xrange=[140.5, 164.5],YRange = [-5.5,6.5], $
/NOERASE, Linestyle=0, thick =3, XStyle=1 , Ystyle=1, color=backcolor, $
position=[x1,y1,x2,y2], charsize=0.6
;Place color bar
x1=x2+0.07 & y1=y1
x2=x2+0.14 & y2=y2
x = findgen(255) ; was 246
colour_bar=intarr(2,255)
colour_bar(0,0:*)=x
colour_bar(1,0:*)=x
arr_size=convert_coord(x2-x1,y2-y1,/Normal, /To_device)
if arr_size(0) gt 1000.0 then arr_size(0)=24.0 * 20.0
if arr_size(1) gt 700.0 then arr_size(1)=12.0 * 20.0
colour_bar=congrid(colour_bar,arr_size(0),arr_size(1))
tv, bytscl(color_bar, tmin, tmax, top=255), x1, y1, /Normal, xsize = x2-x1, ysize = y2-y1
plot,[0.0,1.0], [tmin, tmax], /Nodata, Xrange=[0.0,1.0],YRange = [tmin, tmax], $
/NOERASE, Linestyle=0, thick=3, XStyle=1, Ystyle=1, color=backcolor, $
position=[x1,y1,x2,y2], xticks=1, xcharsize=.001, YTitle=bar_YTitle, $
charsize=0.8
end
--
____________________________________________________________ ________
| Sereno A. Barr-Kumarakulasinghe | sbarrkum@ic.sunysb.edu |
| Marine Sciences Research Center | |
| State University of New York | |
| Stony Brook, NY 11794-5000 | |
|___________________________________________________________ ________ |
|