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

Home » Public Forums » archive » seeing red (in postscript output)
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
seeing red (in postscript output) [message #24216] Wed, 14 March 2001 17:22
Richard French is currently offline  Richard French
Messages: 173
Registered: December 2000
Senior Member
I'm posting this for my brother - trying to maintain inter-family
harmony here. it's an IDL routine that creates
a PostScript file containing a TV image and an overplotted
set of axes. The problem is that the output has an extra column
of pixels - all red, in this case - that extend outside of the plot
boundary. I know that there are other ways to do what is
being done here, but my immediate question is:

Is there an easy way to modify THIS code so that the
extra column of pixels is not present?

Thanks for any tips!
Dick French

;demonstrate problem with tv

;define image array
pixels = 23L
lines = 7L
demo_image = bindgen(pixels,lines)


;set up postscript page size and offsets
pgxsz = 6.0
pgysz = 9.0
pgxoff = 1.0
pgyoff = 1.0

;set image x size, compute y size via aspect ratio
ximgsz = 5.0
aspect = float(pixels)/float(lines)

;get bounds of image in inches
yimgsz = ximgsz/aspect
xposl = 0.0
xposr = xposl+ximgsz
yposb = 0.0
ypost = yposb+yimgsz

;compute normalized coordinates of image bounds and use these for plot
overlay
xposln = xposl/pgxsz
xposrn = xposr/pgxsz
yposbn = yposb/pgysz
ypostn = ypost/pgysz

;define coordinate system of plot
;using 'origin' as lower left corner
utme_rng = [575000.0,603008.0]/1000.0
utmn_rng = [3929996.0,3938000.0]/1000.0 ;coords in km

;compute the physical pixel size
pixdim = (utme_rng[1]-utme_rng[0])/float(pixels)

;set up postscript device
pfil = 'demoproblem.ps'
set_plot,'ps'
device,/portrait,file=pfil,/inches,xsize=pgxsz,ysize=pgysz,x offset=xoff,yoffset=yoff,/COLOR

;load a color table
loadct,13 ;rainbow colors

;check image dimensions before tv
szimagebefore = size(demo_image)

;display the image
tv,demo_image,xposl,yposb,/inches,xsize=ximgsz,ysize=yimgsz

;check image dimensions after tv
szimageafter = size(demo_image)

;print the image sizes
; they will be the same!
print,'szimagebefore ',szimagebefore
print,'szimageafter ',szimageafter

;plot the coordinate axes
plot,utme_rng,utmn_rng,/nodata,title='Demo Image Display Problem',$
xtitle='UTME14 (km)',ytitle='UTMN14 (km)',/noerase,$
xstyle=1,ystyle=1,position=[xposln,yposbn,xposrn,ypostn],/no rmal

;number the columns starting with zero
;
lblposy = utmn_rng[0]+((lines-2)+0.5)*pixdim

for pct = 0,pixels-1 do begin
lblposx = utme_rng[0]+(pct+0.0)*pixdim
colnumstr = string(pct,format='(i2)')
xyouts,lblposx,lblposy,colnumstr,color=1
endfor

;close the ps device
device,/close

end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL i/o on G4
Next Topic: Re: seeing red (in postscript output)

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

Current Time: Wed Oct 08 18:53:10 PDT 2025

Total time taken to generate the page: 0.00475 seconds