|
|
给小LY画图,用的是python 实现的,
我想在matlab中也实现一下。
- clear all
- clc
- close all
- % clf
- theta = [0.1 1.1 5.4 3.4 2.3 4.5 3.2 3.4 5.6 2.3 2.1 3.5 0.6 6.1];
- nbins = 6;
- thetaBins = linspace(0,2*pi,nbins+1);
- counts = histcounts(theta, thetaBins);
- figure
- tcl = tiledlayout(1,2);
- nexttile(tcl)
- polarhistogram(theta,nbins)
- title('polarhistogram')
- pax = polaraxes(tcl);
- pax.Layout.Tile = 2;
- hold(pax,'on')
- % faceColor = turbo(nbins); % choose your face colors
- faceColor = jet(nbins);
- for i = 1:numel(counts)
- polarhistogram(pax,'BinEdges',thetaBins(i:i+1),'BinCounts',counts(i), ...
- 'FaceColor', faceColor(i,:), ...
- 'FaceAlpha', 0.3, ... % to match image in OP's question
- 'EdgeColor','w') % to match image in OP's question
- end
- title('loop')
- h=gcf;
- fi_na='./fig_polarhistogram';
- fun_work_li_035_myfig_out(h,fi_na,3);
复制代码
|
|