失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > matlab调用函数画图 matlab画图之pcolor函数

matlab调用函数画图 matlab画图之pcolor函数

时间:2024-05-04 02:28:38

相关推荐

matlab调用函数画图 matlab画图之pcolor函数

画一个网络节点连接关系色彩图代码

主要调用函数pcolor, colorbar,colormap

clear;clc;

map=2*(rand(10)-0.5);

pcolor(map);

colorbar;

axis off;

其中colorbar函数会自动匹配map里面值的大小。

结果如下:

但是细看会有问题,画的图少了一行,查看pcolor帮助文档

里面说默认的shadding模式为faceted,shadding总共3种模式,faceted(默认的),interp(对每个像素点插值),flat(去除方块黑线)。

还有就是pcolor如果不设定X,Y的话是按照1—2,2—3,3—4……作为一块涂色,为此设置X,Y,让画图小方块移到0.5—1.5,1.5—2.5……,这样一会儿可以直接在小方块对应的中心设置坐标。

function result=plotMatricNet_15(Features,Featuresweight)

figure

% 由于pcolor函数不处理最后一行和最后一列,所以这里补一行一列

weightMetrics=zeros(16);

Featuresweight=abs(Featuresweight);

for i=1:length(Features)

edge=Features(i);

[row,col]=electrodesIndex(edge,15);

weightMetrics(row,col)=Featuresweight(i);

weightMetrics(col,row)=Featuresweight(i);

end

% weightMetrics=maxmin(weightMetrics);

[X,Y]=meshgrid(0.5:1:15.5,0.5:1:15.5);

pcolor(X,Y,weightMetrics);

colorbar;

colormap(flipud(hot));

set(gca,'YTick',[1:1:15]);

set(gca,'XTick',[1:1:15]);

set(gca,'XTickLabel',{'F3','FZ','F4','FC3','FCZ','FC4','C3','CZ','C4','CP3','CPZ','CP4','P3','PZ','P4','null'})

set(gca,'YTickLabel',{'F3','FZ','F4','FC3','FCZ','FC4','C3','CZ','C4','CP3','CPZ','CP4','P3','PZ','P4','null'})

% shading flat;

% axis off;

result=true;

原文:/zhangzhengyi03539/article/details/44942083

如果觉得《matlab调用函数画图 matlab画图之pcolor函数》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。