if (plottype eq 'ps') then begin

	;set up for landscape Postscript plotting
	set_plot, 'ps'
	!p.font=-1
	device, filename= psfile, /landscape
	fsub = psfile               ;filename to be written at bottom of plot
	!x.minor = 10
	!y.minor = 10
	!y.margin=[6,2]
	!x.margin=[14,4]

	; set line and text characteristics for publication quality
	!P.CHARSIZE=1.2
	!P.CHARTHICK=4.
	!X.THICK=8.
	!Y.THICK=8.
	!P.THICK=8.
	!P.MULTI=0
	!P.TICKLEN=0.03
	symsize=1.5
	filenamecharsize=1.1

endif

if (plottype eq 'jpg') then begin
	;set up to plot to memory buffer.  This plot will later be written from memory to a JPEG file.
	set_plot, 'z'
	device, set_resolution=[8000,6000]
	device, set_font='Courier'
	fsub = jpgfile			  ;filename to be written at bottom of plot

	;set plot margin & tick marks
	!Y.MINOR=10
	!x.minor=10
	!y.margin=[6,4]
	!x.margin=[14,4]

	; set line and text characteristics for publication quality
	!P.CHARSIZE=10
	!P.CHARTHICK=15.
	!X.THICK=20.
	!Y.THICK=20.
	!P.THICK=20.
	symsize=10.
	filenamecharsize=8.

endif

; make plot axes
plot,[0],[0],/nodata,xrange=[xlo,xhi],xstyle=1,ystyle=1, $
	xtitle='Time (hours)',ytitle='Dark Current (ADU/s)', title='Dark Current for '+scaname, $
	color=black, background=white,charsize=!P.CHARSIZE*1.4,/ylog,yrange=[1e-4,(1 > (ymax*2))]			; ,yrange=[ylo,yhi]

; add line through zero
oplot,[!X.CRANGE(0),!X.CRANGE(1)],[0,0],linestyle=0,color=black




; write JPG image file
if (plotcount eq 1) then begin
	xyouts, 1.0, 0.0, '_', /device
	jpgimg = tvrd()
	write_jpeg, jpgfile, congrid(jpgimg, 1600, 1200, /interp, /center), quality=100
endif

device, /close
