自定义不透明度 Plotly 烛台
Posted
技术标签:
【中文标题】自定义不透明度 Plotly 烛台【英文标题】:Custom opacity Plotly candlesticks 【发布时间】:2022-01-04 05:43:20 【问题描述】:我想知道我们是否可以改变烛台的不透明度,使它们与边缘颜色相同?
like that
not like that
【问题讨论】:
【参考方案1】: 使用https://plotly.com/python/candlestick-charts/#simple-candlestick-with-pandas 拥有MWE 为增加和减少显式设置fillcolor和line_color的简单案例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"])
)
【讨论】:
太棒了***.com/help/someone-answers以上是关于自定义不透明度 Plotly 烛台的主要内容,如果未能解决你的问题,请参考以下文章
Plotly:如何使用 plotly express 自定义 xaxis 刻度标签?