I'm trying to plot various vertical lines on my graph. They all represent aspects of the same feature and only need one entry in the legend. This is the code I wrote (that seemed to work a few days ago):
p = xline(ax, [1 2 3], "g-");
hg.DisplayName = "My Data";
set(get(get(hg,'Annotation'),'LegendInformation'),'IconDisplayStyle','on');
However, when I run this now I get an error
"Error using matlab.graphics.chart.decoration.ConstantLine/setParentImpl - Parent must be a Cartesian axes."
I've read that ConstantLine objects like xline() can't have a Group object as a parent, unike plot(). My code works if I use plot(), but I'm not sure how to effectivly implement vertical lines using that function.