Undocumented Matlab
  • SERVICES
    • Consulting
    • Development
    • Training
    • Gallery
    • Testimonials
  • PRODUCTS
    • IQML: IQFeed-Matlab connector
    • IB-Matlab: InteractiveBrokers-Matlab connector
    • EODML: EODHistoricalData-Matlab connector
    • Webinars
  • BOOKS
    • Secrets of MATLAB-Java Programming
    • Accelerating MATLAB Performance
    • MATLAB Succinctly
  • ARTICLES
  • ABOUT
    • Policies
  • CONTACT
  • SERVICES
    • Consulting
    • Development
    • Training
    • Gallery
    • Testimonials
  • PRODUCTS
    • IQML: IQFeed-Matlab connector
    • IB-Matlab: InteractiveBrokers-Matlab connector
    • EODML: EODHistoricalData-Matlab connector
    • Webinars
  • BOOKS
    • Secrets of MATLAB-Java Programming
    • Accelerating MATLAB Performance
    • MATLAB Succinctly
  • ARTICLES
  • ABOUT
    • Policies
  • CONTACT

Reverting axes controls in figure toolbar

December 23, 2018 6 Comments

I planned to post a new article in my toolstrip mini-series, but then I came across something that I believe has a much greater importance and impacts many more Matlab users: the change in Matlab R2018b’s figure toolbar, where the axes controls (zoom, pan, rotate etc.) were moved to be next to the axes, which remain hidden until you move your mouse over the axes. Many users have complained about this unexpected change in the user interface of such important data exploration functionality:

R2018a (standard toolbar)
R2018a (standard toolbar)
R2018b (integrated axes toolbar)
R2018b (integrated axes toolbar)

Luckily, we can revert the change, as was recently explained in this Answers thread:

addToolbarExplorationButtons(gcf) % Add the axes controls back to the figure toolbar
hAxes.Toolbar.Visible = 'off'; % Hide the integrated axes toolbar
%or:
hAxes.Toolbar = []; % Remove the axes toolbar data

addToolbarExplorationButtons(gcf) % Add the axes controls back to the figure toolbar hAxes.Toolbar.Visible = 'off'; % Hide the integrated axes toolbar %or: hAxes.Toolbar = []; % Remove the axes toolbar data

And if you want to make these changes permanent (in other words, so that they would happen automatically whenever you open a new figure or create a new axes), then add the following code snippet to your startup.m file (in your Matlab startup folder):

try %#ok
    if ~verLessThan('matlab','9.5')
        set(groot,'defaultFigureCreateFcn',@(fig,~)addToolbarExplorationButtons(fig));
        set(groot,'defaultAxesCreateFcn',  @(ax,~)set(ax.Toolbar,'Visible','off'));
    end
end

try %#ok if ~verLessThan('matlab','9.5') set(groot,'defaultFigureCreateFcn',@(fig,~)addToolbarExplorationButtons(fig)); set(groot,'defaultAxesCreateFcn', @(ax,~)set(ax.Toolbar,'Visible','off')); end end

MathWorks is taking a lot of heat over this change, and I agree that it could have done a better job of communicating the workaround in placing it as settable configurations in the Preferences panel or elsewhere. Whenever an existing functionality is broken, certainly one as critical as the basic data-exploration controls, MathWorks should take extra care to enable and communicate workarounds and settable configurations that would enable users a gradual smooth transition. Having said this, MathWorks does communicate the workaround in its release notes (I’m not sure whether this was there from the very beginning or only recently added, but it’s there now).
In my opinion the change was *not* driven by the marketing guys (as was the Desktop change from toolbars to toolstrip back in 2012 which received similar backlash, and despite the heated accusations in the above-mentioned Answers thread). Instead, I believe that this change was technically-driven, as part of MathWorks’ ongoing infrastructure changes to make Matlab increasingly web-friendly. The goal is that eventually all the figure functionality could transition to Java-script -based uifigures, replacing the current (“legacy”) Java-based figures, and enabling Matlab to work remotely, via any browser-enabled device (mobiles included), and not be tied to desktop operating systems. In this respect, toolbars do not transition well to webpages/Javascript, but the integrated axes toolbar does. Like it or not, eventually all of Matlab’s figures will become web-enabled content, and this is simply one step in this long journey. There will surely be other painful steps along the way, but hopefully MathWorks would learn a lesson from this change, and would make the transition smoother in the future.
Once you regain your composure and take the context into consideration, you might wish to let MathWorks know what you think of the toolbar redesign here. Please don’t complain to me – I’m only the messenger…
Merry Christmas everybody!
p.s. One of the complaints against the new axes toolbar is that it hurts productivity by forcing users to wait for the toolbar to fade-in and become clickable. Apparently the axes toolbar has a hidden private property called FadeGroup that presumably controls the fade-in/out effect. This can be accessed as follows:

hFadeGroup = struct(hAxes.Toolbar).FadeGroup  % hAxes is the axes handle

hFadeGroup = struct(hAxes.Toolbar).FadeGroup % hAxes is the axes handle

I have not [yet] discovered if and how this object can be customized to remove the fade animation or control its duration, but perhaps some smart hack would discover and post the workaround here (or let me know in a private message that I would then publish anonymously).

Related posts:

  1. Customizing figure toolbar background – Setting the figure toolbar's background color can easily be done using just a tiny bit of Java magic powder. This article explains how. ...
  2. uicontrol side-effect: removing figure toolbar – Matlab's built-in uicontrol function has a side-effect of removing the figure toolbar. This was undocumented until lately. This article describes the side-effect behavior and how to fix it....
  3. Customizing the standard figure toolbar, menubar – The standard figure toolbar and menubar can easily be modified to include a list of recently-used files....
  4. Figure toolbar components – Matlab's toolbars can be customized using a combination of undocumented Matlab and Java hacks. This article describes how to access existing toolbar icons and how to add non-button toolbar components....
  5. Figure toolbar customizations – Matlab's toolbars can be customized using a combination of undocumented Matlab and Java hacks. This article describes how to customize the Matlab figure toolbar....
  6. Adding a search box to figure toolbar – An interactive search-box can easily be added to a Matlab figure toolbar for enhanced user experience. ...
Figure Pure Matlab Toolbar Undocumented feature
Print Print
« Previous
Next »
6 Responses
  1. Drew December 28, 2018 at 17:54 Reply

    my comment to Mathworks on this subject was “the least user-friendly update Mathworks has released in the last 15 years…”

  2. Michelle Hirsch January 9, 2019 at 21:42 Reply

    Yair – thanks as always for escalating this issue, and for helping others find a way through to get behavior they are looking for. Rest assured the team is digging in to the feedback to figure out the best approach to addressing concerns.

    One thing puzzles me about the whole conversation (esp. on MTLAB Answers). Nobody is mentioning the default axes interactions, which we introduced along with the axes toolbar. We actually felt this was the biggest breakthrough, because you don’t need to interact with the toolbar at all in order to zoom, pan, rotate, or add datatips to a chart. Any thoughts on this? There’s a huge banner on the figure in 18b that introduces these new gestures so we thought people would find them.

    I also can clarify a couple of things from your post:
    * The Toolstrip was not driven by the marketing guys (and gals!). It was very much driven by our interest in improving discoverability of key capabilities which were too buried in menus and toolbars.
    * The axes toolbar was not created primarily to support the move to web graphics. We intended it to be a solution to multiple problems:
    ** The toolbar for a figure docked in the desktop can be very far from the figure itself.
    ** We’d like to move towards being able to define interactions at the axes level, instead of the figure level, since interactions are axes specific. The axes toolbar is one step in that direction

    • Yair Altman January 10, 2019 at 11:24 Reply

      @Michelle – thanks for your comment. The fact that I failed to mention the new built-in mouse interactions is my mistake – I originally planned to include it in the post, but then I forgot about it as I was writing the text. For the record, I find it intuitive and extremely useful, to the point of asking myself how come nobody thought of it until now. It certainly alleviates part of the pain of the toolbar change.
      One thing that I slightly disliked in the new built-in interactions was the fact that the data-tip text is black when you just hover and move the mouse, and then turns blue when you click to pin the data-tip. Maybe I’ll get used to this over time, but it seemed weird for me.

      I stand corrected regarding the inner reasoning for changes in the toolbar and toolstrip. Readers might not be aware of this but this is a good time to point out that I never write about anything to which I have access to confidential internal information. In other words, whatever I write is based solely on speculation, inference, my digs within open source code, and common sense. Sometimes, hopefully not too often, I come to mistaken conclusions. I apologize if anyone gets hurt. My aim is never malice.

      Your points about the reasoning for the axes toolbar changes are well noted and certainly make sense. The direction is good, it’s just that I think you made two steps at once (adding the axes toolbar, and removing the figure-level controls) and that’s one step too many. I think the new axes toolbar would have been a very welcome addition if it was offered in addition to the same functionality in the figure toolbar, not as a replacement. Then in a follow-on release you could have removed the figure-level controls (leaving a configurable way to return them) and it would have made much less noise because by then people would have gotten used to the built-in mouse interactions and the axes toolbar.

      Separately, I think a few things could be improved in the axes toolbar:
      * performance – the lag due to the fade-in effect, which cannot be controlled [AFAIK]
      * users need to move the mouse over the axes just to see the location of the axes control, requiring extra mouse moves/clicks. This could be corrected by having a fade-out opacity not to 0% but to 5-10% – users would then be able to directly click the controls, without it being too obtrusive (don’t forget to hide it altogether upon figure copy or export)
      * the new export control has no option to export as vector formats EPS/SVG/EMF, nor to the clipboard or printer. I think these would be welcome additions that should not be too difficult to implement.

    • Igor January 15, 2019 at 02:15 Reply

      Nobody is mentioning the default axes interactions, which we introduced along with the axes toolbar. We actually felt this was the biggest breakthrough, because you don’t need to interact with the toolbar at all in order to zoom, pan, rotate, or add datatips to a chart. Any thoughts on this?
      Personally, I do like the ability to zoom in with the mouse wheel and to pan without additional clicks. However, I constantly found myself still using my own simple custom hotkeys, as before. AFAIU, some things (e.g. creating multiple datatips) cannot be performed without explicitly switching to a specific cursor mode.

      Also, I do agree with Yair, David, Bruno and others that making the axis toolbar completely invisible when “not needed” was a bad idea. Yair’s suggestion to keep it at least partially visible is great. But I’m not sure if 5% would be enough.

      ——————–
      There’s a huge banner on the figure in 18b that introduces these new gestures so we thought people would find them.
      Banner? Personally, I don’t remember any. Is there a list of the gestures available or something?

      • Michelle Hirsch January 15, 2019 at 23:50

        Thanks Yair and Igor for the additional input. I’m finding this really helpful to drill down into the specific issues, and will make sure the team sees your suggestions.

        Igor – the banner appeared on figures in 18b. I’m guessing you dismissed it the first time without much thought, then it wouldn’t pop up again. This is a common issue with banners. The banner explains the gestures, which are also listed in the documentation: https://www.mathworks.com/help/matlab/creating_plots/interactively-explore-plotted-data.html

  3. Dani April 10, 2019 at 12:37 Reply

    I actually really like how we can interact with plots in 2018b and 2019a. I often develop GUIs for end-users and deactivate the standard Matlab figure toolbar all together (opposite to most other people that now miss part of the standard figure toolbar). Problem in my case is that I don’t get the default axes interactions unless I do things in the right order, i.e. I have run enableDefaultInteractivity after something is plotted in the axes otherwise data tips etc. are not active, see below. I don’t know why and I did not find this documented anywhere.

    h_f = figure('toolbar', 'none');
    h_ax = axes;
    enableDefaultInteractivity(h_ax); % No effect
    plot(magic(10)) 
    enableDefaultInteractivity(h_ax); % This does the trick
    tb = axtoolbar(h_ax, 'default'); 
    tb.Visible = 'on';

    h_f = figure('toolbar', 'none'); h_ax = axes; enableDefaultInteractivity(h_ax); % No effect plot(magic(10)) enableDefaultInteractivity(h_ax); % This does the trick tb = axtoolbar(h_ax, 'default'); tb.Visible = 'on';

    There are other issues with going all-in with regard to the new possibilities that Matlab offers in 2019a. For example

    1. Why do pcolor objects not come with a DataTipTemplate? plot does, even surf does. Makes it difficult to develop applications that have a consistent user interaction.

    2. The DataTipTemplate gives nice possibilities to improve data exploration. But when I assign them to all the objects on my GUIs the plot/refresh times are doubled. The performance of Matlab is crucial for most of us. So, please only introduce features once it is clear that they do not affect performance significantly. It is not fair to us users to introduce these features and we then rewrite code just to figure out in the end that we just created a snail and wasted lots of our development time.

    So, please Mathworks:
    – document better
    – make things consistent
    – check performance before releasing new features
    (and why we in 2019 still have to beg that you introduce export to clipboard – axtoolbar, as already stated by Yair above – is not understandable)

Leave a Reply
HTML tags such as <b> or <i> are accepted.
Wrap code fragments inside <pre lang="matlab"> tags, like this:
<pre lang="matlab">
a = magic(3);
disp(sum(a))
</pre>
I reserve the right to edit/delete comments (read the site policies).
Not all comments will be answered. You can always email me (altmany at gmail) for private consulting.

Click here to cancel reply.

Useful links
  •  Email Yair Altman
  •  Subscribe to new posts (feed)
  •  Subscribe to new posts (reader)
  •  Subscribe to comments (feed)
 
Accelerating MATLAB Performance book
Recent Posts

Speeding-up builtin Matlab functions – part 3

Improving graphics interactivity

Interesting Matlab puzzle – analysis

Interesting Matlab puzzle

Undocumented plot marker types

Matlab toolstrip – part 9 (popup figures)

Matlab toolstrip – part 8 (galleries)

Matlab toolstrip – part 7 (selection controls)

Matlab toolstrip – part 6 (complex controls)

Matlab toolstrip – part 5 (icons)

Matlab toolstrip – part 4 (control customization)

Reverting axes controls in figure toolbar

Matlab toolstrip – part 3 (basic customization)

Matlab toolstrip – part 2 (ToolGroup App)

Matlab toolstrip – part 1

Categories
  • Desktop (45)
  • Figure window (59)
  • Guest bloggers (65)
  • GUI (165)
  • Handle graphics (84)
  • Hidden property (42)
  • Icons (15)
  • Java (174)
  • Listeners (22)
  • Memory (16)
  • Mex (13)
  • Presumed future risk (394)
    • High risk of breaking in future versions (100)
    • Low risk of breaking in future versions (160)
    • Medium risk of breaking in future versions (136)
  • Public presentation (6)
  • Semi-documented feature (10)
  • Semi-documented function (35)
  • Stock Matlab function (140)
  • Toolbox (10)
  • UI controls (52)
  • Uncategorized (13)
  • Undocumented feature (217)
  • Undocumented function (37)
Tags
ActiveX (6) AppDesigner (9) Callbacks (31) Compiler (10) Desktop (38) Donn Shull (10) Editor (8) Figure (19) FindJObj (27) GUI (141) GUIDE (8) Handle graphics (78) HG2 (34) Hidden property (51) HTML (26) Icons (9) Internal component (39) Java (178) JavaFrame (20) JIDE (19) JMI (8) Listener (17) Malcolm Lidierth (8) MCOS (11) Memory (13) Menubar (9) Mex (14) Optical illusion (11) Performance (78) Profiler (9) Pure Matlab (187) schema (7) schema.class (8) schema.prop (18) Semi-documented feature (6) Semi-documented function (33) Toolbar (14) Toolstrip (13) uicontrol (37) uifigure (8) UIInspect (12) uitools (20) Undocumented feature (187) Undocumented function (37) Undocumented property (20)
Recent Comments
  • Nicholas (6 days 22 hours ago): Hi Yair, Thanks for the reply. I am on Windows 10. I also forgot to mention that this all works wonderfully out of the editor. It only fails once compiled. So, yes, I have tried a...
  • Nicholas (6 days 22 hours ago): Hi Yair, Thanks for the reply. I am on Windows 10. I also forgot to mention that this all works wonderfully out of the editor. It only fails once compiled. So, yes, I have tried a...
  • Yair Altman (7 days 5 hours ago): Nicholas – yes, I used it in a compiled Windows app using R2022b (no update). You didn’t specify the Matlab code location that threw the error so I can’t help...
  • Nicholas (8 days 1 hour ago): Hi Yair, Have you attempted your displayWebPage utility (or the LightweightHelpPanel in general) within a compiled application? It appears to fail in apps derived from both R2022b...
  • João Neves (11 days 6 hours ago): I am on matlab 2021a, this still works: url = struct(struct(struct(struct(hF ig).Controller).PlatformHost). CEF).URL; but the html document is empty. Is there still a way to do...
  • Yair Altman (14 days 5 hours ago): Perhaps the class() function could assist you. Or maybe just wrap different access methods in a try-catch so that if one method fails you could access the data using another...
  • Jeroen Boschma (14 days 7 hours ago): Never mind, the new UI components have an HTML panel available. Works for me…
  • Alexandre (14 days 8 hours ago): Hi, Is there a way to test if data dictionnatry entry are signal, simulink parameters, variables … I need to access their value, but the access method depends on the data...
  • Nicholas (14 days 22 hours ago): In case anyone is looking for more info on the toolbar: I ran into some problems creating a toolbar with the lightweight panel. Previously, the Browser Panel had an addToolbar...
  • Jeroen Boschma (18 days 5 hours ago): I do not seem to get the scrollbars (horizontal…) working in Matlab 2020b. Snippets of init-code (all based on Yair’s snippets on this site) handles.text_explorer...
  • Yair Altman (46 days 8 hours ago): m_map is a mapping tool, not even created by MathWorks and not part of the basic Matlab system. I have no idea why you think that the customizations to the builtin bar function...
  • chengji chen (46 days 14 hours ago): Hi, I have tried the method, but it didn’t work. I plot figure by m_map toolbox, the xticklabel will add to the yticklabel at the left-down corner, so I want to move down...
  • Yair Altman (54 days 7 hours ago): @Alexander – this is correct. Matlab stopped including sqlite4java in R2021b (it was still included in 21a). You can download the open-source sqlite4java project from...
  • Alexander Eder (60 days 3 hours ago): Unfortunately Matlab stopped shipping sqlite4java starting with R2021(b?)
  • K (66 days 13 hours ago): Is there a way to programmatically manage which figure gets placed where? Let’s say I have 5 figures docked, and I split it into 2 x 1, I want to place 3 specific figures on the...
Contact us
Captcha image for Custom Contact Forms plugin. You must type the numbers shown in the image
Undocumented Matlab © 2009 - Yair Altman
This website and Octahedron Ltd. are not affiliated with The MathWorks Inc.; MATLAB® is a registered trademark of The MathWorks Inc.
Scroll to top