Bounding#

It’s easy to bound the extents in the animation!

limits#

xlim0s, xlim1s, ylim0s, and ylim1s accept an Iterable, str, or scalar.

If an Iterable is passed, the plots’ limits are animated! The length of the Iterable must match the number of states.

[1]:
import ahlive as ah
ah.Array([0, 1, 2], [4, 5, 6], xlim1s=[7, 8, 9]).render()
gifsicle: warning: trivial adaptive palette (only 206 colors in source)
[1]:

If a scalar is passed, the limits are statically set to that value.

[2]:
import ahlive as ah
ah.Array([0, 1, 2], [4, 5, 6], xlim1s=9).render()
gifsicle: warning: trivial adaptive palette (only 202 colors in source)
[2]:

There are a couple built-in str options for limits.

fixed sets the limits to the absolute min / max of all items and states.

[3]:
import ahlive as ah
ah.Array([0, 1, 2], [4, 5, 6], xlim1s='fixed').render()
gifsicle: warning: trivial adaptive palette (only 194 colors in source)
[3]:

follow follows the current state’s min/max across all items.

[4]:
import ahlive as ah
ah.Array([0, 1, 2, 0], [4, 5, 6, 6], xlim1s='follow').render()
gifsicle: warning: trivial adaptive palette (only 228 colors in source)
[4]:

explore is similar to follow except, the min/max doesn’t decrease once explored.

[5]:
import ahlive as ah
ah.Array([0, 1, 2, 0], [4, 5, 6, 6], xlim1s='explore').render()
gifsicle: warning: trivial adaptive palette (only 228 colors in source)
[5]:

All these string limits can be suffixed with a desired offset value.

[6]:
import ahlive as ah
ah.Array([0, 1, 2, 0], [4, 5, 6, 6], xlim1s='explore_1').render()
gifsicle: warning: trivial adaptive palette (only 218 colors in source)
[6]:

If xs is a datetime type, a string representing a timedelta value can be passed. Any units listed in `pd.to_timedelta <https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_timedelta.html>`__ can be used.

[7]:
import ahlive as ah
import pandas as pd
ah.Array(pd.date_range("2017-02-01", "2017-02-04"), [4, 5, 6, 6], xlim1s='explore_12H').render()
gifsicle: warning: trivial adaptive palette (only 231 colors in source)
[7]:

If setting xlim0s and xlim1s or ylim0s and ylim1s individually feels tedious, there is the option to set xlims and ylims.

[8]:
import ahlive as ah
ah.Array([0, 1, 2, 0], [4, 5, 6, 6], xlims='explore', ylims='explore').render()
gifsicle: warning: trivial adaptive palette (only 229 colors in source)
[8]: