I was so proud of my crummy workaround for the legend bug not displaying properly on my plot, I had to share it.

1 view (last 30 days)
Tony Dimichele
Tony Dimichele on 9 Jan 2020
Commented: Tony Dimichele on 9 Jan 2020
text(n(2), 25,'Temp','Color','red','FontSize',9) %place text, choose good spot
text(n(2), 20,'Humidity --','Color','blue','FontSize',9) %place text
%the text below places a rectangle around the text above, this is a very
%specific location and neither the text nor rectangle will update location
%if different data is entered, legend for some reason is not functioning
%properly and this is a workaround, manually placing a rectangle in the
%figure window -> right click -> show code will allow you to fix this
%location with different data if legend is still not functioning properly
annotation('rectangle',...
[0.177785714285714 0.262698412698413 0.13352380952381 0.0968253968253969]);
I was up last night for days trying to figure why my legend wasn't displaying properly when I finally took matters into my own hands!
Glad I found the opengl('save,'software') command fix because this was a bit of work as you can see by the massive novel I wrote explaining how to get your graph to display with a legend properly.
Any idea why the opengl command was necessary at all? I'm guessing it is a known bug.

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by