Hello,
I'm plotting a simple time series (of program execution times) and, at
certain times, I want to indicate an occurrance (e.g. rebuild,
optimisation, etc).
I want to indicate this occurrance with a vertical dashed line that
spans the entire yrange of the completed plot.
Here is how I plot the actual data:
FOR i = 0L, n_times-1L DO BEGIN
tp[i] = PLOT( date_time, timing[*,i], $
TITLE='Host : ' + host + '!C' + $
'CRTM root : ' + crtm_root + '!C' + $
'Sensor Id : ' + sensor_id + '!C' + $
'CRTM version : ' + crtm_version + '!C' + $
'Current Date : ' + SYSTIME(), $
XTITLE='Date', $
YTITLE='Run time (sec.)', $
XTICKFORMAT='LABEL_DATE', $
MARGIN=[0.1,0.1,0.25,0.15], $
DIMENSIONS=[xsize,ysize], $
COLOR=color[i], $
THICK=2, $
FONT_SIZE=9, $
SYMBOL='diamond', $
OVERPLOT=i, $
NAME=legend_strings[i], $
BUFFER=buffer )
ENDFOR
l = LEGEND( TARGET=tp, $
ORIENTATION=0, $
FONT_SIZE=7, $
HORIZONTAL_ALIGNMENT='CENTER', $
VERTICAL_ALIGNMENT='CENTER', $
POSITION=[0.91,0.5] )
No worries. Works great. I then do the following to plot the vertical
line and an associated text string if there is a comment associated with
any of the dates/times:
idx = WHERE(STRLEN(comment) GT 0, n_comments)
print, tp[0].YRANGE
IF ( n_comments GT 0 ) THEN BEGIN
FOR i = 0, n_comments-1 DO BEGIN
c = PLOT( [date_time[idx[i]],date_time[idx[i]]], tp[0].YRANGE, $
XTICKFORMAT='LABEL_DATE', $
LINESTYLE='dashed', $
/OVERPLOT, $
BUFFER=buffer )
t = TEXT( date_time[idx[i]], (tp[0].YRANGE)[1], $
comment[idx[i]], $
FONT_SIZE=7, $
/DATA, $
TARGET=tp[0], $
ALIGNMENT=0.5, $
VERTICAL_ALIGNMENT=1.0 )
ENDFOR
ENDIF
Note that in the PLOT() command I'm using tp[0].YRANGE to specify the,
well, yrange of the vertical line, and in the TEXT() command I'm using
(tp[0].YRANGE)[1] to position the text at the top of the line.
When I run the above code I get the following output from the
"print, tp[0].YRANGE" command:
0.0000000 350.00000
(also note that tp[0].AXIS_RANGE is [0,0])
BUT, my plot looks like this:
ftp://ftp.emc.ncep.noaa.gov/jcsda/CRTM/timing/emc-lw-pvandel .trunk.amsua_metop-a.v2_2_0-alpha.timing.png
As you can see (I hope) the ACTUAL y-axis range is [0,400], not [0,350].
Additionally, while the vertical line plot only goes up to 350 the
TEXT() output, which should also be positioned at 350 since it uses the
same yrange data, is actually positioned at 400 - the "true" maximum
yrange value.
WTF?
So I have two questions:
1) How does one get the ACTUAL yrange values used in a plot?
2) Why does the TEXT() function position the text differently than the
PLOT() function plots when the same YRANGE property is being used?
Am I doing something wrong here or, as I'm beginning to suspect, is the
random number generator at the heart of Function Graphics funnin' with me?
cheers,
paulv
|