How to erase a (function graphics) plot. [message #79459] |
Sun, 04 March 2012 21:27  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
I am building a widget application with a widget_window for displaying function graphics plots. By default, function graphics does not erase the old plot in the same window.
p1 = plot(indgen(10))
p2 = plot( sin(indgen(10),/current)
There is a delete method
p1.delete
but that doesn't delete the axes, which still get jumbled together. There is a close method but that destroys the window, and I'd like to keep reusing the widget_window.
Right now I am erasing the plot by loading a white IMAGE() but I hope there is a better way.
Thanks, --Wayne
|
|
|
|
Re: How to erase a (function graphics) plot. [message #79522 is a reply to message #79459] |
Wed, 07 March 2012 08:05  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul van Delst writes:
> I still use the function down below in some older code - the fixed IDL version is explicitly listed.
By the way, don't throw these away yet. I ran into
someone earlier this week who was using IDL 5.2.
You just never know!!
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: How to erase a (function graphics) plot. [message #79523 is a reply to message #79459] |
Wed, 07 March 2012 08:03  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul van Delst writes:
> Uh, I think that happens when someone sits down and starts using IDL.
Yes, I've pretty much come to the conclusion that *ALL*
IDL routines require wrappers to make them useful. ;-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: How to erase a (function graphics) plot. [message #79524 is a reply to message #79459] |
Wed, 07 March 2012 07:55  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
On 03/05/12 12:07, David Fanning wrote:
> Mark Piper writes:
>
>> In 8.2, there will be an ::Erase method for NG, analogous to ERASE for
>> DG. (In 8.0& 8.1, I've "erased" plots as Alain has.)
>
> And welcome to the version-specific code writing world! ;-)
Uh, I think that happens when someone sits down and starts using IDL.
Remember handles? Or, to be more contemporary, remember when IDL didn't have lists and hashes?
cheers,
paulv
p.s. I still use the function down below in some older code - the fixed IDL version is explicitly listed. Oi vey.
; --------------------------------------------------------
; Local function to convert BYTE/CHAR values
; to a STRING data type.
;
; Need this because all string netCDF data
; types were returned as BYTE arrays.
;
; For pre IDL v5.3 the returned data type string is "BYTE"
; For IDL v5.3 the returned data type string is "CHAR"
; --------------------------------------------------------
FUNCTION convert_string, data_type, $
input_string, $
NO_CONVERT=no_convert
; Set the IDL version with the bug fix
fixed_IDL_version = 5.3
; If the data type is CHAR, then we have a string. Convert and return.
IF ( STRUPCASE( data_type ) EQ 'CHAR' ) THEN $
RETURN, STRING( input_string )
; The data type is not CHAR. Maybe it needs converting, maybe not.
IF ( FLOAT( !VERSION.RELEASE ) LT fixed_IDL_version AND $
STRUPCASE( data_type ) EQ 'BYTE' AND $
( NOT KEYWORD_SET( no_convert ) ) ) THEN $
RETURN, STRING( input_string )
; Don't do anything
RETURN, input_string
END ; FUNCTION convert_string
|
|
|