I am using David Fannings colorbar routine to place a colorbar on the
RHS of my image which I want to write to postscript. Positioning both
image and colorbar in normalised coords (using tvimage for the image).
Thanks David for the great routines tvimage and colorbar. When writing
to PS device, I am scaling the positions from normalised coords to the
size of the PS image, but this is causing a call to axis in colorbar
to crash with:
% AXIS: Data coordinate system not established.
% Error occurred at: COLORBAR 353
/usr/local/rsi/add-ons/fanning/colorbar.pro
Can someone point out where I went wrong? Relevant code below.
Thanks,
Jess
set_plot,'PS'
postfile = dir + slash + 'disk_centroids_' + $
string(f='(i2.2)',loop_no) + '.ps'
xsize = 4.0 & ysize = 4.5
device,file=postfile,xsize=xsize,ysize=ysize,$
/inch, /color, bits_per_pixel=8
; Define positions of image and colorbar
pos_image = [0.15,0.15,0.75,0.95]
pos_bar = [0.75,0.15,0.85,0.95]
IF !d.name EQ 'PS' THEN BEGIN
pos_image = [pos_image[0]*xsize,pos_image[1]*ysize,$
pos_image[2]*xsize,pos_image[3]*ysize]
pos_bar = [pos_bar[0]*xsize,pos_bar[1]*ysize,$
pos_bar[2]*xsize,pos_bar[3]*ysize]
ENDIF
col_disk = 39
loadct,col_disk,ncolors=ncol
; Image
tvimage,disk_scl[xrange[0]:xrange[1],yrange[0]:yrange[1]],$
position=pos_image,/KEEP_ASPECT_RATIO ; D.Fanning
; Axes
CONTOUR,disk_scl[xrange[0]:xrange[1],yrange[0]:yrange[1]],$
X[xrange[0]:xrange[1]],Y[yrange[0]:yrange[1]],$
position=pos_image,color=lab_col,$
/noerase,/nodata, $
XSTYLE=1,YSTYLE=1,$
XRANGE=[xmin,xmax],YRANGE=[ymin,ymax]
; Colorbar on RHS
colorbar,color=lab_col,$
position=pos_bar,$
vertical=1,right=1,$
bottom=lowest_col_incl,ncolors=ncol_incl,$
maxrange=maxdata,minrange=mindata,format='(f4.1)' ; D.Fanning
device, /close
set_plot,'X'
device,decomposed=0
|