Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
303 views
in Technique[技术] by (71.8m points)

javascript - Reduce the width of the boxplot - plotly js

I am using plotly js javascript library. But, in the case of single or two boxplots, the boxplots are taking too much space. Is there any way to set the width?

My code looks as:

var y0 = [];
var y1 = [];
for (var i = 0; i < 50; i ++) {
    y0[i] = Math.random();
    y1[i] = Math.random() + 1;
}

let layout = {
  showlegend: false,
  newshape: {
    line: {
      width: 1
    }
  },
  /* boxgap: 0.9, */
  yaxis:
  {
    tickprefix: "$"
  },
  height: 450
}

var trace1 = {
  y: y0,
  type: 'box'
};


var data = [trace1];

Plotly.newPlot('myDiv', data, layout);
<head>
    <!-- Load plotly.js into the DOM -->
    <script src='https://cdn.plot.ly/plotly-latest.min.js'></script>
</head>

<body>
    <div id='myDiv'><!-- Plotly chart will be drawn inside this DIV --></div>
</body>
question from:https://stackoverflow.com/questions/65831046/reduce-the-width-of-the-boxplot-plotly-js

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...