Skip to content
OpenChart

When bar charts must start at zero

A bar's length carries its value, so cutting the axis distorts the comparison. A line's position carries it, so a line axis can start closer to the data.

050M100M150M200M250M300M350MPopulationUnited StatesIndonesiaPakistanNigeriaBrazilBangladeshRussiaEthiopia347M285M255M240M217M175M144M135MIndonesia's population is 2.1x Ethiopia's (285M vs 135M)Population of the eight countries under 1 billion, 2025 estimates050M100M150M200M250M300M350MPopulationUnited StatesIndonesiaPakistanNigeriaBrazilBangladeshRussiaEthiopia347M285M255M240M217M175M144M135MIndonesia's population is 2.1x Ethiopia's (285M vs 135M)Population of the eight countries under 1 billion, 2025 estimates
Population of eight countries with a zero baseline. Source: UN Population Division, World Population Prospects 2024.

Made with OpenChart. How to build this bar chart

A bar chart encodes each value as the length of a bar measured from the axis. When the axis starts at zero, a bar twice as long means a value twice as large. Starting the axis above zero cuts the same fixed chunk off every bar, which shrinks short bars far more than long ones and warps every comparison on the page.

In the UN World Population Prospects estimates for the eight countries under one billion, Indonesia has 285 million people, just over twice Ethiopia’s 135 million. Starting the horizontal axis at 100 million cuts the same amount off every bar, so Ethiopia shrinks to a short stub and Indonesia stretches more than five times as far.

100M150M200M250M300M350MPopulationUnited StatesIndonesiaPakistanNigeriaBrazilBangladeshRussiaEthiopia347M285M255M240M217M175M144M135MStarting at 100M makes Indonesia's bar 5.3x Ethiopia's instead of2.1xPopulation of the eight countries under 1 billion, 2025 estimates (axis starts at 100M)100M150M200M250M300M350MPopulationUnited StatesIndonesiaPakistanNigeriaBrazilBangladeshRussiaEthiopia347M285M255M240M217M175M144M135MStarting at 100M makes Indonesia's bar 5.3x Ethiopia's instead of2.1xPopulation of the eight countries under 1 billion, 2025 estimates (axis starts at 100M)
Population of eight countries with a truncated 100M baseline. Source: UN Population Division, World Population Prospects 2024.

Made with OpenChart. How to build this bar chart

{
  "mark": "bar",
  "data": [
    {
      "country": "United States",
      "population": 347000000
    },
    {
      "country": "Indonesia",
      "population": 285000000
    },
    {
      "country": "Pakistan",
      "population": 255000000
    },
    {
      "country": "Nigeria",
      "population": 240000000
    },
    {
      "country": "Brazil",
      "population": 217000000
    },
    {
      "country": "Bangladesh",
      "population": 175000000
    },
    {
      "country": "Russia",
      "population": 144000000
    },
    {
      "country": "Ethiopia",
      "population": 135000000
    }
  ],
  "encoding": {
    "x": {
      "field": "population",
      "type": "quantitative",
      "scale": {
        "domain": [
          100000000,
          360000000
        ]
      },
      "axis": {
        "title": "Population",
        "format": ".2~s"
      }
    },
    "y": {
      "field": "country",
      "type": "nominal",
      "sort": "-x"
    }
  },
  "chrome": {
    "title": "Starting at 100M makes Indonesia's bar 5.3x Ethiopia's instead of 2.1x",
    "subtitle": "Population of the eight countries under 1 billion, 2025 estimates (axis starts at 100M)"
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": "bar",
  "encoding": {
    "x": {
      "field": "population",
      "type": "quantitative",
      "scale": {
        "domain": [
          100000000,
          360000000
        ]
      },
      "axis": {
        "title": "Population",
        "format": ".2~s"
      }
    },
    "y": {
      "field": "country",
      "type": "nominal",
      "sort": "-x"
    }
  },
  "chrome": {
    "title": "Starting at 100M makes Indonesia's bar 5.3x Ethiopia's instead of 2.1x",
    "subtitle": "Population of the eight countries under 1 billion, 2025 estimates (axis starts at 100M)"
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": "bar",
  "encoding": {
    "x": {
      "field": "population",
      "type": "quantitative",
      "scale": {
        "domain": [
          100000000,
          360000000
        ]
      },
      "axis": {
        "title": "Population",
        "format": ".2~s"
      }
    },
    "y": {
      "field": "country",
      "type": "nominal",
      "sort": "-x"
    }
  },
  "chrome": {
    "title": "Starting at 100M makes Indonesia's bar 5.3x Ethiopia's instead of 2.1x",
    "subtitle": "Population of the eight countries under 1 billion, 2025 estimates (axis starts at 100M)"
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": "bar",
  "encoding": {
    "x": {
      "field": "population",
      "type": "quantitative",
      "scale": {
        "domain": [
          100000000,
          360000000
        ]
      },
      "axis": {
        "title": "Population",
        "format": ".2~s"
      }
    },
    "y": {
      "field": "country",
      "type": "nominal",
      "sort": "-x"
    }
  },
  "chrome": {
    "title": "Starting at 100M makes Indonesia's bar 5.3x Ethiopia's instead of 2.1x",
    "subtitle": "Population of the eight countries under 1 billion, 2025 estimates (axis starts at 100M)"
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": "bar",
  "encoding": {
    "x": {
      "field": "population",
      "type": "quantitative",
      "scale": {
        "domain": [
          100000000,
          360000000
        ]
      },
      "axis": {
        "title": "Population",
        "format": ".2~s"
      }
    },
    "y": {
      "field": "country",
      "type": "nominal",
      "sort": "-x"
    }
  },
  "chrome": {
    "title": "Starting at 100M makes Indonesia's bar 5.3x Ethiopia's instead of 2.1x",
    "subtitle": "Population of the eight countries under 1 billion, 2025 estimates (axis starts at 100M)"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

Printing exact numbers on the bars or labeling the axis at 100 million does not undo the distortion. Readers compare bar lengths before they read tick marks or subtract the baseline in their heads, so a cropped bar chart misleads even when every printed label is accurate.

Bars with a zero baseline

Moving the axis back to zero puts every pair of bars back in true proportion. The United States, at 347 million, spans just over two and a half times Ethiopia’s width, and the steady step down from Indonesia through Brazil reflects the actual population gaps between them.

050M100M150M200M250M300M350MPopulationUnited StatesIndonesiaPakistanNigeriaBrazilBangladeshRussiaEthiopia347M285M255M240M217M175M144M135MIndonesia's population is 2.1x Ethiopia's (285M vs 135M)Population of the eight countries under 1 billion, 2025 estimates050M100M150M200M250M300M350MPopulationUnited StatesIndonesiaPakistanNigeriaBrazilBangladeshRussiaEthiopia347M285M255M240M217M175M144M135MIndonesia's population is 2.1x Ethiopia's (285M vs 135M)Population of the eight countries under 1 billion, 2025 estimates
Live example. Source: UN Population Division, World Population Prospects 2024.

Made with OpenChart. How to build this bar chart

{
  "mark": "bar",
  "data": [
    {
      "country": "United States",
      "population": 347000000
    },
    {
      "country": "Indonesia",
      "population": 285000000
    },
    {
      "country": "Pakistan",
      "population": 255000000
    },
    {
      "country": "Nigeria",
      "population": 240000000
    },
    {
      "country": "Brazil",
      "population": 217000000
    },
    {
      "country": "Bangladesh",
      "population": 175000000
    },
    {
      "country": "Russia",
      "population": 144000000
    },
    {
      "country": "Ethiopia",
      "population": 135000000
    }
  ],
  "encoding": {
    "x": {
      "field": "population",
      "type": "quantitative",
      "scale": {
        "domain": [
          0,
          360000000
        ]
      },
      "axis": {
        "title": "Population",
        "format": ".2~s"
      }
    },
    "y": {
      "field": "country",
      "type": "nominal",
      "sort": "-x"
    }
  },
  "chrome": {
    "title": "Indonesia's population is 2.1x Ethiopia's (285M vs 135M)",
    "subtitle": "Population of the eight countries under 1 billion, 2025 estimates"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              0,
              100000000,
              200000000,
              300000000
            ]
          }
        }
      },
      "chrome": {
        "title": "Indonesia's population is 2.1x Ethiopia's"
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              0,
              100000000,
              200000000,
              300000000
            ]
          }
        }
      },
      "chrome": {
        "title": "Indonesia's population is 2.1x Ethiopia's"
      }
    }
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": "bar",
  "encoding": {
    "x": {
      "field": "population",
      "type": "quantitative",
      "scale": {
        "domain": [
          0,
          360000000
        ]
      },
      "axis": {
        "title": "Population",
        "format": ".2~s"
      }
    },
    "y": {
      "field": "country",
      "type": "nominal",
      "sort": "-x"
    }
  },
  "chrome": {
    "title": "Indonesia's population is 2.1x Ethiopia's (285M vs 135M)",
    "subtitle": "Population of the eight countries under 1 billion, 2025 estimates"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              0,
              100000000,
              200000000,
              300000000
            ]
          }
        }
      },
      "chrome": {
        "title": "Indonesia's population is 2.1x Ethiopia's"
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              0,
              100000000,
              200000000,
              300000000
            ]
          }
        }
      },
      "chrome": {
        "title": "Indonesia's population is 2.1x Ethiopia's"
      }
    }
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": "bar",
  "encoding": {
    "x": {
      "field": "population",
      "type": "quantitative",
      "scale": {
        "domain": [
          0,
          360000000
        ]
      },
      "axis": {
        "title": "Population",
        "format": ".2~s"
      }
    },
    "y": {
      "field": "country",
      "type": "nominal",
      "sort": "-x"
    }
  },
  "chrome": {
    "title": "Indonesia's population is 2.1x Ethiopia's (285M vs 135M)",
    "subtitle": "Population of the eight countries under 1 billion, 2025 estimates"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              0,
              100000000,
              200000000,
              300000000
            ]
          }
        }
      },
      "chrome": {
        "title": "Indonesia's population is 2.1x Ethiopia's"
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              0,
              100000000,
              200000000,
              300000000
            ]
          }
        }
      },
      "chrome": {
        "title": "Indonesia's population is 2.1x Ethiopia's"
      }
    }
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": "bar",
  "encoding": {
    "x": {
      "field": "population",
      "type": "quantitative",
      "scale": {
        "domain": [
          0,
          360000000
        ]
      },
      "axis": {
        "title": "Population",
        "format": ".2~s"
      }
    },
    "y": {
      "field": "country",
      "type": "nominal",
      "sort": "-x"
    }
  },
  "chrome": {
    "title": "Indonesia's population is 2.1x Ethiopia's (285M vs 135M)",
    "subtitle": "Population of the eight countries under 1 billion, 2025 estimates"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              0,
              100000000,
              200000000,
              300000000
            ]
          }
        }
      },
      "chrome": {
        "title": "Indonesia's population is 2.1x Ethiopia's"
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              0,
              100000000,
              200000000,
              300000000
            ]
          }
        }
      },
      "chrome": {
        "title": "Indonesia's population is 2.1x Ethiopia's"
      }
    }
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 8 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": "bar",
  "encoding": {
    "x": {
      "field": "population",
      "type": "quantitative",
      "scale": {
        "domain": [
          0,
          360000000
        ]
      },
      "axis": {
        "title": "Population",
        "format": ".2~s"
      }
    },
    "y": {
      "field": "country",
      "type": "nominal",
      "sort": "-x"
    }
  },
  "chrome": {
    "title": "Indonesia's population is 2.1x Ethiopia's (285M vs 135M)",
    "subtitle": "Population of the eight countries under 1 billion, 2025 estimates"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              0,
              100000000,
              200000000,
              300000000
            ]
          }
        }
      },
      "chrome": {
        "title": "Indonesia's population is 2.1x Ethiopia's"
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "values": [
              0,
              100000000,
              200000000,
              300000000
            ]
          }
        }
      },
      "chrome": {
        "title": "Indonesia's population is 2.1x Ethiopia's"
      }
    }
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

India and China sit above 1.4 billion people each and are omitted here so the remaining eight countries can share one readable axis. Keeping zero on those eight bars still leaves every rank and gap clear, from the United States down to Ethiopia.

When real differences do look cramped on a zero-anchored bar chart, switching the mark works better than cropping the axis. A dot plot places a single point at each value, so readers judge position along the scale and the axis can start near the data minimum. Plotting differences from a benchmark, such as each value’s gap from the group average, also keeps a zero baseline while widening the spread.

Line charts

Line charts encode values by vertical position along the y-axis, with the slope between points showing the rate of change. Because no filled rectangle stretches down to the axis, readers compare where points sit relative to one another and to the tick labels. Anchoring every line chart at zero can compress a narrow series into a nearly flat band at the top of the frame.

Quarterly US consumer price inflation from the Bureau of Labor Statistics peaked at 8.5 percent in July 2022 and eased to 2.6 percent by October 2024. Tightening the y-axis to the data range removes the empty space beneath the curve, so the brief spring rebound before the final drop stays visible.

Jan '22Jan '23Jan '243.0%4.0%5.0%6.0%7.0%8.0%CPI (year-over-year %)US inflation peaked at 8.5% in 2022 and eased to 2.6% by late 2024US consumer price index, year-over-year % change, quarterly Q2 2021 to Q4 2024Jan '22Jan '23Jan '243.0%4.0%5.0%6.0%7.0%8.0%CPI (year-over-year %)US inflation peaked at 8.5% in 2022 and eased to 2.6% by late 2024US consumer price index, year-over-year % change, quarterly Q2 2021 to Q4 2024
US CPI inflation from 2021 to 2024 on a non-zero y-axis. Source: US Bureau of Labor Statistics, CPI-U (via FRED CPIAUCSL).

Made with OpenChart. How to build this line chart

{
  "mark": {
    "type": "line",
    "stroke": "#0e7490",
    "strokeWidth": 2,
    "point": true
  },
  "data": [
    {
      "date": "2021-04-01",
      "rate": 4.2
    },
    {
      "date": "2021-07-01",
      "rate": 5.4
    },
    {
      "date": "2021-10-01",
      "rate": 6.2
    },
    {
      "date": "2022-01-01",
      "rate": 7.5
    },
    {
      "date": "2022-04-01",
      "rate": 8.3
    },
    {
      "date": "2022-07-01",
      "rate": 8.5
    },
    // … 9 more rows; Copy includes them
  ],
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%b '%y",
        "tickCount": 6
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "scale": {
        "zero": false
      },
      "axis": {
        "title": "CPI (year-over-year %)",
        "format": ".1f",
        "labelSuffix": "%",
        "grid": true
      }
    }
  },
  "chrome": {
    "title": "US inflation peaked at 8.5% in 2022 and eased to 2.6% by late 2024",
    "subtitle": "US consumer price index, year-over-year % change, quarterly Q2 2021 to Q4 2024"
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 15 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "stroke": "#0e7490",
    "strokeWidth": 2,
    "point": true
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%b '%y",
        "tickCount": 6
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "scale": {
        "zero": false
      },
      "axis": {
        "title": "CPI (year-over-year %)",
        "format": ".1f",
        "labelSuffix": "%",
        "grid": true
      }
    }
  },
  "chrome": {
    "title": "US inflation peaked at 8.5% in 2022 and eased to 2.6% by late 2024",
    "subtitle": "US consumer price index, year-over-year % change, quarterly Q2 2021 to Q4 2024"
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 15 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "stroke": "#0e7490",
    "strokeWidth": 2,
    "point": true
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%b '%y",
        "tickCount": 6
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "scale": {
        "zero": false
      },
      "axis": {
        "title": "CPI (year-over-year %)",
        "format": ".1f",
        "labelSuffix": "%",
        "grid": true
      }
    }
  },
  "chrome": {
    "title": "US inflation peaked at 8.5% in 2022 and eased to 2.6% by late 2024",
    "subtitle": "US consumer price index, year-over-year % change, quarterly Q2 2021 to Q4 2024"
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 15 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "stroke": "#0e7490",
    "strokeWidth": 2,
    "point": true
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%b '%y",
        "tickCount": 6
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "scale": {
        "zero": false
      },
      "axis": {
        "title": "CPI (year-over-year %)",
        "format": ".1f",
        "labelSuffix": "%",
        "grid": true
      }
    }
  },
  "chrome": {
    "title": "US inflation peaked at 8.5% in 2022 and eased to 2.6% by late 2024",
    "subtitle": "US consumer price index, year-over-year % change, quarterly Q2 2021 to Q4 2024"
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 15 rows; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "line",
    "stroke": "#0e7490",
    "strokeWidth": 2,
    "point": true
  },
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "%b '%y",
        "tickCount": 6
      }
    },
    "y": {
      "field": "rate",
      "type": "quantitative",
      "scale": {
        "zero": false
      },
      "axis": {
        "title": "CPI (year-over-year %)",
        "format": ".1f",
        "labelSuffix": "%",
        "grid": true
      }
    }
  },
  "chrome": {
    "title": "US inflation peaked at 8.5% in 2022 and eased to 2.6% by late 2024",
    "subtitle": "US consumer price index, year-over-year % change, quarterly Q2 2021 to Q4 2024"
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

Zooming a line chart still requires judgment about what counts as a meaningful swing. A stock price moving half a percent across a single morning looks like a crash if the y-axis spans one dollar. Keep the axis wide enough that routine noise looks small, and label the axis ticks clearly so the starting value is obvious at a glance.

Area charts follow the bar rule, even though their top edge traces a line. Shaded fill turns vertical height into area, so cropping the baseline cuts away the bottom of every region and distorts proportions the same way a cropped bar does.

The spec

OpenChart sets scale.zero based on the mark. Bar and area marks include zero on quantitative axes by default, while line, point, and range marks default to zero: false to fit the observed spread. Setting scale: { zero: false } on a line makes that behavior explicit in the spec, and scale: { zero: true } brings a line back to zero whenever the origin is a useful benchmark.

Setting scale.domain overrides scale.zero and pins both ends of the axis to fixed [min, max] bounds. In the code panel under the second chart, domain: [0, 360000000] locks the zero-baseline bars to the same upper bound as the cropped chart above it, so the only difference between the two views is where the axis starts. On narrow screens, overrides swaps in a shorter title and keeps a tick every 100 million.

For every quantitative scale option, including log scales and custom tick bounds, see the field types and scales guide.