0
我有一個甜甜圈圖表,有低百分比值的類。我想從甜甜圈圖表中隱藏這些標籤。用這種方式,作爲默認情節,我認爲他們很混亂。在甜甜圈圖中隱藏低百分比
我的代碼:
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode()
#Dados (values)
dado_app_nascente = groupped_app_veg.loc[groupped_app_veg["app"] == "Entorno nascente", "area_ha"]
dado_app_rio = groupped_app_veg.loc[groupped_app_veg["app"] == "Margem de curso d'água", "area_ha"]
#Legenda ("labels")
label_app_nascente = groupped_app_veg.loc[groupped_app_veg["app"] == "Entorno Nascente", "class_name"].str.title()
label_app_rio = groupped_app_veg.loc[groupped_app_veg["app"] == "Margem de curso d'água", "class_name"].str.title()
#Cores ("marker": {"color"})
c_app_nascente = list(groupped_app_veg.loc[groupped_app_veg["app"] == "Entorno nascente", "color"])
c_app_rio = list(groupped_app_veg.loc[groupped_app_veg["app"] == "Margem de curso d'água", "color"])
fig = {
"data": [
{
"values": dado_app_nascente,
"labels": label_app_nascente,
"domain": {"x": [0, .48]},
"name": "area_entorno_nascente",
#"hoverinfo":"label+percent+name",
"textposition":"inside",
"hole": .4,
"type": "pie",
"marker": {'colors': c_app_nascente},
"showlegend": False
},
{
"values":dado_app_rio,
"labels": label_app_rio,
"textposition":"inside",
"domain": {"x": [.52, 1]},
"name": "area_margem_rio",
#"hoverinfo":"label+percent+name",
"hole": .4,
"type": "pie",
"marker": {'colors': c_app_rio},
}],
"layout": {
"title":"PROPORÇÃO DE CLASSES: VEGETAÇÃO/USO DO SOLO",
"width": 1000,
"height": 500,
"annotations": [
{
"font": {
"size": 18
},
"showarrow": False,
"text": "NASCENTE",
"x": 0.175,
"y": 0.5
},
{
"font": {
"size": 18
},
"showarrow": False,
"text": "RIO",
"x": 0.785,
"y": 0.5
},
{
"font": {
"size": 14
},
"showarrow": False,
"text": "Área Preservação Permanente",
"x": 0.555,
"y": 1.135
},
]
}
}
plotly.offline.iplot(fig)
迭代您的數據事先並將小於(x%)的分組分組爲「其他」類別RY? – Aaron