自定义不透明度 Plotly 烛台

Custom opacity Plotly candlesticks

我想知道我们是否可以更改烛台的不透明度,使它们与边缘颜色相同?

like that

not like that

import plotly.graph_objects as go

import pandas as pd
from datetime import datetime

df = pd.read_csv(
    "https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv"
)
df = df.head(8)
fig = go.Figure(
    data=[
        go.Candlestick(
            x=df["Date"],
            open=df["AAPL.Open"],
            high=df["AAPL.High"],
            low=df["AAPL.Low"],
            close=df["AAPL.Close"],
        )
    ]
)


fig.update_xaxes(rangebreaks=[{"pattern": "day of week", "bounds": [6, 1]}])

fig.update_traces(
    {
        d: {"fillcolor": c, "line": {"color": c}}
        for d, c in zip(["increasing", "decreasing"], ["red", "green"])
    }
)