comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » colorbar positioning in postscript
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
colorbar positioning in postscript [message #51335] Mon, 13 November 2006 06:29
jesscobrien is currently offline  jesscobrien
Messages: 6
Registered: August 2006
Junior Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Random selection of pairs
Next Topic: Mac Cursor

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:47:22 PDT 2025

Total time taken to generate the page: 0.00464 seconds