MATLAB Answers

The legend box in plot has no colors

21 ビュー (過去 30 日間)
Arihant Anchalia
Arihant Anchalia 2020 年 4 月 29 日
回答済み: Star Strider 2020 年 5 月 2 日
The legend box in matlab has no colours.
This is the code:
x = linspace(0,pi);
y1 = cos(x);
plot(x,y1,'DisplayName','cos(x)')
hold on
y2 = cos(2*x);
plot(x,y2,'DisplayName','cos(2x)')
hold off
legend

  0 件のコメント

Sign in to comment.

回答 (2 件)

Star Strider
Star Strider 2020 年 5 月 2 日
This is a known problem with recent AMD graphics drivers.
See for example: Lines in legend are missing
Updated drivers that solve this problem may by now be available.
.

  0 件のコメント

Sign in to comment.


Vinai Datta Thatiparthi
Vinai Datta Thatiparthi 2020 年 5 月 2 日
Hey Arihant,
Although I'm unable to reproduce the error that you mention at my end, I have noticed a few instances where other users have reported the same issue. Here are the links to those discussion on the MATLAB Answers forum:
As a workaround, please perform a clean reinstall of MATLAB and update your graphics drivers to get your code to work as expected.
Hope this helps!

  0 件のコメント

Sign in to comment.

タグ


Translated by