# Bar chart axis is inverted

**URL:** <https://talk.observablehq.com/t/bar-chart-axis-is-inverted/6359>\
**Category:** Help\
**Created:** [March 16, 2022, 1:50pm UTC](https://talk.observablehq.com/t/bar-chart-axis-is-inverted/6359 "2022-03-16T13:50:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arky](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/arky/32/4486_2.png) [@arky](https://talk.observablehq.com/u/arky)\
**Post date:** [March 16, 2022, 1:50pm UTC](https://talk.observablehq.com/t/bar-chart-axis-is-inverted/6359/1 "2022-03-16T13:50:21Z")

</div>

Adding text marks inverts the axis of the chart. Wonder what’s causes the behavior.

```auto
Plot.plot({
  grid: false,
  legend: false,
  marginLeft: 80,
  x: {
    domain: d3.sort(data, d => -d["Size of holding"]).map(d=>d["Size of holding"])
  },
  marks: [
    Plot.barY(data, {
      x: "Size of holding",
      y: "No of households",
      title: "No of households",
      text: "No of households",
      fill: "hsl(348, 100%, 70%)"
    }),
        Plot.text(data, {
                 x: "Size of holding",
                 y: "No of households",
                 text: "No of households"
        }),
  ]
})

```

![image](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/3/3eeb1614e19a941a5aabdf51d0e4612e22c413cc.png)

Complete notebook: [Size of land owned by single households in Thailand / Arky / Observable](https://observablehq.com/@arky/size-of-land-owned-by-single-households-in-thailand)

---

<div class="post-metadata">

**Author:** ![Fil](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/fil/32/207_2.png) [@Fil](https://talk.observablehq.com/u/Fil)\
**Post date:** [March 16, 2022, 2:05pm UTC](https://talk.observablehq.com/t/bar-chart-axis-is-inverted/6359/2 "2022-03-16T14:05:23Z")

</div>

the ⚠ icon gives you a hint in the console, that the domain is made of strings that look like numbers. As they are strings, they will be considered ordinal, where what you want is probably a linear scale.

Two solutions:

1. type your data (“No of households” should be numbers), or:
2. use an explicit definition `{x: {type: "linear"}}` for the x scale

---

<div class="post-metadata">

**Author:** ![arky](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/arky/32/4486_2.png) [@arky](https://talk.observablehq.com/u/arky)\
**Post date:** [March 16, 2022, 2:11pm UTC](https://talk.observablehq.com/t/bar-chart-axis-is-inverted/6359/3 "2022-03-16T14:11:45Z")

</div>

Thank you @Fil

I have failed to notice warning icon gives you hint in the console. It is not mentioned anywhere in the docs. 😃

---

<div class="post-metadata">

**Author:** ![Fil](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/fil/32/207_2.png) [@Fil](https://talk.observablehq.com/u/Fil)\
**Post date:** [March 16, 2022, 2:27pm UTC](https://talk.observablehq.com/t/bar-chart-axis-is-inverted/6359/4 "2022-03-16T14:27:41Z")

</div>

Warnings are a new feature, see: [plot/CHANGELOG.md at main · observablehq/plot · GitHub](https://github.com/observablehq/plot/blob/main/CHANGELOG.md#041)

I’ve added an issue as a reminder to document them [Issues · observablehq/plot · GitHub](https://github.com/observablehq/plot/issues/811;) thank you!
