我可以在极坐标条形图中制作分组条形吗?
我有一个极坐标条形图,其中有堆积条形图,这也使用我添加的代码给出了下图(此处找到的示例:风行图):
import plotly.io as pio
pio.renderers.default = 'svg'
#pio.renderers.default = 'browser'
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
df = px.data.wind()
fig = px.bar_polar(df, r="frequency", theta="direction",
color="strength", template="ggplot2",
color_discrete_sequence= px.colors.sequential.Plasma_r)
fig.show()
fig.update_layout(legend=dict(
orientation="h",
yanchor="top",
y=-0.2,
xanchor="center",
x=0.5),
polar=dict(radialaxis=dict(showticklabels=True, ticks='', dtick=1, linewidth=0)
)
)
fig.update_polars(angularaxis_dtick=1,
angularaxis_exponentformat="power")
fig.show()
现在,我想将一些条形图分组在一起,类似于下图(示例 python 图库):
我无法弄清楚如何用情节来做到这一点我保留了堆积条和分组。任何提示或建议将不胜感激。
谢谢!
I have a polar bar chart with stacked bars in plotly, which gives me the figure below using the code I've added as well (example found here: Wind Rode Charts):
import plotly.io as pio
pio.renderers.default = 'svg'
#pio.renderers.default = 'browser'
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
df = px.data.wind()
fig = px.bar_polar(df, r="frequency", theta="direction",
color="strength", template="ggplot2",
color_discrete_sequence= px.colors.sequential.Plasma_r)
fig.show()
fig.update_layout(legend=dict(
orientation="h",
yanchor="top",
y=-0.2,
xanchor="center",
x=0.5),
polar=dict(radialaxis=dict(showticklabels=True, ticks='', dtick=1, linewidth=0)
)
)
fig.update_polars(angularaxis_dtick=1,
angularaxis_exponentformat="power")
fig.show()
Now, I would like to group some bars together, similar to the figure below (examples python graph gallery):
I cannot figure out how to do this with plotly so I keep both the stacked bars AND the grouping. Any hint or suggestions would be highly appreciated.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论