Reputation: 15561
I mean to reuse an already existing figure for adding new plots. I should make current the figure-to-use. Is there any difference between
set(0, 'CurrentFigure', f);
and
figure(f);
?
Upvotes: 2
Views: 905
Reputation: 60444
Octave's documentation specifies, for the figure(f)
syntax,
If the figure already exists then it is made visible and becomes the current figure for plotting.
That is, besides setting f
as the current figure, the command also affects the 'visible'
property of the figure f
. In a quick experiment (on Linux), it became clear that not only is the figure made visible, but it is also brought to the front and given focus (keyboard input is sent to that figure window). This behavior completely parallels MATLAB's behavior.
Thus, to only change the current figure without affecting visibility or keyboard focus, use set(0, 'CurrentFigure', f)
.
Upvotes: 2