Plot legend goes behing plot axes when using tiledlayout
I am generating several plots with legends on one figure using tiledlayout(). While the plot looks correct, the legends disappear behind the axes when I try to move them. The issue appears to be the same as described in this question, although I did not have any success with the fix:
Why does legend goes to the back of the axes box in multiplots if you click it or move it with the mouse?
The minimimum code that produces the issue is below. I get the same results when I omit the object handles.
t = tiledlayout(2, 1);
ax1 = nexttile(t);
pt1 = plot(ax1, 0:10, 0:10);
lg1 = legend(ax1, ‘Plot 1’);
ax2 = nexttile(t);
pt2 = plot(ax2, 0:10, 0:10);
lg2 = legend(ax2, ‘Plot 2’);I am generating several plots with legends on one figure using tiledlayout(). While the plot looks correct, the legends disappear behind the axes when I try to move them. The issue appears to be the same as described in this question, although I did not have any success with the fix:
Why does legend goes to the back of the axes box in multiplots if you click it or move it with the mouse?
The minimimum code that produces the issue is below. I get the same results when I omit the object handles.
t = tiledlayout(2, 1);
ax1 = nexttile(t);
pt1 = plot(ax1, 0:10, 0:10);
lg1 = legend(ax1, ‘Plot 1’);
ax2 = nexttile(t);
pt2 = plot(ax2, 0:10, 0:10);
lg2 = legend(ax2, ‘Plot 2’); I am generating several plots with legends on one figure using tiledlayout(). While the plot looks correct, the legends disappear behind the axes when I try to move them. The issue appears to be the same as described in this question, although I did not have any success with the fix:
Why does legend goes to the back of the axes box in multiplots if you click it or move it with the mouse?
The minimimum code that produces the issue is below. I get the same results when I omit the object handles.
t = tiledlayout(2, 1);
ax1 = nexttile(t);
pt1 = plot(ax1, 0:10, 0:10);
lg1 = legend(ax1, ‘Plot 1’);
ax2 = nexttile(t);
pt2 = plot(ax2, 0:10, 0:10);
lg2 = legend(ax2, ‘Plot 2’); plot, legend, tiledlayout, nexttile MATLAB Answers — New Questions