I had been told that the correct way to plot an image in colour or
grayscale in an axis frame (with or without overplotted a contour) was :
; set up ps device
;
device,yoffset=3,ysize=16,xsize=16.9443
!p.font=0
device,/helvetica,font_size=12
device,bits_per_pixel=8
device,/color
; plot axes to set window
plot,a.data(0:255,1),xrange=[1,256],yrange=[1,256],/nodata,c olor=1
; scale image and set 0 to white
c=bytscl(a.data,min=0.90,max=1.11)
c(where(c eq 0b))=255B
; plot image
tv,c,!x.window(0),!y.window(0),xsize=!x.window(1)-!x.window( 0),ysize=!y.window(1)-!y.window(0),/norm
; replot axes
plot,a.data(0:255,1),xrange=[1,256],yrange=[1,256],/nodata,/ noerase,color=1
and this apparently works OK.
The trick is the use of the !x.window keys
Now what I want to do is to plot a colour bar with the indication of the
levels in some part of the frame. To do this I thought to do :
; construct the color bar as a small rectangular image
;
y=findgen(210)
y=0.90+y*0.001
z=fltarr(210,20)
for i=0,19 do z(0:209,i)=y
;
; apply the same scaling as for the main image
c=bytscl(z,min=0.90,max=1.11)
c(where(c eq 0b))=255B
tv,c,20,220,xsize=100,ysize=20,/data <-------
;
; annotate with the levels
device,/helvetica,font_size=5
for i=0,209,20 do xyouts,20+100*float(i)/210.,240,string(y(i),format='(F4.2)')
for i=0,209,20 do oplot,[20+100*float(i)/210.,20+100*float(i)/210.],[235,239]
I'd expect this (in my frame 0:256 0:256) to plot a colour bar in the
rectangle (20:120 220:240), and annotate it with 11 tics from 0.90 to 1.10.
The point is that the width and size of the colour bar are not what I
expect (I've used /DATA coordinates in the TV statement)
I've then played interactively using a Postscript previewer, and I found
that I could (BUT I DO NOT UNDERSTAND WHY) fix the width of the bar applying
a fudge factor :
tv,c,20,220,xsize=0.82*100,ysize=0.82*100*20./210.,/data
So I inserted that in my code and tried again but ... in the final plot
the colour bar came out of the wrong size.
It looks like there is an interference between the size of the font I use
and the size of the color bar ....
In summary :
device,/helvetica,font_size=12
plot axes
tv main image
replot axes
tv colour bar with fudge
device,/helvetica,font_size=5
annotate tics
IS WRONG
device,/helvetica,font_size=5 SIC !
plot axes
tv main image
replot axes
tv colour bar with fudge
device,/helvetica,font_size=5
annotate tics
IS CORRECT (BUT NOT WHAT I WANT !)
device,/helvetica,font_size=5
plot axes
tv main image
tv colour bar with fudge
device,/helvetica,font_size=5
annotate tics
device,/helvetica,font_size=12
replot axes
GIVES THE CORRECT COLOUR BAR BUT THE AXES ARE REPLOTTED WRONG
Now I'd try to play around always with /NORM coordinates, but I'd appreciate
if somebody could explain the interference between TV, axis setting and font
setting ....
------------------------------------------------------------ ----------------
A member of G.ASS : Group for Astronomical Software Support
------------------------------------------------------------ ----------------
Lucio Chiappetti - IFCTR/CNR | Ma te' vugl' da' quost avis a ti' Orsign
via Bassini 15 - I-20133 Milano | Buttet rabios intant te se' pisnign
Internet: LUCIO@IFCTR.MI.CNR.IT |
Decnet: IFCTR::LUCIO | (Rabisch, II 46, 119-120)
------------------------------------------------------------ ----------------
|