FUNCTION plot_timeseries, Xvar, Yvar, $
TSTART=TSTART,TSTOP=TSTOP,ELEMENTS=ELEMENTS,$
POSITION=POSITION,PANEL_HEIGHT=PANEL_HEIGHT,$
FIRSTPLOT=FIRSTPLOT,LASTPLOT=LASTPLOT,$
CDAWEB=CDAWEB,GIF=GIF,NOSUBTITLE=NOSUBTITLE,$
XSIZE=XSIZE,YSIZE=YSIZE, ONLYLABEL=ONLYLABEL,$
AUTO=AUTO,NOGAPS=NOGAPS,NOVALIDS,$
err_plus=err_plus,err_minus=err_minus, $
IGNORE_DISPLAY_TYPE=IGNORE_DISPLAY_TYPE,$
NONOISE=NONOISE,DEBUG=DEBUG,REPORT=REPORT,$
SCATTER=SCATTER,COMBINE=COMBINE,_EXTRA=EXTRAS
compile_opt idl2
status = 0
if keyword_set(SCATTER) then psym = 3 else psym = 0
if keyword_set(REPORT) then begin & reportflag=1L
a=size(REPORT) & if (a[n_elements(a)-2] eq 7) then $
OPENW,1,REPORT,132,WIDTH=132
endif else reportflag=0L
if (n_params() ne 2) then begin
print,'ERROR=Missing parameter to plot_timeseries function' & return,-1
endif
a = size(Xvar)
if (a[n_elements(a)-2] ne 8) then begin
print,'ERROR=1st parameter to plot_timeseries not a structure' & return,-1
endif else begin
a = tagindex('DAT',tag_names(Xvar))
if (a[0] ne -1) then times = Xvar.DAT $
else begin
a = tagindex('HANDLE',tag_names(Xvar))
if (a[0] ne -1) then handle_value,Xvar.HANDLE,times $
else begin
print,'ERROR=1st parameter does not have DAT or HANDLE tag' & return,-1
endelse
b = size(times)
if ((b[n_elements(b)-2] eq 5) or (b[n_elements(b)-2] eq 9) or $
(b[n_elements(b)-2] eq 14)) then begin
endif else begin
print,'ERROR=1st parameter datatype not a CDF TIME related type' & return,-1
endelse
endelse
endelse
tszck=size(times)
if(tszck[tszck[0]+2] ne 1) then $
times = reform(times)
a = size(Yvar)
if (a[n_elements(a)-2] ne 8) then begin
print,'ERROR=2nd parameter to plot_timeseries not a structure' & return,-1
endif else begin
YTAGS = tag_names(Yvar)
a = tagindex('DAT',YTAGS)
if (a[0] ne -1) then THEDATA = Yvar.DAT $
else begin
a = tagindex('HANDLE',YTAGS)
if (a[0] ne -1) then handle_value,Yvar.HANDLE,THEDATA $
else begin
print,'ERROR=2nd parameter does not have DAT or HANDLE tag' & return,-1
endelse
endelse
endelse
szck=size(thedata)
if(szck[szck[0]+2] ne 1) then $
thedata = reform(thedata)
a = size(thedata) & b = a[n_elements(a)-2] & thedata_size = a
if ((b eq 0) OR (b gt 6 and b lt 12)) then begin
print,'STATUS=datatype indicates that data is not plottable' & return,-1
endif else begin
case a[0] of
0 : begin
thedata=[thedata,thedata]
a = size(thedata)
b = a[n_elements(a)-2] & thedata_size = a
times=[times,times]
psym=4
symsize=2
print,'STATUS: Found one single point.....'
num_panels = 1L & elist=0
end
1 : begin
num_panels = 1L & elist=0
if (n_elements(thedata) ne n_elements(times)) then begin
print,'STATUS=Re-select longer time interval; one value found for ',Yvar.varname,' and not plottable.'
endif
end
2 : begin
elist=indgen(a[1])
if (n_elements(ELEMENTS) gt 0) then elist = ELEMENTS $
else begin
if NOT keyword_set(IGNORE_DISPLAY_TYPE) then begin
b = tagindex('DISPLAY_TYPE',YTAGS)
if (b[0] ne -1) then begin
c = strupcase(Yvar.(b[0])) & c = break_mystring(c,delimiter='>')
if ((c[0] eq 'TIME_SERIES')AND(n_elements(c) gt 1)) then begin
d = break_mystring(c[1],delimiter=',')
elist = long(d) & elist = elist -1
endif
endif
endif
endelse
end
else: begin
print,'ERROR=Cannot plot data with > 2 dimensions' & return,-1
end
endcase
endelse
num_panels = n_elements(elist)
nogood_counter = num_panels
tbegin = times[0] & tend = times[n_elements(times)-1]
if keyword_set(TSTART) then begin
tbegin = TSTART & tbegin16 = TSTART & tbegintt = TSTART & a = size(TSTART)
if (a[n_elements(a)-2] eq 7) then begin
split_ep=strsplit(TSTART,'.',/extract)
tbegin = encode_CDFEPOCH(TSTART)
tbegin16 = encode_CDFEPOCH(TSTART,/EPOCH16,msec=split_ep[1])
tbegintt = encode_cdfepoch(TSTART, /TT2000, MSEC=split_ep[1])
endif
endif
if keyword_set(TSTOP) then begin
tend = TSTOP & tend16 = TSTOP & tendtt = TSTOP & a = size(TSTOP)
if (a[n_elements(a)-2] eq 7) then begin
split_ep=strsplit(TSTOP,'.',/extract)
tend = encode_CDFEPOCH(TSTOP)
tend16 = encode_CDFEPOCH(TSTOP,/EPOCH16,msec=split_ep[1])
tendtt = encode_cdfepoch(TSTOP, /TT2000, MSEC=split_ep[1])
endif
endif
pad_front = 0L & pad_end = 0L
ep16 = 0 & eptt=0
if (size(times[0],/tname) eq 'DCOMPLEX')then begin
ep16 = 1
tend = tend16
tbegin = tbegin16
endif
if (size(times[0],/tname) eq 'LONG64')then begin
eptt = 1
tend = tendtt
tbegin = tbegintt
endif
if (!version.release ge '6.2' and (ep16 or eptt)) then begin
if (cdf_epoch_compare(times[0], tbegin)) then begin
if keyword_set(DEBUG) then print,'Padding front of times...'
times = [tbegin,times] & pad_front = 1L
endif
if (cdf_epoch_compare(tend, times[n_elements(times)-1])) then begin
if keyword_set(DEBUG) then print,'Padding end of times...'
times = [times,tend] & pad_end = 1L
endif
endif else begin
print, 'tbegin, times0 timesN= ',tbegin, times[0], times[n_elements(times)-1]
print, 'size of times ',n_elements(times)
if (tbegin lt times[0]) then begin
if keyword_set(DEBUG) then print,'Padding front of times...'
times = [tbegin,times] & pad_front = 1L
endif
if (tend gt times[n_elements(times)-1]) then begin
if keyword_set(DEBUG) then print,'Padding end of times...'
times = [times,tend] & pad_end = 1L
endif
endelse
rbegin = 0L & w = where((cdf_epoch_compare(times, tbegin) ge 0), wc)
if (wc gt 0) then rbegin = w[0]
rend = n_elements(times)-1 & w = where((cdf_epoch_compare(times, tend) le 0),wc)
if (wc gt 0) then rend = w[n_elements(w)-1]
if (rbegin ge rend) then begin
print, 'rbegin and end = ', rbegin, rend
print,'STATUS=No data within specified time range.'
endif
if not (keyword_set(nosubtitle)) then begin
if (not eptt) then begin
CDF_EPOCH,tbegin,byear,bmonth,bday,hour,minute,second,milli,/BREAK
CDF_EPOCH,tend,eyear,emonth,eday,hour,minute,second,milli,/BREAK
endif else begin
CDF_EPOCH,tbegin,byear,bmonth,bday,hour,minute,second,milli,/TOINTEGER,/BREAK
CDF_EPOCH,tend,eyear,emonth,eday,hour,minute,second,milli,/TOINTEGER,/BREAK
endelse
ical,byear,doy,bmonth,bday,/idoy
subtitle = 'TIME RANGE='+strtrim(string(byear),2)+'/'+strtrim(string(bmonth),2)
subtitle = subtitle + '/' + strtrim(string(bday),2)
subtitle = subtitle + ' (' + strtrim(string(doy),2) + ') to '
ical,eyear,doy,emonth,eday,/idoy
subtitle = subtitle + strtrim(string(eyear),2)+'/'+strtrim(string(emonth),2)
subtitle = subtitle + '/' + strtrim(string(eday),2)
subtitle = subtitle + ' (' + strtrim(string(doy),2) + ')'
endif else subtitle=''
if (not eptt) then begin
CDF_EPOCH,tbegin,year,month,day,hour,minute,second,milli,/BREAK
CDF_EPOCH,a,year,month,day,0,0,0,0,/COMPUTE_EPOCH
endif else begin
CDF_EPOCH,tbegin,year,month,day,hour,minute,second,milli,/BREAK, /TOINTEGER
CDF_EPOCH,a,year,month,day,0,0,0,0,/COMPUTE,/TT2000
endelse
if (ep16)then begin
CDF_EPOCH16,b,year,month,day,0,0,0,0,0,0,0,/COMPUTE_EPOCH
if keyword_set(DEBUG) then tatime = systime(1)
ep_diff = cdf_epoch_diff (times, b, /micro_seconds)
temp2 = ep_diff/1000000.d0
if keyword_set(DEBUG) then print, 'Took ',systime(1)-tatime, ' seconds to compute time difference WITH NEW cdf_epoch_diff'
times = temp2
endif else if (eptt) then begin
times = (times - a) / 1000000000.d0
endif else begin
times = (times - a) / 1000.d0
endelse
julday = ymd2jd(year,month,day)
xranger = dblarr(2)
if (ep16 or eptt) then begin
xranger[0] = times[0]
xranger[1] = times[n_elements(times)-1]
print, 'times[0] =',times[0]
endif else begin
xranger[0] = (tbegin-a)/1000
if ((tbegin-a) eq 0 and (n_elements(times) le 50)) then xranger[0] = times[1]
xranger[1] = (tend-a)/1000
endelse
trange = xranger[1] - xranger[0]
print, 'time range = ',trange
if (trange gt 0.0 and trange lt 1.0) then tform='h$:m$:s$.f$@y$ n$ d$' $
else tform='h$:m$:s$@y$ n$ d$'
new_window = 1L
if keyword_set(POSITION) then begin
a = size(POSITION) & b = n_elements(a)
if ((a[b-1] ne 4)OR(a[b-2] ne 3)) then begin
print,'ERROR=Invalid value for POSITION keyword' & return,-1
endif
if keyword_set(PANEL_HEIGHT) then begin
a = size(PANEL_HEIGHT) & b = n_elements(a)
if ((a[b-2] le 1)OR(a[b-2] gt 5)) then begin
print,'ERROR=Invalid value for PANEL_HEIGHT keyword' & return,-1
endif else psize = PANEL_HEIGHT
endif else begin
print,'ERROR=PANEL_HEIGHT keyword must be specified with POSITION keyword'
return,-1
endelse
if keyword_set(FIRSTPLOT) then clear_plot = 0L else clear_plot = 1L
new_window = 0L
endif
if (new_window eq 1) then begin
if keyword_set(GIF) then begin
xs = 640 & ys = 512 & psize = 100
if keyword_set(XSIZE) then xs = XSIZE
if keyword_set(YSIZE) then ys = YSIZE
if keyword_set(PANEL_HEIGHT) then begin
psize = PANEL_HEIGHT & ys = (psize * num_panels) + 100
endif else psize = ((ys-100) / num_panels)
endif else begin
a = lonarr(2) & DEVICE,GET_SCREEN_SIZE=a
xs = (a[0]*0.66) & ys = (a[1]*0.66)
if keyword_set(XSIZE) then xs = XSIZE
if keyword_set(YSIZE) then ys = YSIZE
if keyword_set(PANEL_HEIGHT) then begin
psize = PANEL_HEIGHT
ys = (psize * num_panels) + 100
if (ys gt a[1]) then begin
print,'ERROR=Computed window Ysize greater than device resolution'
return,-1
endif
endif else psize = ((ys-100) / num_panels)
endelse
if (psize lt 50) then begin
print,'ERROR=Insufficient resolution for a ',num_panels,' panel plot'
return,-1
endif
endif
if keyword_set(POSITION) then ppos = POSITION $
else begin
ppos = fltarr(4)
ppos[0] = 100
ppos[2] = (xs - 40)
ppos[1] = (ys - 30) - psize
ppos[3] = (ys - 30)
if keyword_set(CDAWEB) then ppos[2] = xs - 100
endelse
if (new_window eq 1) then begin
a = tagindex('SOURCE_NAME',YTAGS)
if (a[0] ne -1) then b = Yvar.SOURCE_NAME else b = ''
a = tagindex('DESCRIPTOR',YTAGS)
if (a[0] ne -1) then b = b + ' ' + Yvar.DESCRIPTOR
window_title = b
endif
if (new_window eq 1) then begin
if keyword_set(GIF) then begin
a = size(GIF) & if (a[n_elements(a)-2] ne 7) then GIF = 'idl.gif'
deviceopen,6,fileOutput=GIF,sizeWindow=[xs,ys]
endif else begin
window,/FREE,XSIZE=xs,YSIZE=ys,TITLE=window_title
clear_plot = 0L
endelse
endif
a = tagindex('FILLVAL',YTAGS)
Yfillval = 1.0e31
if (a[0] ne -1) then begin
if (Yvar.FILLVAL ne '') then Yfillval = Yvar.FILLVAL
endif
if keyword_set(err_plus) and keyword_set(err_minus) then begin
if (n_elements(err_plus) ne n_elements(thedata) or $
n_elements(err_minus) ne n_elements(thedata)) then begin
err_plus=0
err_minus=0
print,'Plot_timeseries: Could not plot error bars'
endif
endif
for i=0,num_panels-1 do begin
if (thedata_size[0] eq 1) then begin
mydata = thedata
if keyword_set (err_plus) then myerr_plus = err_plus
if keyword_set (err_minus) then myerr_minus = err_minus
endif else begin
mydata = thedata[(elist[i]),*]
if keyword_set (err_plus) then myerr_plus = err_plus[(elist[i]),*]
if keyword_set (err_minus) then myerr_minus = err_minus[(elist[i]),*]
endelse
mydata = reform(mydata)
if keyword_set (err_plus) then myerr_plus=reform(myerr_plus)
if keyword_set (err_minus) then myerr_minus=reform(myerr_minus)
if (pad_front) then begin
mydata = [Yfillval,mydata]
if keyword_set (err_plus) then myerr_plus=[myerr_plus[0],myerr_plus]
if keyword_set (err_minus) then myerr_minus=[myerr_minus[0],myerr_minus]
endif
if (pad_end) then begin
mydata = [mydata,Yfillval]
if keyword_set (err_plus) then myerr_plus=[myerr_plus,myerr_plus[n_elements(myerr_plus)-1]]
if keyword_set (err_minus) then myerr_minus=[myerr_minus,myerr_minus[n_elements(myerr_minus)-1]]
endif
rrend=n_elements(mydata)
nogood = 0
if(rrend lt rend) then rend = rrend-1
mydata = mydata[rbegin:rend]
if keyword_set (err_plus) then myerr_plus = myerr_plus[rbegin:rend]
if keyword_set (err_minus) then myerr_minus = myerr_minus[rbegin:rend]
mytimes = times[rbegin:rend]
w = where(mydata ne Yfillval,non_fillcount)
n_goodvals = 0
if (non_fillcount ne 0) then n = where(finite(mydata[w]) eq 1,n_goodvals)
if (non_fillcount ne 0 and n_goodvals gt 0) then begin
mydata = (mydata[w])[n] & mytimes = (mytimes[w])[n]
if keyword_set (err_plus) then myerr_plus=(myerr_plus[w])[n]
if keyword_set (err_minus) then myerr_minus=(myerr_minus[w])[n]
w=0
endif else begin
w=0
nogood = 1
nogood_counter = nogood_counter - 1
endelse
if ((NOT keyword_set(NOVALIDS))AND(non_fillcount gt 0)and $
(n_goodvals gt 0)) then begin
a = tagindex('VALIDMIN',YTAGS)
if (a[0] ne -1) then begin & b=size(Yvar.VALIDMIN)
if (b[0] eq 0) then Yvmin = Yvar.VALIDMIN $
else Yvmin = Yvar.VALIDMIN[elist[i]]
endif else Yvmin = 1.0e31
a = tagindex('VALIDMAX',YTAGS)
if (a[0] ne -1) then begin & b=size(Yvar.VALIDMAX)
if (b[0] eq 0) then Yvmax = Yvar.VALIDMAX $
else Yvmax = Yvar.VALIDMAX[elist[i]]
endif else Yvmax = 1.0e31
w = where(((mydata gt Yvmax)OR(mydata lt Yvmin)),wc)
if (wc gt 0) then begin
if keyword_set(DEBUG) then print,wc,' values outside VALIDMIN/MAX'
w = where(((mydata le Yvmax)AND(mydata ge Yvmin)),wb)
if (wb gt 0) then begin
mydata=mydata[w] & mytimes=mytimes[w]
if keyword_set (err_plus) then myerr_plus=myerr_plus[w]
if keyword_set (err_minus) then myerr_minus=myerr_minus[w]
endif else begin
a = tagindex('FIELDNAM',YTAGS)
if (a[0] ne -1) then ylabel = Yvar.(a[0])
print,'STATUS=No data for at least one component of ',ylabel,' variable.'
nogood = 1
nogood_counter = nogood_counter - 1
endelse
endif
endif
if (nogood and firstplot and (i eq 0)) then begin
plot,[0,1],[0,1],/nodata,ystyle=8+4,xstyle=8+4
endif
if (nogood eq 0) then begin
if keyword_set(NONOISE) then begin
sigminmax=three_sigma(mydata)
sigmin=sigminmax.(0)
sigmax=sigminmax.(1)
w = where(((mydata gt Sigmax)OR(mydata lt Sigmin)),wc)
if (wc gt 0) then begin
if keyword_set(DEBUG) then print,wc,' values outside 3-sigma...'
w = where(((mydata le Sigmax)AND(mydata ge Sigmin)),wb)
if (wb gt 0) then begin
mydata=mydata[w] & mytimes=mytimes[w]
if keyword_set (err_plus) then myerr_plus=myerr_plus[w]
if keyword_set (err_minus) then myerr_minus=myerr_minus[w]
endif
endif
endif
yscaletype = 0L
a = tagindex('SCALETYP',YTAGS)
if (a[0] ne -1) then begin
if (strupcase(Yvar.SCALETYP) eq 'LOG') then yscaletype = 1L
endif
if (yscaletype eq 1) then begin
wle = where(mydata le 0.0,wcle)
if (wcle gt 0) then begin
w = where(mydata gt 0.0,wc)
if (wc gt 0) then begin
wmin = min(mydata[w])
wmin = wmin/2
mydata[wle] = wmin
w = where(mydata gt 0.0,wc)
if (wc gt 0) then begin
if keyword_set (err_plus) then myerr_plus=myerr_plus[w]
if keyword_set (err_minus) then myerr_minus=myerr_minus[w]
endif
w=0
endif
endif
endif
goodvals = where(finite(mydata) eq 1, ngoodvals)
ymin = min(mydata[goodvals],MAX=ymax)
a = tagindex('SCALEMIN',YTAGS)
if (a[0] ne -1) then begin & b=size(Yvar.SCALEMIN)
if (b[0] eq 0) then ymin = Yvar.SCALEMIN $
else ymin = Yvar.SCALEMIN[elist[i]]
endif
a = tagindex('SCALEMAX',YTAGS)
if (a[0] ne -1) then begin & b=size(Yvar.SCALEMAX)
if (b[0] eq 0) then ymax = Yvar.SCALEMAX $
else ymax = Yvar.SCALEMAX[elist[i]]
endif
if (keyword_set(AUTO)) then begin
if (non_fillcount gt 0) then begin
ymax = 0.0
goodvals = where(finite(mydata) eq 1, ngoodvals)
ymin = min(mydata[goodvals],MAX=ymax)
endif
endif
if (ymax eq ymin) then begin
ymax = ymax + (ymax * .1)
ymin = ymin - (ymin * .1)
if ymax eq 0. and ymin eq 0. then begin
yscaletype=0
ymin=-.1 & ymax=.1
endif
endif
yranger=[ymin,ymax]
if (yscaletype ne 1) then begin
if keyword_set(err_minus) or keyword_set(err_plus) then $
print,'Adjusting ymin and ymax according to error bars...'
if keyword_set (err_minus) then begin
q=where(mydata eq ymin)
if q[0] ne -1 then yranger[0]= ymin-max(myerr_minus[q]) $
else yranger[0]= ymin
endif
if keyword_set (err_plus) then begin
q=where(mydata eq ymax)
if q[0] ne -1 then yranger[1] = ymax+max(myerr_plus[q]) $
else yranger[1] = ymax
endif
endif
if ((yscaletype eq 1)AND(yranger[0] le 0)) then yranger[0] = 0.00001
ylabel = '' & yunits = '' & yds = ''
if keyword_set(COMBINE) then begin
a = tagindex('LOGICAL_SOURCE',YTAGS)
if (a[0] ne -1) then yds = strupcase(Yvar.(a[0]))
endif
a = tagindex('AUGMENT_LABL',YTAGS)
if (a[0] ne -1) then begin
if (strupcase(yvar.(a[0])) eq 'TRUE') then begin
a = tagindex('VARNAME',YTAGS)
if (a[0] ne -1) then begin
if (n_elements(yds) gt 0) then yds = yds + Yvar.(a[0]) else $
yds = Yvar.(a[0])
endif
endif
endif
a = tagindex('FIELDNAM',YTAGS)
if (a[0] ne -1) then ylabel = Yvar.(a[0])
a = tagindex('LABLAXIS',YTAGS)
if (a[0] ne -1) then ylabel = Yvar.(a[0])
a = tagindex('LABL_PTR_1',YTAGS)
if (a[0] ne -1) then begin
if (Yvar.(a[0])[0] ne '') then ylabel = Yvar.(a[0])[elist[i]]
endif
a = tagindex('UNITS',YTAGS)
if (a[0] ne -1) then yunits = Yvar.(a[0])
a = tagindex('UNIT_PTR',YTAGS)
if (a[0] ne -1) then begin
if (n_elements(elist) le n_elements(Yvar.(a[0]))) then begin
if (Yvar.(a[0])[0] ne '') then begin
if (Yvar.(a[0])[elist[i]] ne '') then yunits = Yvar.(a[0])[elist[i]]
endif
endif
endif
coord=str_sep(yvar.varname,'_')
if (n_elements(coord) gt 1) and (coord[0] eq 'XYZ') then ylabel=ylabel+' ('+coord[1]+')'
if (n_elements(yds) gt 0) then begin
ylabel = yds + '!C' + ylabel + '!C' + yunits
endif else ylabel = ylabel + '!C' + yunits
ycsize = 1.0 & ylength = strlen(ylabel)
if ((!d.x_ch_size * ylength) gt psize) then begin
ratio = float(!d.x_ch_size * ylength) / float(psize)
ycsize = 1.0 - (ratio/8.0) + 0.1
endif
if keyword_set(NOGAPS) then datagaps = -1 else datagaps = find_gaps(mytimes)
if keyword_set(DEBUG) then begin
print,' Yscales=',yranger & print,' Yscaletype=',yscaletype
endif
if keyword_set(onlylabel) then begin
plot,mytimes,mydata,XSTYLE=4+1,ystyle=4+1,/NODATA,$
XRANGE=xranger,POSITION=ppos,/DEVICE,NOERASE=clear_plot
!y.crange[0]=!y.crange[1]
timeaxis_text,JD=julday,form=tform,/onlylabel
goto, skipped_graph
endif else begin
if (yscaletype) then begin
plot,mytimes,mydata,/NODATA,YTITLE=ylabel,YRANGE=yranger,YSTYLE=2+4,$
YLOG=yscaletype,XSTYLE=4+1,XRANGE=xranger,POSITION=ppos,/DEVICE,$
NOERASE=clear_plot,CHARSIZE=ycsize,_EXTRA=EXTRAS,ytick_get=yticks
if (wcle gt 0) then begin
mydata[wle] = yticks[0]
if keyword_set(DEBUG) then print,'Log scaling - reassigning values le 0 to ',yticks[0]
endif
if (n_elements(yticks) gt 0) then begin
yranger[0] = min(yticks)
yranger[1] = max(yticks)
endif
plot,mytimes,mydata,/NODATA,YTITLE=ylabel,YRANGE=yranger,YSTYLE=1,$
YLOG=yscaletype,XSTYLE=4+1,XRANGE=xranger,POSITION=ppos,/DEVICE,$
NOERASE=clear_plot,CHARSIZE=ycsize,_EXTRA=EXTRAS
endif else begin
if (abs(yranger[1]) gt 999 and abs(yranger[1]) lt 99999) then begin
plot,mytimes,mydata,/NODATA,YTITLE=ylabel,YRANGE=yranger,YSTYLE=2,$
YLOG=yscaletype,XSTYLE=4+1,ytickformat='(F11.1)',XRANGE=xranger,POSITION=ppos,/DEVICE,$
NOERASE=clear_plot,CHARSIZE=ycsize,_EXTRA=EXTRAS
endif else if ((abs(yranger[1]) lt 1.0) and (abs(yranger[0]) lt 1.0) and (psize ge 100 and psize lt 5000)) then begin
plot,mytimes,mydata,/NODATA,YTITLE=ylabel,YRANGE=yranger,YSTYLE=2,$
YLOG=yscaletype,XSTYLE=4+1,ytickformat='(F9.5)',XRANGE=xranger,POSITION=ppos,/DEVICE,$
NOERASE=clear_plot,CHARSIZE=ycsize,_EXTRA=EXTRAS
endif else begin
plot,mytimes,mydata,/NODATA,YTITLE=ylabel,YRANGE=yranger,YSTYLE=2,$
YLOG=yscaletype,XSTYLE=4+1,XRANGE=xranger,POSITION=ppos,/DEVICE,$
NOERASE=clear_plot,CHARSIZE=ycsize,_EXTRA=EXTRAS
endelse
endelse
if keyword_set(err_plus) and keyword_set(err_minus) then $
cdaweb_errplot,mytimes,mydata-myerr_minus,mydata+myerr_plus
timeaxis_text,JD=julday,/NOLABELS,TICKLEN=-2.0
endelse
if (non_fillcount ne 0) then begin
if (datagaps[0] eq -1) then oplot,mytimes,mydata,psym=psym,symsize=symsize $
else begin
start = 0L
for j=0L,n_elements(datagaps)-1 do begin
stop = datagaps[j]
if (not (keyword_set(SCATTER)) and (n_elements(mydata[start:stop]) eq 1)) then psym = 3 else psym = 0
if (keyword_set(SCATTER)) then psym = 3
oplot,mytimes[start:stop],mydata[start:stop], psym=psym
start = stop + 1
endfor
if (not (keyword_set(SCATTER)) and (n_elements(mydata[start:*]) eq 1)) then psym = 3 else psym = 0
if (keyword_set(SCATTER)) then psym = 3
oplot,mytimes[start:*],mydata[start:*], psym=psym
endelse
endif
ppos[3] = ppos[1] & ppos[1] = ppos[1] - psize & clear_plot=1
endif
endfor
if keyword_set(DEBUG) then print, 'Total possible panels ',num_panels,' number of good data panels = ', nogood_counter
time_written = 0L
if not (nogood) then begin
if keyword_set(POSITION) then begin
if keyword_set(LASTPLOT) then begin
timeaxis_text,FORM=tform,JD=julday,title=subtitle,CHARSIZE=0.9
time_written = 1L
endif
endif else begin
timeaxis_text,FORM=tform,JD=julday,title=subtitle,CHARSIZE=0.9
time_written = 1L
if keyword_set(GIF) then begin
print,'not yet titling gifs from within plot_timeseries'
deviceclose
endif
endelse
endif
if (keyword_set(LASTPLOT) and nogood and not(time_written) and (nogood_counter gt 0)) then begin
timeaxis_text,FORM=tform,JD=julday,title=subtitle,CHARSIZE=0.9
endif
skipped_graph:
return,status
end