【MATLAB基础绘图第17棒】绘制玫瑰图

玫瑰图(Nightingale Rose Chart)

玫瑰图(Nightingale Rose Chart),又名鸡冠花图(Coxcomb Chart)、极坐标区域图(Polar Area Diagram),是极坐标化的柱图,可以将其理解为披着饼图外皮的柱状图。

风玫瑰图(WindRose)

风玫瑰图(Wind rose diagram)是一种特殊的极坐标堆叠图/统计直方图,其能够直观地表示某个地区一段时期内风向、风速的发生频率。

准备工作:WindRose工具包下载

由于Matlab中未收录风玫瑰图的绘制函数,因此需要大家自行设法解决。此处,采用WindRose工具包绘制风玫瑰图。

MATLAB帮助-Wind Rose
在这里插入图片描述

案例

案例1:基础绘图

MATLAB代码如下:

clc
close all
clear
%% 函数说明-风玫瑰图绘制

pathFigure= '.\Figures\' ;
figureUnits = 'centimeters';
figureWidth = 18; 
figureHeight = 15;

%% 导入数据

load('data.mat');
direction = data(:,1);    % 风向
speed = data(:,2);         % 风速

%% 开始绘图

Options = {'anglenorth',0,...     'The angle in the north is 0 deg (this is the reference from our data, but can be any other)
           'angleeast',90,...              'The angle in the east is 90 deg
           'labels',{'N (0°)','NE (45°)','E (90°)','SE (135°)','S (180°)','SW (225°)','W (270°)','NW (315°)'},... 'If you change the reference angles, do not forget to change the labels.
           'freqlabelangle',45};
figureHandle = WindRose(direction,speed,Options);
set(gcf, 'Units', figureUnits, 'Position', [0 0 figureWidth figureHeight]);
set(gca,'FontSize',12,'Fontname', 'Times New Roman');

其中,‘Options’为自定义绘图参数集,包括标签、标题、图例、配色、组数等等,可以根据自己的需要进行设置。

成图如下所示:
在这里插入图片描述
绘制完成后,按所需格式、分辨率导出图像:

str= strcat(pathFigure, "风玫瑰图", '.tiff');
print(gcf, '-dtiff', '-r600', str);

参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WW、forever

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值