Hi Jake,
When I use the size channel for encoding the legend automatically chooses reasonable defaults for the legend. Am I allowed to control the number of steps that are chosen for the legend? For example, perhaps I would like it to go up in steps of 2, or 10, or some other value.
I would have thought that rangeStep would have controlled this but that didn't have an effect as far as I could tell.
I am gathering up all of these tips into an appendix on customization for my Altair workshop this week as I anticipate people will ask about finer controls (although I won't have much time to discuss them).
import altair as alt
from vega_datasets import data
weather=data.weather()
alt.Chart(weather).mark_point().encode(
x='temp_max',
y='temp_min',
size=alt.Size('precipitation', scale=alt.Scale(domain=[0,100], range=[1,300]))
)
You can control that using the legend property of the encoding. For example:
import altair as alt
from vega_datasets import data
weather=data.seattle_weather()
alt.Chart(weather).mark_point().encode(
x='temp_max',
y='temp_min',
size=alt.Size('precipitation',
scale=alt.Scale(domain=[0,100], range=[1,300]),
legend=alt.Legend(values=[0, 50, 100]))
)

I should have caught that! Thanks Jake!
Most helpful comment
You can control that using the
legendproperty of the encoding. For example: