text
stringlengths
1
93.6k
with st.echo():
plost.scatter_hist(
data=datasets['randn'],
x='a',
y='b',
size='c',
color='c',
opacity=0.5,
aggregate='count',
width=500,
height=500)
"""
---
# Advanced features
## Vega-Lite encoding dicts
You can use [Vega-Lite encoding dicts](https://vega.github.io/vega-lite/docs/encoding.html) for
the `x`, `y`, `color`, `size`, and `opacity` arguments to do all sorts of fun things. For example,
the chart below is computing the mean of the `y` values, grouped by month.
"""
with st.echo():
plost.area_chart(
data=datasets['seattle_weather'],
x=dict(field='date', timeUnit='month'),
y=dict(field='temp_max', aggregate='mean'),
color='weather',
)
"""
Plost also supports [Altair-style
shorthands](https://altair-viz.github.io/user_guide/encoding.html#encoding-data-types), like
"column_name:T" for temporal.
"""
"""
---
## Annotations
Use `x_annot` and `y_annot` to add vertical or horizontal lines with annotations:
"""
with st.echo():
plost.area_chart(
data=datasets['rand'],
x='a',
y=('b', 'c'),
x_annot={
12: "This is when things became random",
33: "Actually they were always random. Back to normal now.",
},
)
"""
---
## Minimaps
You can add a minimap to many of the charts above my simply passing `pan_zoom='minimap'`.
"""
with st.echo():
plost.line_chart(
data=datasets['sp500'],
x='date',
y='price',
width=500,
pan_zoom='minimap')
"---"
with st.echo():
plost.area_chart(
data=datasets['sp500'],
x='date',
y='price',
width=500,
pan_zoom='minimap')
"---"
with st.echo():
plost.scatter_chart(
data=datasets['randn'],
x='a',
y='b',
size='c',
opacity='b',
width=500,
height=500,
pan_zoom='minimap')
"---"