Add more docs examples for offset encoding
See original GitHub issueIt would be nice if we could add a page about the new offset encoding that contained common examples. In addition to the offset barplot in the VegaLite docs, I think these examples would be nice:
import altair as alt
from vega_datasets import data
source = data.barley.url
alt.Chart(source).mark_point().encode(
x='site:O',
y='yield:Q',
xOffset='year:N',
color='year:N',
)
alt.Chart(source).mark_point().encode(
x='site:O',
y='yield:Q',
xOffset=alt.XOffset('offset:Q', scale=alt.Scale(domain=(0, 3)))
).transform_calculate(
offset='random()'
)
alt.Chart(source, width=alt.Step(40)).mark_point().encode(
x='site:O',
y='yield:Q',
xOffset=alt.XOffset('offset:Q', scale=alt.Scale(domain=(0, 10))),
color='year:N'
).transform_calculate(
offset="datum.year == 1932 ? 5 + random() : 0 + random()"
)
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Encoded Offsets - IBM
Encoded offsets are values representing the block number and the relative byte within that block, all within one long int . Because LE/VSE...
Read more >Encoding | Vega-Lite
xOffset and yOffset position channels determine additional offset to the x or y position. Position Offset Field Definition and Datum Definition.
Read more >Adding X-Y offsets to data points - python - Stack Overflow
I'm looking for a way to specify an X-Y offset to plotted data points. I'm just getting into Altair, so please bear with...
Read more >Speech Synthesis Markup Language (SSML) - Google Cloud
The W3 reference links provided below may be helpful for additional context and examples. <speak>. The root element of the SSML response. To...
Read more >Encoded Polyline Algorithm Format | Google Maps Platform
Example. Polyline encoding is a lossy compression algorithm that allows you to store a series of coordinates as a single string.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just so you are aware, I will work on the encoding pages next, expanding the current one and potentially adding separate ones for certain concepts similar to the vega-lite docs. I will also clarify the distinction between
value
anddatum
as discussed in #2572In case it’s helpful, here are two short offset examples that I put together a few months ago: https://github.com/ChristopherDavisUCI/altair/commit/af0c3b4c1d27c366fb66fb6743aa15d5d30a56ce