<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Boxplot Example</title>
<!-- Include Plotly.js -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<!-- Your HTML content here -->
<div id="boxplot"></div>
<script>
// Data
const data = [
[1, 1, 2, 7, 7, 5, 10, 3, 6, 8, 3, 4, 1, 7, 7, 4, 1, 5, 8, 6, 1, 2, 8, 4, 4, 6, 8, 6],
[2, 2, 3, 5, 3, 7, 2, 4, 6, 2, 2, 2, 2, 3, 4, 4, 1, 3, 5, 2, 3, 5, 3, 3, 8, 8, 3],
[1, 3, 7, 10, 8, 10, 7, 7, 9, 5, 4, 2, 7, 7, 6, 1, 4, 8, 6, 1, 3, 10, 7, 3, 9, 8, 9],
[1, 4, 7, 8, 8, 6, 9, 9, 2, 6, 7, 8, 1, 6, 6, 1, 6, 7, 1, 3, 7, 1, 8, 7, 6, 7],
[2, 3, 6, 8, 6, 9, 6, 6, 8, 3, 4, 2, 5, 5, 6, 6, 0, 4, 8, 6, 2, 3, 8, 4, 6, 7, 7, 6],
[2, 5, 6, 6, 7, 5, 6, 6, 6, 6, 6, 5, 8, 7, 9, 2, 7, 6, 1, 3, 7, 4, 7, 10, 8, 7],
[3, 4, 7, 6, 10, 5, 7, 8, 4, 5, 5, 7, 6, 6, 1, 5, 6, 2, 3, 8, 5, 5, 8, 6, 6],
[3, 5, 7, 6, 9, 7, 7, 7, 5, 6, 4, 6, 5, 7, 1, 2, 7, 1, 4, 7, 4, 6, 8, 7, 6],
[4, 4, 6, 6, 9, 6, 7, 7, 5, 6, 5, 5, 6, 6, 2, 8, 7, 3, 4, 7, 4, 6, 8, 8, 6],
[5, 5, 8, 5, 9, 6, 9, 8, 4, 4, 4, 5, 6, 5, 7, 7, 4, 5, 9, 6, 6, 9, 7]
];
// Function to draw boxplot
function drawBoxPlot(data) {
const boxplotData = data.map(column => {
return {
y: column,
type: 'box',
};
});
const layout = {
title: 'Boxplot Diagram',
};
Plotly.newPlot('boxplot', boxplotData, layout);
}
// Call the function with data
drawBoxPlot(data);
</script>
</body>
</html>