legend overwriting plots,

4 Ansichten (letzte 30 Tage)
Sankar Mahadevan
Sankar Mahadevan am 5 Mär. 2018
Hello,
I am trying to create a new ui layout and it seems that the legend is overwriting my plots. The axes on which I have plotted the graph is a child of a panel that I created. I cant find a way to have the legend along with the plot. It always overwrites my plot. Can someone help
fig = figure()
panel{1} = uix.BoxPanel( 'Title', 'Panel 1', 'Parent', fig );
axes1 = axes( 'Parent', panel{1})
theta = 0:360;
plot1=plot(axes1,theta, sind(theta))
legend(plot1)
  2 Kommentare
Greg
Greg am 5 Mär. 2018
What is uix or uix.BoxPanel?
Sankar Mahadevan
Sankar Mahadevan am 5 Mär. 2018
Bearbeitet: Walter Roberson am 3 Feb. 2019
Hi Greg,
uix.BoxPanel creates a small panel which can be moved and an axes or figure can be placed inside it

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Image Analyst
Image Analyst am 5 Mär. 2018
See if there is a 'location' option of legend() that will place your legend in a good place for all possible plots that you might have to draw. For example
legend('Curve 1', 'Curve2', 'Location', 'Northwest');

Marc Olle-Bernades
Marc Olle-Bernades am 2 Feb. 2019
Hi Sankar,
Did you manage to solve the issue of the legend? I have exactly the same issue, I have spent hours looking into that and I do not manage to get it correct.
Your feedback would be appreciated.
Thank you.
Best regards,
Marc
  1 Kommentar
Image Analyst
Image Analyst am 3 Feb. 2019
Try not having your axes in panels like he did. It's worth a try.

Melden Sie sich an, um zu kommentieren.


Marc Olle-Bernades
Marc Olle-Bernades am 3 Feb. 2019
Without using axes in panels or trying with BoxPanel it does the same. The legend overlaps the plot itself and despite of moving it to other location the plot of the axes object is no longer there.

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by