Sorting order on Barchar

WIth the following

var data = [
  {
    y: ['giraffes', 'orangutans', 'monkeys'],
    x: [20, 14, 23],
    type: 'bar',
    orientation: 'h',
  }
];

Plotly.newPlot('myDiv', data);


And you can see the order of the y data ['giraffes', 'orangutans', 'monkeys'] is ordered from the bottom to top. How do I reverse the order for the bars(without changing the arrays)?

yaxis: { autorange: "reversed" } }

Do you mean

var data = [
  {
    y: ['giraffes', 'orangutans', 'monkeys'],
    x: [20, 14, 23],
    type: 'bar',
    orientation: 'h',
+   yaxis: { autorange: "reversed" }
  }
];

With the additional line, there is no visual change on the cahrt.

yaxis goes in the layout properties

var data = [
  {
    y: ['giraffes', 'orangutans', 'monkeys'],
    x: [20, 14, 23],
    type: 'bar',
    orientation: 'h'
  }
];
var layout = {
  yaxis: {
    autorange: "reversed"
  }
}

Plotly.newPlot('myDiv', data, layout);