Closing radar chart with plotly go.Scatterpolar
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 38/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- plotly, python
调研方向
从第 571 页的雷达图示例开始,检查其 Plotly graph-object trace 如何提供 r 和 theta 值。渲染该页面以确认最后一个点没有连接到第一个点,然后应用并验证一种在不破坏图表的情况下闭合雷达线的解决方案。
由索引模型根据 Issue 内容生成。
描述
Hi,
On this page, the radar charts created with plotly graph objects (go.Scatterpolar) do not close — the line connecting the last point back to the first is missing.
Clearly not on you; this is so typical that the official Plotly documentation does it.
The usual line_close=True method from Plotly Express does not work with Graph Objects. And fig.update_traces(connectgaps=True) does not seem to work with radar coordinates.
A possible workaround (mentioned here) is to manually close the loop by repeating the first point in r and theta:
r = df["value"].tolist() + [df["value"][0]]
theta = df["name"].tolist() + [df["name"][0]]
or
r = [*df["value"], df["value"].iloc[0]]
theta = [*df["name"], df["name"].iloc[0]]
It’s stupid, verbose and inelegant, but (on the plus size) it works.
I haven’t made a PR because this might be too niche to implement (after all, the same behavior exists on the official Plotly site), but I can submit one if needed.
PS: I'm bad at it. I might not be aware of a cleaner solution, so there could be a better way.
- 主要语言
- HTML
- 星标
- 2.3k
- 派生
- 439
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
holtzy/The-Python-Graph-Gallery 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
holtzy/The-Python-Graph-Gallery#542 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 78/100
-
tutorial to add未关闭
难度 3/5 1-2 天 新手友好度 25/100
-
bug未关闭
难度 2/5 1-3 小时 新手友好度 48/100
-
难度 3/5 1-2 天 新手友好度 30/100
查看 holtzy/The-Python-Graph-Gallery 的全部 Issue
相似的 Issue
-
essreduce
难度 2/5 1-3 小时 新手友好度 69/100
维护者通常 1 天内回复
-
effort:S P3
难度 2/5 1-3 小时 新手友好度 79/100
nightscout/nocturne#4902 · 2 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 79/100
openlayers/openlayers#17777 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
OHDSI/Data2Evidence#3796 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100