I ran across a difference between line objects when using the line vs. plot commands for plotting data. When I attempt to set the SeriesIndex property of a line created with the line command, I get an unrecognized property error.
lh1 = line(x,y,'SeriesIndex',2);
Error using line
Unrecognized property SeriesIndex for class Line.
However, if I create a line with the plot command, the SeriesIndex property works as stated in the MATLAB documentation for Line Properties.
lh2 = plot(x,y,'SeriesIndex',2);
Even though these two objects are both Line objects with almost identical properties, it seems that the object created with the line command is of the class 'matlab.graphics.primitive.Line', whereas the object created with the plot command is of the class 'matlab.graphics.chart.primitive.Line'. I never realized there was a difference between a line created with the line command vs. the plot command. I wonder if the omission of the SeriesIndex property for the former is intentional. And if so, what is the reason for the different primitives? Are there differences between these two objects that would suggest using one method over the other in certain cases?