Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Vega-Lite API Stack Sorting Struggle

Public visualization

Vega-Lite API Stack Sorting Struggle

0 stars1🌍 Public
CCurran Kelleher
Last edited Sep 18, 2019
Created on Sep 18, 2019

This visualization demonstrates a stacking order issue with the Vega-Lite API. It displays suicide rates by age group across years as stacked bar marks, where the color legend is correctly sorted by a custom age order, but the bar layering does not match that same sorted sequence. Using D3’s CSV loader for data ingestion, the code applies a viridis color scheme and attempts to set both color and order encodings with the same sort specification, revealing a mismatch in how Vega-Lite interprets these properties.

AI-generated description

This visualization demonstrates frustrations with the vega-lite-api in trying to get the sort order of stacking to match the sort order of the color scale. Notice that the ordering of the color legend is correct (a custom sort order), but the order of the layering does not match it.

Comments

Sign in to join the discussion.

MIT Licensed