Вот код
Код: Выделить всё
import altair as alt
# Determine the minimum and maximum values for the y-axis
y_min = price_data["close"].min()
y_max = price_data["close"].max()
# Create the chart with adjusted y-axis
alt.Chart(price_data).mark_area(
line={'color': 'darkgreen'},
color=alt.Gradient(
gradient='linear',
stops=[alt.GradientStop(color='white', offset=0),
alt.GradientStop(color='darkgreen', offset=1)],
x1=1,
x2=1,
y1=1,
y2=0
)
).encode(
alt.X('date:T', title="Date"),
alt.Y('close:Q', scale=alt.Scale(domain=[y_min, y_max]), title="Close Price")
).properties(
title=f"{symbol} Price Trend"
)
Вот полученное изображение:

Я пытался создать диаграмма с областями с градиентной заливкой из от зеленого к белому.
Подробнее здесь: https://stackoverflow.com/questions/792 ... from-chart
Мобильная версия