在之前的文章中,分享了Matlab极坐标气泡图的绘制模板:

进一步,再来分享一下极坐标分组气泡图。
先来看一下成品效果:

特别提示:本期内容『数据+代码』已上传资源群中,加群的朋友请自行下载。有需要的朋友可以关注同名公号【阿昆的科研日常】,后台回复关键词【绘图桶】查看加入方式。
模板中最关键的部分内容:
1. 数据准备
此部分主要是读取数据并初始化绘图参数。
% 读取数据load data.mat% 初始化绘图参数R1 = r1;R2 = r2;TH1 = th;TH2 = th;SZ1 = sz1;SZ2 = sz2;
2. 颜色定义
作图不配色就好比做菜不放盐,总让人感觉少些味道。
但颜色搭配比较考验个人审美,需要多加尝试。
这里直接使用TheColor配色工具中的SCI权威配色库:
%% 颜色定义map = TheColor('sci',512);C1 = repmat(map(1,1:3),10,1);C2 = repmat(map(2,1:3),10,1);

3. 极坐标分组气泡图绘制
通过调用‘polarbubblechart’命令,绘制初始极坐标分组气泡图。
t = tiledlayout(1,1);nexttilep1 = polarbubblechart(TH1,R1,SZ1,C1);hold onp2 = polarbubblechart(TH2,R2,SZ2,C2);hTitle = title('Polarbubble chart');bubblesize([7 30])
4. 细节优化
为了插图的美观,对坐标轴细节等进行美化:
% 坐标区调整set(gca, 'LineWidth',1,... % 线宽'RGrid','on','ThetaGrid','on',... % 网格'GridColor',[0 0 0],... % 网格颜色'ThetaZeroLocation','right',... % 极角0位置'TickDir', 'out', 'TickLength', [0 0], ... % 刻度'RMinorTick', 'off', 'ThetaMinorTick', 'off', ... % 小刻度'RAxisLocation',270,... % 极径标签位置'RLim',[0 40],... % 极径范围'ThetaDir', 'clockwise') % 极角方向% legendhLegend = legend('Sample1','Sample2','Linewidth',0.5);hLegend.Layout.Tile = 'east';% 气泡尺寸blgd = bubblelegend('Sz');blgd.Layout.Tile = 'east';bt = get(blgd,'Title');bt.FontWeight = 'normal';bt.FontName = 'Arial';bt.FontSize = 9;% 字体和字号set(gca, 'FontName', 'Arial', 'FontSize', 11)set(hTitle, 'FontName', 'Arial', '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');

以上。