idl plot window disappearances [message #77329] |
Tue, 23 August 2011 11:54 |
desertdryad
Messages: 39 Registered: August 2011
|
Member |
|
|
Hi folks -
I'm a bit ew to IDL programming (but not to programming in general)
and I have an issue that has me perplexed. I am trying to write a
simple bit of code, where a plot is drawn and a user is prompted
whether or not they want to accept a curve fit drawn on said plot, or
attempt another set of fitting parameters. However, the plot window
mysteriously vanishes the minute the prompt (from a 'read' command) is
executed. So, one cannot decide whether to accept the curve fit,
since it becomes invisible (the plot window simply goes blank). I
have set 'retain=2' to no avail. How do I fix?
Here is a code snippet:
repeat begin
read, mincurve, prompt='enter MINimum X axis value from the CDF over
which to curvefit:'
read, maxcurve, prompt='enter MAXimum X axis value from the CDF curve
over which to curvefit:'
print, mincurve, maxcurve
; now, call the curvefit routine to fit the line from min to max
p = minmaxfit(binnorm, histog[0,*], mincurve, maxcurve)
print, '0 intercept is at: ', p[0]
;graph that line!
x = fltarr(51)
y = fltarr(51)
inc=maxcurve/50
;print, mincurve, maxcurve, (maxcurve)/40
for i = 0, 50 do begin
x[i]=inc*i
y[i] = (p[1]*x[i]) + p[0]
;print, x[i], y[i]
endfor
cgplot, x, y, color='red', /overplot
yesorno = ' '
read, yesorno, prompt='Do you want to use this intercept value (y or
n)?'
endrep until yesorno EQ 'y'
|
|
|