Code covered by the BSD License  

Highlights from
blurFigure - blurs and prevents interaction on a figure window

5.0 | 4 ratings Rate this file 7 Downloads (last 30 days) File Size: 5.38 KB File ID: #30666 Version: 1.2
image thumbnail

blurFigure - blurs and prevents interaction on a figure window


Yair Altman (view profile)


07 Mar 2011 (Updated )

blurs a specified figure window and prevents interaction with it until the figure is un-blurred

| Watch this File

File Information

     hFigBlur = blurFigure(hFig, state)
     blurFigure(hFig) blurs figure hFig and prevents interaction with it. The only interaction possible is with user-created controls on the blurring panel (see below).
     hFigBlur = blurFigure(hFig) returns the overlaid blurred figure pane. This is useful to present a progress bar or other GUI controls, for user interaction during the blur phase.
     blurFigure(hFig,STATE) sets the blur status of figure hFig to STATE, where state is 'on','off',true or false (default='on'/true).
     blurFigure(hFig,'on') or blurFigure(hFig,true) is the same as: blurFigure(hFig).
     blurFigure(hFig,'off') or blurFigure(hFig,false) is the same as: close(hFigBlur).
     blurFigure('demo') displays a simple demo of the blurring (see attached screenshot).
Input parameters: (all parameters are optional)
     hFig - (default=gcf) Handle(s) of the modified figure(s). If component handle(s) is/are specified, then the containing figure(s) will be inferred and used.
     state - (default='on'/true) blurring flag: 'on','off',true or false
     hFigBlur = blurFigure(hFig); % blur hFig (alternative #1)
     hFigBlur = blurFigure(hFig,true); % blur hFig (alternative #2)
     hFigBlur = blurFigure(hFig,false); % un-blur hFig (alternative #1)
     hFigBlur = blurFigure(hFig,'off'); % un-blur hFig (alternative #2)
     close(hFigBlur); % un-blur hFig (alternative #3)
     delete(hFigBlur); % un-blur hFig (alternative #4)
     blurFigure('demo'); % blur demo with progress bar etc.
Technical Description:

Bugs and suggestions:
     Please send to Yair Altman (altmany at gmail dot com)
     This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7.9 (R2009b) and higher, but use at your own risk!


Get J Frame Retrieves A Figure's Underlying Java Frame, Enable/Disable Figure, and Set Fig Transparency Set Figure Transparency / Fading inspired this file.

This file inspired Undecorate Fig Remove/Restore Figure Border And Title Bar.

MATLAB release MATLAB 7.11 (R2010b)
Other requirements Matlab 7.9 (R2009b) and higher (or a retrofit of JRE 1.6.0_10 and higher in any previous Matlab release)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
05 Dec 2014 Timo Dörsam  
27 Jun 2013 Yair Altman

Yair Altman (view profile)

IMPORTANT NOTE: this utility DOES NOT WORK on R2013b/Java7 and higher, only on earlier releases. The failure is due to a change in the way that transparency works in Java 7 compared to earlier releases. If I ever find a solution, I will post it here. In the meantime, please do not comment about this issue here.

Comment only
05 Jun 2013 Chris

Chris (view profile)

Great utility. I have had a bit of trouble getting the overlay figure to exactly match the original. I found if I have a menu created in GUIDE, then the 'Menu' parameter is 'none' and the blurFig shortens itself.

If you add some lines to check if hProps.MenuBar is 'none', but there are uimenu objects with children, then you can launch the figure without the Menu parameter and it's fine.

Also adding space in line 180:

set(hComponents,'Label',' ')

helps keep the height matching in other situations.

20 Mar 2013 Josh Parks

I'm really loving your blog Yair, some really useful things in there! I'm running Matlab 20112b on OSX and the following line causes the blurfigure to flicker:

hLink(3) = linkprop(hFigures,'Visible');

I've commented it out as I'm not changing visibility of the target figure during the call, but I'm just not sure why that line caused problems!


Comment only
16 Oct 2012 Aurelien Queffurust

This is exactly what I need. Works like a charm with MATLAB 8.0 (R2012b)
Really simple to insert in his own code.

14 Oct 2011 Charles

OK, I'll keep an eye out for it, don't see it yet. Thanks for the quick response.


Comment only
13 Oct 2011 Yair Altman

Yair Altman (view profile)

@Charles - I uploaded a fix for R2011b. It should be available here shortly (maybe tomorrow)

Comment only
13 Oct 2011 Charles

This is exactly what I need. However, it does not work for me. I am using 2011b, which may be the problem. Here is the error I get:

Error using blurFigure (line 135)
Cannot retrieve the Java Frame reference for figure 190.0016

Error in mirror>characterize_Callback (line 3356)
blurFigure(hObject, true)

Error in gui_mainfcn (line 96)

Error in mirror (line 43)
gui_mainfcn(gui_State, varargin{:});

Error in

Error while evaluating uicontrol Callback

Any ideas?


Comment only
22 Apr 2011 faruto

faruto (view profile)

good sfuff O(∩_∩)O

06 Apr 2011 Matthew Whitaker

Hi Yair,
Very nice utility. Why not add a parameter to allow the user to set the opacity instead of just fixing it at 0.8?
Matt W

Comment only
09 Mar 2011 Yair Altman

Yair Altman (view profile)

@Jan - a retrofit of JRE means installing JRE 1.6.0_10 (also called "Java 6 update 10"), or any later version (e.g., the latest available version today is 1.6 update 24). The JRE can be downloaded from and you can configure Matlab to use it according to the instructions in

All of this is only necessary in Matlab releases R2009a (7.8) and earlier, which pre-bundle an earlier JRE version that does not support window frame transparency/opacity used in this submission.

Matlab R2009b (7.9) and onward, at least on Microsoft Windows, pre-bundle a JRE version that does support transparency/opacity and so do not require a retrofit.

Comment only
08 Mar 2011 Jan Simon

Jan Simon (view profile)

What is a "retrofit of JRE 1.6.0_10"?

Comment only
08 Mar 2011 1.1

Fixed the demo code

13 Oct 2011 1.2

Fix for R2011a; fixed description;

Contact us