question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add more docs examples for offset encoding

See original GitHub issue

It 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',
)

image

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()'
)

image

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()"
)

image

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
binstecommented, Dec 1, 2022

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 and datum as discussed in #2572

1reaction
ChristopherDavisUCIcommented, May 17, 2022

In 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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found