Bug 356289

Summary: Graphics Device can't remove active plot even "clear history"
Product: [Applications] rkward Reporter: Adley <adleyvong>
Component: generalAssignee: RKWard Team <rkward-devel>
Status: RESOLVED FIXED    
Severity: normal CC: thomas.friedrichsmeier
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Adley 2015-12-04 17:32:01 UTC
It only happens when there're more than one plots. (cause rkward will disable the "Navigator button" if only one plot to show) 
for example:
Suppose there are two plots in history (A,B), if the active plot is A, then choose "clear history", the plot B will be removed, but the plot A still in history list. 

Reproducible: Always
Comment 1 Thomas Friedrichsmeier 2015-12-06 11:57:03 UTC
Hi!

For clarification, the behavior I am seeing is this:

1) At start of session
> plot (1)
Result: One plot window, history controls disabled.
2)
> plot (2)
Result: Second plot is shown, history controls enabled.
3) History->Previous plot -- History->Clear history
Result: First plot is shown, history controls disabled.
4)
> plot (3)
Result: Third plot is shown, history controls enabled, first plot is in history.

Can you confirm this is what you are seeing, too?

Next question is what behavior you expect, instead. As far as I understand, you expect the result of step 4 to be "Third plot is shown, history controls disabled." Correct?

*If* this is the behavior you expect, it is difficult to achieve. The problem is that we cannot determine, reliably, when a plot is "finished". For instance, you could still call title(main="A nice plot"), or make other modifications to the current plot. Thus, the history logic is that in the moment you start a *new* plot, the previous plot is added to the history (also, when you close the plot window). Against that background, I can see only two ways out:

a) History->Clear history would clear the history *and* blank the current plot. That behavior would clearly hold the potential for unpleasant surprises though.

b) To achieve what you want, today, you can close the plot window, and run rk.clear.plot.history() in the R Console window. Is that good enough? Or do you have something else in mind?
Comment 2 Adley 2015-12-07 12:56:08 UTC
I think the "way b" run rk.clear.plot.history() is what I need. 
Since I often need to show bundle of plots and need to refresh frequently. It will confuse me if there is any plot that showing the "old data". I have to clean all the history plots before I run again. 

Thanks for your kindly reply and done a great job for making an excellent R IDE for us.