I am plotting two 201×4 arrays, resulting in four 2-d lines. The y array is a time series so I want the legend to vary accordingly. I created a 1×4 cell with strings that show the time variation of my y variable. However, the result is not satisfactory as shown in the figure below:
My code attempt is below:
lgd = {'HGS 50-year','HGS 100-year','HGS 150-year','HGS 200-year'};h2 = plot(x,y,'LineWidth',1.25,'DisplayName',char(lgd)');legend;
I can easily accomplish what I need with a for loop but I do not want to do that because I think I am close to accomplishing what I need without it.
Please help. Thank you.
Best Answer