当前位置:网站首页>Matlab paper illustration drawing template No. 41 - bubble chart (bubblechart)
Matlab paper illustration drawing template No. 41 - bubble chart (bubblechart)
2022-08-02 06:09:00 【Akun's research routine】
shared in previous articlesMatlabA drawing template for a scatter bubble chart:
say bubble chart,Basically a scatterplot,Not very standard as a dissertation illustration.
所以,Let me share this timeMatlab自带气泡图的绘制模板.
先来看一下成品效果:
特别提示:Matlab论文插图绘制模板系列,旨在降低大家使用Matlab进行科研绘图的门槛,只需按照模板格式添加相应内容,即可得到满足大部分期刊以及学位论文格式要求的数据插图.如果觉得有用可以分享给你的朋友.
模板中最关键的部分内容:
1. 数据准备
此部分主要是读取数据,定义各变量.
% 读取数据
load data.mat
% x坐标
xx = data(:,1);
% y坐标
yy = data(:,2);
% 特征(Feature size corresponds to color/点的尺寸)
sz = data(:,3);
2. 颜色定义
颜色搭配比较考验个人审美,需要多加尝试.
这里直接用之前分享的addcolorplus工具中的渐变色:
%% 颜色定义
map = addcolorplus(300);
3. 气泡图绘制
使用‘bubblechart’命令,Draw an unglamorized bubble chart.
bubblechart(xx, yy, sz, sz,'MarkerFaceAlpha',0.7);
hTitle = title('BubbleChart');
hXLabel = xlabel('XAxis');
hYLabel = ylabel('YAxis');
其中,第一个‘sz’Indicates the size of the bubble,第二个‘sz’Indicates the color of the bubble,Here I use the same feature,如果有需要,Another feature can be represented by bubble color.
值得一提的是,bubblechart函数需要Matlab R2020b以上.
4. 细节优化
为了插图的美观,利用’colormap’命令赋上之前选择好的颜色:
% 赋色
colormap(map)
进一步,添加图例,Adjust the font size、背景颜色等属性:
% 坐标轴美化
set(gca, 'Box', 'on', ... % 边框
'XGrid', 'off', 'YGrid', 'off', ... % 网格
'TickDir', 'in', 'TickLength', [.01 .01], ... % 刻度
'XMinorTick', 'off', 'YMinorTick', 'off', ... % 小刻度
'XColor', [.1 .1 .1], 'YColor', [.1 .1 .1],... % 坐标轴颜色
'XTick', 0:2:24,... % 坐标区刻度、范围
'XLim', [0 23],...
'YTick', 0:0.2:1.2,...
'YLim', [0 1.2])
% 添加图例
blgd = bubblelegend('Style','vertical',...
'BubbleSizeOrder','descending',...
'box','off',...
'Location','northeastoutside',...
'NumBubbles',3,... ...
'FontName', 'Helvetica',...
'FontSize', 9);
colorbar('Position',[0.79,0.11,0.03,0.4])
% 字体和字号
set(gca, 'FontName', 'Helvetica')
set([hXLabel, hYLabel], 'FontName', 'AvantGarde')
set(gca, 'FontSize', 10)
set([hXLabel, hYLabel], 'FontSize', 11)
set(hTitle, 'FontSize', 12, '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');
也可以尝试其它配色:
以上.
获取方式:
边栏推荐
猜你喜欢
从DES走到AES(现代密码的传奇之路)
The practice of alibaba, data synchronization component canal
Detailed explanation of AMQP protocol
MySQL如何对SQL做prepare预处理(解决IN查询SQL预处理仅能查询出一条记录的问题)
MySQL安装常见报错处理大全
go项目的打包部署
interrupt()、interrupted()和isInterrupted()你真的懂了吗
如何运用3DGIS技术整合智慧社区综合管理解决方案
Navicat如何连接MySQL
Digicert EV证书签名后出现“证书对于请求用法无效”的解决方案
随机推荐
ZCMU--1891: kotomi and game(C语言)
【疑问】最终推荐的loose pattern 如果依赖module 没有加载完毕,行为如何,是否报错
ORA-04044:此处不允许过程、函数、程序包或类型,系统分析与解决
【无标题】
UE4 事件图表不小心拉了很远,找不到一开始创建的节点
MP更新操作方式
元宇宙:活在未来
一线大厂软件测试流程(思维导图)详解
Liquidated damages are too high"
UE4 蓝图实现AI随机移动
转:张五常:比知识更重要的,是思维方式
力扣 2127. 参加会议的最多员工数 拓扑剪枝与2360补充
MySQL安装教程
mysql安装教程【安装版】
UE4 局域网联机案例
Mysql 回表
mysql实现按照自定义(指定顺序)排序
【云原生】什么是CI/CD? | CI/CD 带来的好处
11种你需要了解的物联网(IoT)协议
MySQL安装常见报错处理大全