在Matlab中绘制一个图

use*_*rld 3 matlab

我在MATLAB中有一系列的点,我想用相同的颜色绘制它们但程度不同,所以第一个点是深蓝色,然后第二个点必须比第一个点,依此类推.

例:

   a = [1:100];
   plot(a,a,'*');

   then point (1,1) will be very dark red ,,, and point (100,100) will be very very light red
Run Code Online (Sandbox Code Playgroud)

我可以在MATLAB中使用大尺寸数组吗?

谢谢,

Gun*_*uyf 5

使用带有颜色参数和色彩映射的散点图:

x = linspace(0,2*pi,100);
y = sin(x);
a = [1:100];
dotsize=25;
clridx = 1:100;
scatter(x,y,dotsize,clridx,'fill');

% create the colormap:
color1=[25 25 112]/255; % Midnight Blue
color2=[135 206 250]/255;% Light Sky Blue
numcolors = numel(clridx);
% create the gradients
clrmap = cell2mat(arrayfun(@(a,b)linspace(a,b,numcolors )',color1,color2,'uni',false));

% set the colormap
colormap(clrmap);
Run Code Online (Sandbox Code Playgroud)

散射颜色渐变

或者如果它变得太慢,你可以试试这个替代方案:matlab:散布具有大量数据点的图