I have plotted through gscatter
in MATLAB. The plot of speed against year. Now there is another column vector or table in my case which contains corresponding strings of the plotted points. That table is int
variable.
I want to show the corresponding text from that int
variable of the plotted points on the graph. Can anyone help me?
Here is the link to my data.
Here is my code:
T = readtable('Data_Serial.xlsx');
int = T.Int;
BW = T.Band;
type = T.Type;
year = T.Year;
g = {type};
labels = cellstr(int);
% Plot Data
f = figure;
box on;
gscatter(year,BW,g,'rkgb','o*',8,'on','Year','Speed')
hold on;
text(year(:,1), BW(:,2), labels, 'VerticalAlignment','bottom', ...
'HorizontalAlignment','right')
It shows following error:
>> Data_Serial
Index exceeds matrix dimensions.
Error in Data_Serial (line 16)
text(year(:,1), BW(:,2), labels, 'VerticalAlignment','bottom', ...