最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Polar plots using D3.js - Stack Overflow

programmeradmin6浏览0评论

Does anyone know of good examples producing a polar plot using the D3 Javascript libraries?

I've seen some rose plots like this and this, but I'm really looking for something more similar to the Matlab polar plot:

Any examples would be greatly appreciated. Thanks!

Does anyone know of good examples producing a polar plot using the D3 Javascript libraries?

I've seen some rose plots like this and this, but I'm really looking for something more similar to the Matlab polar plot:

Any examples would be greatly appreciated. Thanks!

Share Improve this question asked Jan 18, 2013 at 17:29 supyosupyo 3,0372 gold badges23 silver badges35 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 18

Sure, here you go:

The function is plotted using d3.svg.line.radial. The background radial grid is implemented as line, circle and text elements. One minor annoyance is that the code needs both radians (for d3.svg.line.radial) and degrees (for SVG’s transform attribute). I used rotated text labels because that was easy to do with SVG, but you could use non-rotated labels if you don’t mind a little trigonometry to position the text labels.

Note carefully the definition of the line’s angle: D3’s radial lines and areas proceed clockwise starting at 12 o’clock, while this plot proceeds counterclockwise starting at 3 o’clock!

Plotly lets you make interactive polar charts with MATLAB, Python, and R. The results are interactive, and rendered with D3.js. You can see a few MATLAB examples (code + interactive graphs) here.











Disclaimer: I'm on the Plotly team.

发布评论

评论列表(0)

  1. 暂无评论