当前位置:网站首页>Matlab paper illustration drawing template No. 42 - bubble matrix diagram (correlation coefficient matrix diagram)
Matlab paper illustration drawing template No. 42 - bubble matrix diagram (correlation coefficient matrix diagram)
2022-08-03 19:43:00 【Akun's research routine】
在上一篇文章中,分享了Matlab气泡图的绘制模板:
进一步,Suppose we want to visualize a table or matrix,That is, the bubbles are arranged in a matrix,And the size and color of each bubble represent the value of its corresponding feature,应该怎么操作呢?
Take a look at the finished product:
特别提示:Matlab论文插图绘制模板系列,旨在降低大家使用Matlab进行科研绘图的门槛,只需按照模板格式添加相应内容,即可得到满足大部分期刊以及学位论文格式要求的数据插图.如果觉得有用可以分享给你的朋友.
模板中最关键的部分内容:
1. 数据准备
此部分主要是读取数据,Generate matrix coordinate data.
% 读取数据
load data.mat
% Generate matrix coordinate data
[r,c] = size(data);
x = 1:c;
y = 1:r;
[xx,yy] = meshgrid(x,y);
yy = flipud(yy);
其中,利用‘meshgrid’command to generate coordinate data for a matrix.
值得注意的是,在竖直方向,The index numbering order of the matrix is opposite to the positive direction of the coordinate axis,所以使用‘flipud’command to flip the matrix upside down.
2. 颜色定义
由于It needs to be colored according to the size of the feature,So use a gradient color scheme.
这里直接用之前分享的addcolorplus工具的渐变色:
%% 颜色定义
map = addcolorplus(300);
3. Bubble matrix graph drawing
使用‘bubblechart’命令,绘制Unprettified bubble matrix diagram.
bubblechart(xx(:),yy(:),data(:)*10,data(:),'MarkerFaceAlpha',1);
hTitle = title('BubbleMatrix Plot');
hXLabel = xlabel('XAxis');
hYLabel = ylabel('YAxis');
其中, data(:)*10Used to define the bubble size,data(:)Used to define the bubble color,This is just to illustrate the two dimensions of features that can be represented by color and size.
4. 细节优化
为了插图的美观,使用colormap命令赋上之前选择好的颜色.
% 赋色
colormap(map)
然后,使用‘bubblesize’The command defines the size of the smallest and largest bubbles:
% Adjust bubble size
bubblesize([10 30])
进一步,Make adjustments to the axes:
% 坐标轴美化
axis equal
set(gca, 'Box', 'on', ...
'XGrid', 'on', 'YGrid', 'on', ...
'TickDir', 'in', 'TickLength', [0 0], ...
'XMinorTick', 'off', 'YMinorTick', 'off', ...
'XColor', [.1 .1 .1], 'YColor', [.1 .1 .1],...
'XTick', 0:1:c+1,...
'XLim', [0 c+1],...
'YTick', 0:1:r+1,...
'YLim', [0 r+1],...
'XTickLabel',{'','A1','A2','A3','A4','A5','A6','A7','A8','A9','A10',''},...
'YTickLabel',{'','B1','B2','B3','B4','B5','B6','B7','B8','B9','B10',''})
ytickangle(90)
% 添加图例
blgd = bubblelegend('Style','vertical',...
'BubbleSizeOrder','descending',...
'box','off',...
'Location','northeastoutside',...
'NumBubbles',3,... ...
'FontName', 'Helvetica',...
'FontSize', 10);
colorbar('Position',[0.79,0.11,0.03,0.5])
% 字体字号
set(gca, 'FontName', 'Arial', 'FontSize', 10)
set([hXLabel,hYLabel], 'FontName', 'Arial', 'FontSize', 11)
set(hTitle, 'FontSize', 13, 'FontWeight' , 'bold')
% 背景颜色
set(gcf,'Color',[1 1 1])
最后,按照所需分辨率、格式输出图片.
figW = figureWidth;
figH = figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0 0 figW figH]);
fileout = 'test';
print(figureHandle,[fileout,'.png'],'-r300','-dpng');
也可以尝试其它配色:
以上.
完整代码:
边栏推荐
- Reveal how the five operational management level of hundreds of millions of easily flow system
- Power button brush the topic of merging two orderly array
- Shell编程之循环语句
- 危化企业双重预防机制数字化建设进入全面实施阶段
- Compose原理-compose中是如何实现事件分法的
- 力扣刷题之有效的正方形(每日一题7/29)
- 揭秘5名运维如何轻松管理数亿级流量系统
- 关于2022年度深圳市技术攻关重大项目的申报通知
- Redis 内存满了怎么办?这样置才正确!
- 阿洛的反思
猜你喜欢
随机推荐
relocation R_X86_64_PC32 against,/usr/bin/ld: final link failed: Bad value
ADS 2023 Download Link
【leetcode】剑指 Offer II 007. 数组中和为 0 的三个数(双指针)
钱江摩托某型号产品ECU货不对版 消费者知情权应如何保障?
【统计机器学习】线性回归模型
揭秘5名运维如何轻松管理数亿级流量系统
redis常用命令,HSET,XADD,XREAD,DEL等
Postgresql快照优化Globalvis新体系分析(性能大幅增强)
Handler 源码解析
数据驱动的软件智能化开发| ChinaOSC
百利药业IPO过会:扣非后年亏1.5亿 奥博资本是股东
阿里巴巴政委体系-第八章、阿里政委工作方法论
149. The largest number on a straight line, and check the set
如何理解即时通讯开发移动网络的“弱”和“慢”
The ecological environmental protection management system based on mobile GIS
Force is brushed buckle problem for the sum of two Numbers
Postgresql snapshot optimization Globalvis new system analysis (performance greatly enhanced)
Unity gets the actual coordinates of the ui on the screen under the canvas
Execute the mysql script file in the docker mysql container and solve the garbled characters
The effective square of the test (one question of the day 7/29)