Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Keeping plot legend in foreground

Asked by Matt J on 19 Oct 2012

When I add a line object to my plot, the legend is for some reason pushed into the background behind the plot axis, where it is hidden. Why does this happen and how do I bring it into the foreground again?

1 Comment

Azzi Abdelmalek on 19 Oct 2012

Can you post your code?

Matt J



No products are associated with this question.

1 Answer

Answer by Matt Fig on 19 Oct 2012
Edited by Matt Fig on 19 Oct 2012
Accepted answer

I cannot reproduce this with:

line([5 5],[0 10])

So I want to ask what your code looks like. If you only have the one plot axes and the legend (no uicontrols or other figure children), then this will bring the legend back:


If you have other figure children, the idea is the same, you will just have to be more careful about the rearrangement.


Matt Fig

Contact us