R 如何使用plotly在Sankey图表中永久显示节点上的值?
我在SAP Analytics Cloud的R可视化中使用了该代码。此时,值仅在将鼠标悬停在节点上时显示。但是控制者希望在节点上永久地看到值。 这是我目前的代码:R 如何使用plotly在Sankey图表中永久显示节点上的值?,r,plotly,sankey-diagram,R,Plotly,Sankey Diagram,我在SAP Analytics Cloud的R可视化中使用了该代码。此时,值仅在将鼠标悬停在节点上时显示。但是控制者希望在节点上永久地看到值。 这是我目前的代码: #input data Sys.setlocale("LC_ALL", "de_DE.UTF-8") library('plotly') plot_ly( type = 'sankey', orientation = 'v', textfont = list(size=15),
#input data
Sys.setlocale("LC_ALL", "de_DE.UTF-8")
library('plotly')
plot_ly(
type = 'sankey',
orientation = 'v',
textfont = list(size=15),
node = list(
label = c("Net Sales III", "Gross Margin", "Costs of Material",
"Base Contribution", "Bonus/Malus(incl. Leftover)", "Service Charge Division Costs", "Logistic Costs",
"EBIT", "Fixed Costs Sales", "Marketing Costs"),
x = c(0,0.3, 0.3, 0.6, 0.6, 0.6, 0.6, 0.9, 0.9, 0.9),
y = c(0.1,0.25, 0.8, 0.13, 0.3, 0.4, 0.6, 0.055, 0.2, 0.3),
color = c("C0A468", "C0A468", "EDD38E","C0A468", "EDD38E","EDD38E", "EDD38E","C0A468", "EDD38E", "EDD38E") ,
pad = 30, # Zwischenraum
thickness = 30, #Dicke der Nodes
line = list(
color = "black",
width = 1
)
),
link = list(
source = c(0,0,1,1,1,1,3,3,3),
target = c(1,2,3,4,5,6,7,8,9),
value = c(R_BHP_L_GCO_001_PCA_G002_Sankey$'Gross Margin',
-R_BHP_L_GCO_001_PCA_G002_Sankey$'Costs of Material',
R_BHP_L_GCO_001_PCA_G002_Sankey$'Base Contribution',
R_BHP_L_GCO_001_PCA_G002_Sankey$'Bonus/Malus (incl. Leftover)',
-R_BHP_L_GCO_001_PCA_G002_Sankey$'Service Charge Division Costs',
-R_BHP_L_GCO_001_PCA_G002_Sankey$'Logistic Costs',
R_BHP_L_GCO_001_PCA_G002_Sankey$'EBIT',
-R_BHP_L_GCO_001_PCA_G002_Sankey$'Fixed Costs Sales - POS'-R_BHP_L_GCO_001_PCA_G002_Sankey$'Fixed Costs Sales without POS',
-R_BHP_L_GCO_001_PCA_G002_Sankey$'Marketing Costs - POS'-R_BHP_L_GCO_001_PCA_G002_Sankey$'Marketing Costs without POS'),
color = c("rgba(200,200,200,1)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,1)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,1)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,0.2)",
"rgba(200,200,200,0.2)")
)
)