Back to the main page.

Bug 2228 - be consistent with opening new figure windows

Status CLOSED FIXED
Reported 2013-08-01 08:59:00 +0200
Modified 2021-10-29 12:38:36 +0200
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to:
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2013-08-01 08:59:52 +0200

On 1 Aug 2013, at 5:59, Kaoru Amano wrote: Related to the point you mentioned about new visualization tool, ft_sourceplot seems to open a new window, right? I've been using subplot to compare source plots on mesh between conditions, which doesn't work anymore. It might be a good idea to include an option not to creat a new figure.


Robert Oostenveld - 2013-08-01 09:11:32 +0200

at line 638 in sourceplot it does %% start building the figure h = figure; set(h, 'color', [1 1 1]); set(h, 'visible', 'on'); set(h, 'renderer', cfg.renderer); title(cfg.title); This indeed has the consequence that the function cannot be used in subplots. Based on experience I would not be able to tell which function will open a new figure, which will use the present figure (or subfigure) and which one will use the present figure after clearing it. Looking at other functions, I see that * ft_topoplotCC has the option cfg.newfigure=yes/no. * ft_multiplotER seems to reuse the current figure * ft_databrowser always creates a new figure * ... So it is inconsistent. Perhaps the cfg.newfigure option could be used throughout. There are some functions that use the subplot command: mac001> grep subplot *.m | grep -v ':%' (too long to list here) The use of subplot probably requires that the existing figure gets cleared, i.e. outside the ft functino the user would not be allowed to use subplots. In sourceplot that applies to orto, but not the other plotting methods.


Jan-Mathijs Schoffelen - 2020-10-29 16:22:57 +0100

I think that this has been addressed by now, so it can be closed.


Robert Oostenveld - 2020-10-29 17:35:12 +0100

yes, this has actually been fixed some time ago. For rereferce, there is now the cfg.figure option for all plotting functions, which is handled in fieldtrip/private/open_figure.m You can specify a new figure, an existing figure that needs to be cleared, or an existing function tha should not be cleared. Also the figure name (in the window), title (above the axes), position, renderer and visibility are centrally managed here. See https://github.com/fieldtrip/fieldtrip/blob/master/private/open_figure.m


Robert Oostenveld - 2021-10-29 12:38:36 +0200

Let me close these bugs, now that they have been resolved.