当前位置:网站首页>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');
也可以尝试其它配色:
以上.
完整代码:
边栏推荐
- 【leetcode】剑指 Offer II 007. 数组中和为 0 的三个数(双指针)
- 阿里巴巴政委体系-第五章、阿里政委体系建设
- 从文本匹配到语义相关——新闻相似度计算的一般思路
- ECCV2022 | 用于视频问题回答的视频图Transformer
- Line the last time the JVM FullGC make didn't sleep all night, collapse
- 按需视觉识别:愿景和初步方案
- Network protocol-TCP, UDP difference and TCP three-way handshake, four wave
- 梅科尔工作室-14天华为培训七
- LOL英雄联盟卡顿掉帧问题解决办法 2022年8月1日
- MySQL 主从,6 分钟带你掌握!
猜你喜欢
基础软件与开发语言开源论坛| ChinaOSC
面试突击:什么是粘包和半包?怎么解决?
小马智行起诉擎天智卡:索赔6000万 彭军称要斗争到底
Reveal how the five operational management level of hundreds of millions of easily flow system
安装anaconda并创建虚拟环境
2022 CCF中国开源大会会议通知(第三轮)
Benchmarking Lane-changing Decision-making for Deep Reinforcement Learning
「游戏建模干货」建模大师几步操作,学习经典,赶紧脑补一下吧
【STM32】标准库-自定义BootLoader
按需视觉识别:愿景和初步方案
随机推荐
DeepMCP网络详解
Postgresql-xl全局快照与GTM代码走读(支线)
虚拟机vmware设置nat模式上网
宁德时代2号人物黄世霖辞任副董事长:身价1370亿
开源教育论坛| ChinaOSC
Postgresql source code (64) Query execution - data structure and execution process before submodule Executor (2) execution
php根据两点经纬度计算距离
awk语法-02-运算、数组、格式化输出
Compose原理-compose中是如何实现事件分法的
Power button brush the topic of merging two orderly array
怎么将自己新文章自动推送给自己的粉丝(巨简单,学不会来打我)
Handler 源码解析
matplotlib画polygon, circle
Jingdong cloud released a new generation of distributed database StarDB 5.0
梅科尔工作室-14天华为培训七
高性能计算软件与开源生态| ChinaOSC
面试突击:什么是粘包和半包?怎么解决?
FreeRTOS Intermediate
The addition and subtraction of the score of the force deduction brush question (a daily question 7/27)
node版本切换工具NVM以及npm源管理器nrm