问题描述
我已经安装了 Matlab R2021a,当我为一个向量运行命令 scatterplot
时,我得到如下图:
我的意思是黑色和黄色。但是旧版本的默认颜色如下:
我的意思是颜色是白色和蓝色。
我担心,我需要我的 MATLAB 显示图形的颜色,如旧版本所示,我的意思是白色和蓝色。
解决方法
R2021a 中的行为确实发生了变化,如 release notes 中所述:
使用 eyediagram
和 scatterplot
函数生成的绘图的视觉外观更新。eyediagram
和 scatterplot
函数现在默认提供黑色绘图背景。
您可以通过修改轴/图形的属性来根据您的需要更改颜色,如下所示:
%Taking the example from the documentation
d = (0:63)';
s = qammod(d,64);
scatterplot(s);
%Modifying the colors
h=gca; %Axis handle
h.Title.Color='k' %Color of title
h.Children.Color='b'; %Color of points
h.YColor='k'; %Y-axis color including ylabel
h.XColor='k'; %X-axis color including xlabel
h.Color ='w'; %inside-axis color
h.Parent.Color='w' %outside-axis color
无需修改,我们得到:
修改后,根据需要,我们得到: