Suppressing Live Script plotting figure inline
- Plotting the figure inside a separate .m function (being called from the Live Script)
- Creating the figure with visibility 'off'
- Forcing 'normal' window style when creating the figure, i.e. f = figure('WindowStyle','normal')
- Creating and plotting into a uifigure (copy still shows up inline)
- Saving the figure with its visibility turned 'off' and opening it again in a different instance of another Live Script. Upon opening, both the external and the inline figures are created.
2 Comments
Accepted Answer
More Answers (1)

4 Comments
Hi @Mate,
Thanks for sharing the script and the additional context. I see that you’ve already tried plotting in a separate `.m` function, creating the figure with `'Visible','off'`, forcing `'WindowStyle','normal'`, using `uifigure`, and saving/reopening the figure, yet an inline copy still appears.
This behavior is inherent to MATLAB Live Scripts: any figure output generated during execution is automatically captured and displayed inline, even if the figure is externally visible. Because of this, there is currently no way to fully suppress inline figures while running code directly in a Live Script.
Workarounds like shrinking the output area, as suggested by @Matt J, may reduce the visual impact but do not prevent the inline figure. The closest available approach is to wrap plotting in a function without returning any outputs, which minimizes inline duplication while still showing the external figure. However, complete suppression within a Live Script is not supported.
Hi @Mate,
You mentioned:
"Would you be able to provide a short example of the 'wrap plotting in a function without returning any outputs'? I tried something resembling this, yet the inline figure was still created. Perhaps I missed something then."
Wrapping plotting in a function without returning outputs reduces workspace clutter but does not prevent the Live Script from capturing the figure inline—this is by design.
Minimal example:
function externalPlot(x,y)
if nargin==1, y=x; x=1:numel(y); end
h = findobj('Type','figure','Name','External Figure');
if isempty(h) || ~isvalid(h)
h = figure('Name','External
Figure','NumberTitle','off','WindowStyle','normal','Visible','on');
else
figure(h); clf(h);
end
plot(h,x,y,'.-'); grid(h,'on'); xlabel('X [s]'); ylabel('Y [y]'); title('Random plot');
end
Call from the Live Script:
externalPlot(1:10, rand(1,10));
Caveat: inline figures will still appear.
Categories
Find more on Function Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!