我希望保持我的阴影区域透明度足够高,以便看到下面的网格。这三个表面最终呈现出不同的灰度。我希望它们都像第一个一样看起来。示例:
输出:
import altair as alt
from vega_datasets import data
source = data.cars()
source['Start'] = 100
source['Middle'] = 175
source['End'] = 250
cars = alt.Chart(source).mark_circle(size=100).encode(
x=alt.X("Horsepower:Q"),
y=alt.Y("Miles_per_Gallon:Q"),
color=alt.Color('Weight_in_lbs:Q'))
area1 = alt.Chart(source).mark_rect(color='#696969',opacity=0.005).encode(
x=alt.X('Start'),
x2='Middle',
y=alt.value(0),
y2=alt.value(300))
area2 = alt.Chart(source).mark_rect(color='#696969',opacity=0.01).encode(
x=alt.X('Middle'),
x2='End',
y=alt.value(0),
y2=alt.value(300))
(area1+area2+cars).properties(height=300, width=300
).facet(alt.Column('Origin:N'))
输出:
![在此输入图片描述](https://istack.dev59.com/kU8A8.webp)