Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬 Access the recorded webinar.

Dynamic Grouped Bar Chart with 1 trace

Hello There,

Hope you are all well and keeping safe.

Been a while since I posted on here.

I am trying to create a stacked bar plot using only 1 trace. Is this possible?

Using the example from Bar Charts | JavaScript | Plotly I would like to code to look similar to the below. The output should be exactly the same as the exhibit from the URL.

var trace1 = {
  x: ['giraffes', 'orangutans', 'monkeys','giraffes', 'orangutans', 'monkeys'],
  y: [20, 14, 23,12,18,19],
  z: ['SF Zoo','SF Zoo','SF Zoo','LA Zoo','LA Zoo','LA Zoo'],
  type: 'bar'  


var data = [trace1];

var layout = {barmode: 'stack'};

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

URL: https://plotly.com/javascript/bar-charts/#stacked-bar-chart

Hey Everyone, any love here ? :slight_smile: Would be great to know if this is possible.

Thank you!!