View or zoom parameter

I’m trying to plot different data points and since the default view or zoom level is rather close, the data points at the edges are not very clear to make out. How do I set up the view or zoom level to be zoomed out further?

Also, whether I use .interactive() or not doesn’t make a difference in that regard, since it lets me zoom out afterwards, but does not change the starting zoom level any further.

Please check the attached screenshot:

enter image description here

import altair as alt

df_top100_favorite_count = df_tweets.nlargest(100, 'favorite_count')

alt.Chart(df_top100_favorite_count).mark_point().encode(
    x='created_at',
    y='favorite_count',
    tooltip='text',
).properties(
    title='Top 100 favorised tweets'
).interactive()

Answer

You can do this by setting the padding property of alt.Scale. For your chart it might look like this:

import altair as alt

df_top100_favorite_count = df_tweets.nlargest(100, 'favorite_count')

alt.Chart(df_top100_favorite_count).mark_point().encode(
    x=alt.X('created_at', scale=alt.Scale(padding=100)),
    y='favorite_count',
    tooltip='text',
).properties(
    title='Top 100 favorised tweets'
).interactive()