我想按照预定义的顺序创建一个 * treemap *,但是我不知道如何操作由plotly
* treemap * 定义的层次结构。
下面是我创建的 * 树形图 *:
在这里,我希望O
位于U
框的上方,UR
是唯一的列,而不使用NA
分割其空间。
下面是我的代码:
import plotly.graph_objects as go
fig = go.Figure(go.Treemap(
labels = ["DR","1,2","D 1","D 2","O","U",
"3,4,5","P","B","Pe",
"6,7,8","F","C","Pl",
"9","UR",
"10","NA"],
parents = ["", "DR", "1,2","1,2","1,2","1,2","DR","3,4,5","3,4,5","3,4,5",
"DR","6,7,8","6,7,8","6,7,8",
"DR","9",
"DR","10"],
marker_colors = ["lightgrey",
"lightblue", "cornflowerblue", "cornflowerblue","goldenrod","green",
"lightblue","lightgray","chocolate","cadetblue",
"lightblue","grey",'chocolate',"saddlebrown",
"salmon","salmon",
"burlywood","burlywood",
],
branchvalues="total"
))
fig.update_layout(margin = dict(t=10, l=60, r=25, b=30))
fig.show()
非常感谢!
我试过为每个矩形创建值,但没有帮助,也没有像预期的那样工作。
1条答案
按热度按时间klr1opcd1#
你需要参数
tiling
,我想这就是你要的。