如何在Plotly Px.violin中排序值
伙计们!
我正在使用px.violin
绘制不同状态的一些分布我想要它在左第一个位置然后下降,因此第二个应该是科罗拉多州,第三可能是路易斯安那州等。
< img src =“ https://i.sstatic.net/mn5zc.png” alt =“在此处输入图像说明”>
我一直在尝试在natsort 包装,这样做
category_orders = {'state': natsorted(true_percentile_df['price per acre_x'].unique())}
,但似乎没有用。有什么想法吗?)
guys!
i am plotting some distributions across different states using px.violin
and i want to order the stated based on distribution: right now you can see that florida with the biggest variance and higher values is in the middle, while i want it on the first left position and then descending, so second should be colorado, third probably louisiana etc.
i've been trying to do that with the help of natsort
package, doing
category_orders = {'state': natsorted(true_percentile_df['price per acre_x'].unique())}
but that does not seem to be working. any ideas?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用Groupby并按VAR进行排序,就像我在这里完成的或定义自定义订单一样。
希望它会有所帮助。
You could use groupBy and sort by var like I've done here or define a custom order.
Hope it'll help.