how to set the figure title using corrplot() ?

26 views (last 30 days)
Lucas Carey
Lucas Carey on 16 Jun 2015
Edited: Adam Danz on 10 Dec 2018
the title in figures made using corrplot() is 'Correlation Matrix' and title() doesn't change this. How can I set the title in this figure?

Answers (1)

Adam Danz
Adam Danz on 3 Oct 2018
Edited: Adam Danz on 10 Dec 2018
I was also searching for a solution to this and didn't find one. So, here's the solution I came up with to change the title of a corrplot() plot.
fh = figure;
corrplot(...);
th = findall(fh, 'type', 'text', 'String', '{\bf Correlation Matrix}');
th.String = 'New Title';
[updated] fh is merely the handle to the figure hosting corrplot(). This now works with 2018b and older releases.
  2 Comments
miicha
miicha on 10 Dec 2018
In Matlab r2018b it will not work, since first output argument of corrplot is R not a handle and the handle you get is for the chart line objects...
[R,P,fh] = corrplot(...);
th = findall(fh(1).Parent.Parent, 'type', 'text', 'String', '{\bf Correlation Matrix}');
th.String = 'New Title';
With the above changes it'll work again
Adam Danz
Adam Danz on 10 Dec 2018
I made a small adaptation to my original solution. All you really need is the handle to the figure which can be obtained by miicha's method, by using gcf(), or by creating the figure just prior to corrplot().

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!