当前位置:网站首页>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');
也可以尝试其它配色:
以上.
完整代码:
边栏推荐
- Postgresql-xl全局快照与GTM代码走读(支线)
- 阿里巴巴政委体系-第八章、阿里政委工作方法论
- tensorflow-gpu2.4.1安装配置详细步骤
- ScrollView嵌套RV,滑动有阻力不顺滑怎么办?
- 1161 最大层内元素和——Leetcode天天刷【BFS】(2022.7.31)
- FreeRTOS Intermediate
- Force is brushed buckle problem for the sum of two Numbers
- pytorch框架实现老照片修复功能详细演示(GPU版)
- 622 设计循环队列——Leetcode天天刷【循环队列,数组模拟,双指针】(2022.8.2)
- JS 内置构造函数 扩展 prototype 继承 借用构造函数 组合式 原型式creat 寄生式 寄生组合式 call apply instanceof
猜你喜欢
【夜莺监控方案】08-监控msyql集群(prometheuse+n9e+mysqld_exporter)
安装radondb mysql遇到问题
MySQL基础
Jingdong cloud released a new generation of distributed database StarDB 5.0
Node version switching tool NVM and npm source manager nrm
Kettle 读取 Excel 数据输出到 Oracle 详解
高位套牢机构,用友网络的信任危机是如何产生的?
Introduction to Cosine Distance
Word另存为PDF后无导航栏解决办法
揭秘5名运维如何轻松管理数亿级流量系统
随机推荐
力扣刷题之合并两个有序数组
Kettle 读取 Excel 数据输出到 Oracle 详解
Postgresql快照优化Globalvis新体系分析(性能大幅增强)
告诉你0基础怎么学好游戏建模?
List类的超详细解析!(超2w+字)
Network protocol-TCP, UDP difference and TCP three-way handshake, four wave
梅科尔工作室-14天华为培训七
MySQL master-slave, 6 minutes you master!
CS免杀姿势
1161 最大层内元素和——Leetcode天天刷【BFS】(2022.7.31)
Unity获取canvas 下ui 在屏幕中的实际坐标
ADS 2023 Download Link
Anaconda 虚拟环境迁移
ADS 2023 下载链接
MySQL 主从,6 分钟带你掌握!
ctfshow php features
MySQL Basics
ECCV 2022 Oral | 满分论文!视频实例分割新SOTA: IDOL
不要再用if-else
dpkg强制安装软件