I have created a biplot in matlab
biplot = biplot(wcoeff(:,1:2),'Scores',score(:,1:2),'VarLabels',drugsFixed,'ObsLabels',cellLines,'MarkerSize',15)
It looks great, but I'd like to add a title. Adding 'title'
to the biplot function call results in an error. The 'biplot' object doesn't have any children that look like they might have the title handle in it. Suggestions?
As with many plotting functions, I can follow up my call to biplot
with a call to title
to add a title to the current figure.
%% Biplot of Coefficients and Scores
% https://www.mathworks.com/help/stats/biplot.html#bt_y8xe-2
% Load the sample data.
% Copyright 2015 The MathWorks, Inc.
load carsmall
%%
% Define the variable matrix and delete the rows with missing values.
x = [Acceleration Displacement Horsepower MPG Weight];
x = x(all(~isnan(x),2),:);
%%
% Perform a principal component analysis of the data.
[coefs,score] = pca(zscore(x));
%%
% View the data and the original variables in the space of the first three
% principal components.
vbls = {'Accel','Disp','HP','MPG','Wgt'};
biplot(coefs(:,1:3),'scores',score(:,1:3),'varlabels',vbls);
%Add the title
title('My title');
If the correct figure is not current, you can change the current figure by calling figure(f)
where f
is the figure handle that you want to add the title to.