# MATLAB: How to label Y axes in place of column1 column 2 etc

plot

``clear; close all; clcX = [1 : 1 : 31]Y = [9	10	11	10	12	15	16	12	10	11	12	13	12	14	12	10	11	13	14	12	13	15	16	11	17	15	18	14	16	13	NaN; 14	12	10	11	13	14	12	13	15	16	11	10	12	15	16	11	17	15	18	14	16	10	12	15	16	12	10	11	15	16	12; 15	16	11	10	12	15	16	11	16	18	15	20	16	20	24	23	22	23	19	20	22	21	26	25	24	22	27	23	22	21	NaN; 23	19	20	22	21	26	25	24	22	15	16	12	10	11	12	13	15	16	11	16	18	15	20	16	20	24	22	21	26	25	24; 16	18	15	20	16	20	24	22	21	26	16	11	16	18	15	20	16	20	24	11	16	18	15	20	16	20	24	22	16	10	12; 10	12	15	16	12	13	14	12	13	15	16	11	10	18	15	20	16	20	24	11	16	18	15	18	15	20	16	20	24	22	NaN; 15	16	11	10	12	15	16	11	16	18	22	23	19	20	22	21	26	25	24	16	18	15	20	16	20	24	22	21	26	16	11; 20	24	23	22	23	19	20	22	21	26	15	16	11	10	12	15	16	11	16	18	10	12	15	16	12	13	14	12	13	15	NaN; 24	23	22	23	19	20	22	21	26	25	24	19	20	22	21	26	25	24	16	18	15	20	10	12	15	16	11	16	18	24	25; 26	25	24	19	20	22	21	26	25	24	22	15	16	12	10	23	22	23	19	20	22	21	26	25	24	23	22	23	19	20	22; 20	22	21	26	25	24	16	18	20	24	23	22	23	19	20	22	26	25	24	19	20	22	21	26	19	20	22	21	26	NaN	NaN; 20	24	23	22	23	19	20	22	21	15	16	11	10	12	15	16	16	18	22	23	19	20	22	21	10	12	15	16	12	13	14]Z = transpose(Y)stackedplot (X,Z)``
How to label Y axes with month and year in place of column1 column2 etc

• ``YT=cellstr(datetime(2020,1:12,1,'Format','MMMyy')); % cellstr array of MMMyyhSP=stackedplot(YT.','DisplayLabels',YT);           % stacked plot using y label strings``