1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | A=[ 1.00 0.96 0.98 0.88 0.94 0.61 0.96 0.80 0.98 0.89 0.96 1.00 0.94 0.90 0.95 0.71 0.96 0.83 0.90 0.88 0.98 0.94 1.00 0.84 0.91 0.54 0.93 0.73 0.97 0.90 0.88 0.90 0.84 1.00 0.89 0.85 0.94 0.94 0.80 0.82 0.94 0.95 0.91 0.89 1.00 0.72 0.94 0.84 0.90 0.90 0.61 0.71 0.54 0.85 0.72 1.00 0.74 0.90 0.48 0.64 0.96 0.96 0.93 0.94 0.94 0.74 1.00 0.90 0.92 0.87 0.80 0.83 0.73 0.94 0.84 0.90 0.90 1.00 0.70 0.75 0.98 0.90 0.97 0.80 0.90 0.48 0.92 0.70 1.00 0.85 0.89 0.88 0.90 0.82 0.90 0.64 0.87 0.75 0.85 1.00]; mat = A; %# A n-by-n matrix of random values from 0 to 1 imagesc (mat); %# Create a colored plot of the matrix values colormap ( flipud (gray)); %# Change the colormap to gray (so higher values are %# black and lower values are white) textStrings = num2str (mat(:), '%0.2f' ); %# Create strings from the matrix values textStrings = strtrim ( cellstr (textStrings)); %# Remove any space padding [x,y] = meshgrid (1:10); %# Create x and y coordinates for the strings,it should be set based on the number of labels. hStrings = text (x(:),y(:),textStrings(:),... %# Plot the strings 'HorizontalAlignment' , 'center' ); midValue = mean ( get ( gca , 'CLim' )); %# Get the middle value of the color range set ( gca , 'XTick' ,1:10,... %# Change the axes tick marks 'XTickLabel' ,{ '能源' , '材料' , '工业' , '可选消费' , '日常消费' , '医疗保健' , '金融' , '信息技术' , '电信服务' , '公共事业' },... %# and tick labels 'YTick' ,1:10,... 'YTickLabel' ,{ '能源' , '材料' , '工业' , '可选消费' , '日常消费' , '医疗保健' , '金融' , '信息技术' , '电信服务' , '公共事业' },... 'TickLength' ,[0 0]); [x,y] = meshgrid (1:10); %# Create x and y coordinates for the strings hStrings = text (x(:),y(:),textStrings(:),... %# Plot the strings 'HorizontalAlignment' , 'center' ); midValue = mean ( get ( gca , 'CLim' )); %# Get the middle value of the color range textColors = repmat (mat(:) > midValue,1,3); %# Choose white or black for the %# text color of the strings so %# they can be easily seen over %# the background color set (hStrings,{ 'Color' }, num2cell (textColors,2)); %# Change the text colors |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧