Skip to main content
100%

“Sleep Hours vs Stress Level – Scatter Plot”

✓ Published3🌍 Public
Ccsabavath@wpi.edu
Last edited Sep 11, 2025
Created on Sep 9, 2025

This scatter plot visualizes the relationship between sleep duration and stress levels from the Sleep Health and Lifestyle dataset. Each circle represents an individual, positioned by their nightly sleep hours and stress rating, with color encoding gender and a legend explaining the categories. Built with React, the D3.js code uses `scaleLinear` and `scaleOrdinal` for positioning and color, while `axisBottom` and `axisLeft` create the axes. Tooltips reveal additional details per point, and the plot is rendered as an SVG with bold labels for readability.

AI-generated description

Sleep Duration vs Stress Level (Scatter Plot)

Dataset

This visualization uses the Sleep Health and Lifestyle Dataset from Kaggle.
It includes 374 individuals with information on demographics, sleep duration, stress levels, lifestyle factors, and sleep disorders.


Visualization

I created a scatter plot comparing Sleep Duration (hours/night) with Stress Level (1–10).

  • Points are color-coded by Gender, with a clear legend.
  • Tooltips show details for each person.
  • Axis labels and title are bold for readability.

Goal

The goal was to build a first visual of the dataset and explore how sleep relates to stress levels.
This plot satisfies the assignment requirements and adds extra polish with legend, labels, and tooltips.

MIT Licensed

Similar vizzes