```py
import altair as alt
from vega_datasets import data
source = data.seattle_weather()
base = alt.Chart(source).encode(alt.X("month(date):T").title(None))
area = base.mark_area(opacity=0.3, color="#57A44C").encode(
alt.Y("average(temp_max)").title("Avg. Temperature (°C)", titleColor="#57A44C"),
alt.Y2("average(temp_min)"),
)
line = base.mark_line(stroke="#5276A7", interpolate="monotone").encode(
alt.Y("average(precipitation)").title(
"Precipitation (inches)", titleColor="#5276A7"
)
)
alt.layer(area, line).resolve_scale(y="independent")
```
Fixed
Code block
```py
import altair as alt
from vega_datasets import data
source = data.seattle_weather()
base = alt.Chart(source).encode(alt.X("month(date):T").title(None))
area = base.mark_area(opacity=0.3, color="#57A44C").encode(
alt.Y("average(temp_max)").axis(
title="Avg. Temperature (°C)", titleColor="#57A44C"
),
alt.Y2("average(temp_min)"),
)
line = base.mark_line(stroke="#5276A7", interpolate="monotone").encode(
alt.Y("average(precipitation)").axis(
title="Precipitation (inches)", titleColor="#5276A7"
)
)
alt.layer(area, line).resolve_scale(y="independent")
```
Discovered while writing tests for #3659.
The User Guide displays the attribute syntax, but the method syntax one was not equivalent.
Results in no
titleColor
being applied and is silently ignored during validation.Previous
Note: the warning from
pylance
is only showing due to some local changes I have on-top of (https://github.com/vega/altair/pull/3659/commits/1a390194352fd5a21631b363cbd1a75dde430beb)Code block
```py import altair as alt from vega_datasets import data source = data.seattle_weather() base = alt.Chart(source).encode(alt.X("month(date):T").title(None)) area = base.mark_area(opacity=0.3, color="#57A44C").encode( alt.Y("average(temp_max)").title("Avg. Temperature (°C)", titleColor="#57A44C"), alt.Y2("average(temp_min)"), ) line = base.mark_line(stroke="#5276A7", interpolate="monotone").encode( alt.Y("average(precipitation)").title( "Precipitation (inches)", titleColor="#5276A7" ) ) alt.layer(area, line).resolve_scale(y="independent") ```
Fixed
Code block
```py import altair as alt from vega_datasets import data source = data.seattle_weather() base = alt.Chart(source).encode(alt.X("month(date):T").title(None)) area = base.mark_area(opacity=0.3, color="#57A44C").encode( alt.Y("average(temp_max)").axis( title="Avg. Temperature (°C)", titleColor="#57A44C" ), alt.Y2("average(temp_min)"), ) line = base.mark_line(stroke="#5276A7", interpolate="monotone").encode( alt.Y("average(precipitation)").axis( title="Precipitation (inches)", titleColor="#5276A7" ) ) alt.layer(area, line).resolve_scale(y="independent") ```