;+
; NAME:
;	PLOT_ENV
;
;
; PURPOSE:
;	Save and restore plotting environments
;
;
; CATEGORY:
;	Utilities
;
;
; CALLING SEQUENCE:
;	plot_env, [/save|/restore]
;
;
; KEYWORD PARAMETERS:
;	/save		If set, then save the current environment
;	/restore	If set, then restore the saved environ
;
;
; COMMON BLOCKS:
;	smei_plot_common
;
;
; SIDE EFFECTS:
;	The 4 plot environment system variables are changed or saved.
;
;
; RESTRICTIONS:
;	If it gets used in a nested way it will get confused. If
;	neither key is given it silently does nothing at all.
;
;
; MODIFICATION HISTORY:
;	Original: 13/6/03; SJT
;-

pro plot_env, save = save, restore = restore

common smei_plot_common, pling_p, pling_x, pling_y, pling_z

if keyword_set(save) then begin
    pling_p = !p
    pling_x = !x
    pling_y = !y
    pling_z = !z
endif else if keyword_set(restore) then begin
    !p = pling_p 
    !x = pling_x 
    !y = pling_y 
    !z = pling_z
endif

end
