Wie entferne ich Glühen auf Knotenbezeichnungen im Sankey -Diagramm in der Handlung in Strom.Python

Python-Programme
Anonymous
 Wie entferne ich Glühen auf Knotenbezeichnungen im Sankey -Diagramm in der Handlung in Strom.

Post by Anonymous »

Ich versuche, den "Glühen" oder den Schatteneffekt um die Knotenetiketten dieses Handlungsdiagramms loszuwerden. Ist das möglich? < /P>

Code: Select all

import pandas as pd
import plotly.graph_objects as go
import streamlit as st

# Data
data = {
"source": ["Total Orders", "Total Orders", "Total Orders"],
"target": ["Kit", "Other", "Rx"],
"value": [138000, 34500, 28000]
}

# Create Pandas DataFrame
sankey_table = pd.DataFrame(data)

# Create a list of unique labels
labels = pd.concat([sankey_table["source"], sankey_table["target"]]).unique().tolist()

# Create a dictionary to map labels to indices
label_indices = {label: idx for idx, label in enumerate(labels)}

# Apply mapping to source and target columns
sankey_table["source_index"] = sankey_table["source"].apply(lambda x: label_indices[x])
sankey_table["target_index"] = sankey_table["target"].apply(lambda x: label_indices[x])

# Extract data for the Sankey diagram
source_indices = sankey_table["source_index"].tolist()
target_indices = sankey_table["target_index"].tolist()
values = sankey_table["value"].tolist()

# set colors
node_colors = ["grey", "#213A51", "#32526E", "#BEA069"]
link_colors = ["rgba(33, 58, 81, 0.7)", "rgba(50, 82, 110, 0.7)", "rgba(190, 160, 105, 0.7)"]  # Colors for the links from 'Total Orders' to 'Kit', 'Other', 'Rx'

# Create Sankey diagram
sankey_fig = go.Figure(data=[go.Sankey(
node=dict(
pad=15,
thickness=20,
line=dict(color="black", width=0.5),
label=labels,
color=node_colors
),
link=dict(
source=source_indices,
target=target_indices,
value=values,
color=link_colors
)
)])

sankey_fig.update_layout(
title_text="Product Subtotals Sankey Diagram",
font=dict(
family="Courier New",
size=14,
color="black"
)
)

st.plotly_chart(sankey_fig)
< /code>
Bisher habe ich versucht: < /p>
[list]
[*]update_layout
Um die Schriftfamilie, Farbe und Größe zu ändern
[*] CSS, um den Schriftart zu manuell zu ändern

Code: Select all

node
und link Optionen, indem Einstellungen in der GO.Sankey -Trace
[/list]
Kommentare aus diesem Beitrag vorgeschlagen werden, schlagen Sie die Verwendung von Dark -Modus vor, aber ich kann dies nicht tun, da dies nicht mit dem erforderlichen Ästhetik/Branding meiner Kunden übereinstimmt. Die Schriftfärbung und das Glanz machen es schwierig, die Beschriftungen zu lesen.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post