Mathematica中文论坛-非官方

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 433|回复: 0
打印 上一主题 下一主题

豆粑粑 matlab polarhistogram 极坐标的bar图

[复制链接]

590

主题

675

帖子

3445

积分

论坛元老

Rank: 8Rank: 8

积分
3445
跳转到指定楼层
楼主
发表于 2025-11-11 11:20:53 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式
给小LY画图,用的是python 实现的,
我想在matlab中也实现一下。

  1. clear all
  2. clc
  3. close all
  4. % clf

  5. 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];
  6. nbins = 6;
  7. thetaBins = linspace(0,2*pi,nbins+1);
  8. counts = histcounts(theta, thetaBins);
  9. figure
  10. tcl = tiledlayout(1,2);
  11. nexttile(tcl)
  12. polarhistogram(theta,nbins)
  13. title('polarhistogram')
  14. pax = polaraxes(tcl);
  15. pax.Layout.Tile = 2;
  16. hold(pax,'on')
  17. % faceColor = turbo(nbins);  % choose your face colors
  18. faceColor = jet(nbins);
  19. for i = 1:numel(counts)
  20.     polarhistogram(pax,'BinEdges',thetaBins(i:i+1),'BinCounts',counts(i), ...
  21.         'FaceColor', faceColor(i,:), ...
  22.         'FaceAlpha', 0.3, ...  % to match image in OP's question
  23.         'EdgeColor','w')     % to match image in OP's question
  24. end
  25. title('loop')

  26. h=gcf;
  27. fi_na='./fig_polarhistogram';
  28. fun_work_li_035_myfig_out(h,fi_na,3);
复制代码


fig_polarhistogram.png (239.69 KB, 下载次数: 109)

fig_polarhistogram.png
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|Mathematica中文论坛-非官方 ( 辽ICP备16001491号-1

GMT+8, 2025-11-23 05:44 , Processed in 0.106440 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表