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

조회 수: 5 (최근 30일)
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.

답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by