Vega-Lite Grouped Bar Chart
This grouped bar chart compares average BMI between smokers and non-smokers across different regions, using adjacent bars for each smoker status to make direct visual comparisons easier. The visualization loads medical cost data from a CSV file via d3.csv and renders with Vega-Lite, using the vega-lite-api to encode columns by region, x-axis by smoker status, and y-axis by average BMI. The color channel also maps to smoker status, and a tooltip displays the average BMI on hover. Display settings are customized through a config object that adjusts font sizes and axis styling.
AI-generated descriptionA fork of the same data visualized as a stacked bar chart.
When visualizing using a grouped bar chart like this, visual comparisons between the adjacent bars are much easier to make. This makes it easier to answer the question "Do smokers have higher or lower average BMI than non-smokers, and how does that vary by region?", as compared to the stacked bar chart.