MATLAB Answers

Colorbars and Legends in new MATLAB handle graphics engine

4 views (last 30 days)
I hava GUIDE app made in MATLAB R2014a. My GUIDE app has colorbars and legends. However, when I port the app to MATLAB R2014b or other more recent versions, my colorbars and legends do not show. Why does that happen?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 22 Oct 2021
Edited: MathWorks Support Team on 26 Oct 2021
Since MATLAB R2014b, MATLAB has ported to a new handle graphics engine. In the previous engine (used in R2014a and previous versions), you could add legend and colorbar objects to a figure outside of GUIDE and they would be loaded correctly when opening in GUIDE. Even though the legend and colorbar objects are not part of the supported GUIDE object types, they loaded successfully because they are on an axes which GUIDE does support.
In the newer graphics engine (incorporated since R2014b) however, the legend and colorbar have changed types. So when opening a FIG file in GUIDE in the newer handle graphics engine that contains these unsupported object types, GUIDE internally throws an exception.
To resolve the exception, GUIDE will remove these unsupported objects when loading the figure. A modal warning dialog will notify you that the legend and colorbar objects are removed.
Therefore, before porting an app to the new graphics engine, please remove any unsupported functionality in the old version of the app.
For more details regarding the handle graphics engines, please refer to the link below

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!