Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

How to control bargap legend icon size?

Hi,

I am trying to draw a bar graph and need to reduce bar graph legend icon size. Is it possible? If yes please suggest me the required changes in below script.

var trace1 = {
x: [150, 280, 340, 350, 420],
y: [“John Doe”, “Rohan”, “Hello World”, “Anand Demo”, “Ritesh Danny”],
name: ‘Complete’,
orientation: ‘h’,
marker: {
color: ‘orange’,
width: 1
},
type: ‘bar’
};

var trace2 = {
x: [200, 180, 180, 300, 300],
y: [“John Doe”, “Rohan”, “Hello World”, “Anand Demo”, “Ritesh Danny”],
name: ‘In Progress’,
orientation: ‘h’,
type: ‘bar’,
marker: {
color: ‘blue’,
width: 1
}
};

var trace3 = {
x: [100, 200, 250, 200, 230],
y: [“John Doe”, “Rohan”, “Hello World”, “Anand Demo”, “Ritesh Danny”],
name: ‘Not Started’,
orientation: ‘h’,
type: ‘bar’,
marker: {
color: ‘red’,
width: 1
}
};

var data = [trace2, trace3, trace1];

var __width = 450;
var __height = 250;

var layout = {
bargap: .7,
width: __width,
height: __height,
title: ‘5 of 32 Direct Reports of John Doe’,
barmode: ‘stack’,
legend: {
“orientation”: “h”,
x: -.0,
y: -.4
},
margin: {
l: 90,
r: 10,
t: 50,
b: 10,
pad: 8
},
paper_bgcolor: “transparent”,
showlegend: true
};

Plotly.newPlot(‘myDiv’, data, layout);

Not at the moment, unfortunately.

OK thanks … Please let me know if there is any ulternative.