Teenager Loneliness

The OECD PISA (wiki link) made a 2015 study
On average across OECD countries in 2015, 73% of students reported that they feel that they belong at school; but that also means that a quarter of students do not share that feeling. […] The percentage who report feeling like an outsider at school increased on average and in many countries between 2003 and 2015
In this post, we’ve created a visualization of the data, which allows you to move your mouse to how many 15-year-old respondents in each country agreed with the statement “I make friends easily at school: [raw] [/raw] The study also had findings about the correlation between internet use and loneliness, with a 17% loneliness for “extreme” internet use (>6 hours per day) and a lower 13% for “high” internet use (2-6 hours per day):
PISA 2015 results show that, in most participating countries and economies, extreme Internet use – more than six hours per day – has a negative relationship with students’ life satisfaction. … Some 17% of “extreme Internet users” across OECD countries also reported that they feel lonely at school, compared with 14% of “low Internet users” (students who use the Internet less than one hour a day), 12% of “moderate Internet users” (those who spend between one and two hours per day on Internet) and 13% of “high Internet users” (those who spend between two and six hours per day on Internet). “Low” and “extreme Internet users” were also more likely than “moderate” and “high Internet users” to report that they are bullied at school (Figure III.13.8).
Code for the graph and analysis as follows:
int countries;
int leftmargin = 200;
int rightmargin = 50;
int topmargin = 30;
int bottommargin = 30;
int rectwidth, rectheight;
float x2012;
void setup() {
  size(700, 600);
  countries = data.split("\n").length;
  rectwidth = width - leftmargin - rightmargin;
  rectheight = height - topmargin - bottommargin;
  x2012 = map(2012, 2003, 2015, 0, rectwidth)+leftmargin;
void draw() {
  line(x2012, topmargin, x2012, height-bottommargin); 
  line(leftmargin, topmargin, leftmargin, height-bottommargin);
  line(width-rightmargin, topmargin, width-rightmargin, height-bottommargin);
  textAlign(CENTER, TOP);
  text("2003", leftmargin, height-bottommargin);
  text("2012", x2012, height-bottommargin);
  text("2015", width-rightmargin, height-bottommargin);
  for (int i = 100; i >= 70; i-= 10) {
    float y = map(i, 65, 100, rectheight, 0)+topmargin;
    textAlign(LEFT, BOTTOM);
    text(i+"%", width-rightmargin+10, y);
    line(width-rightmargin+10, y, width-rightmargin+30, y);
  String[] lines = data.split("\n");
  int closestIndex = (int)(constrain(map(mouseY, 0, rectheight, -1, lines.length)-1, -1, lines.length));
  for (int i = 0; i < lines.length; i++) { String[] parts = lines[i].split(","); drawPoints(i, lines.length, closestIndex, parts[3], Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2])); } if (closestIndex >= 0 && closestIndex < lines.length) {
    String[] parts = lines[closestIndex].split(",");
    drawPoints(closestIndex, lines.length, closestIndex, parts[3], Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2]));
void drawPoints(int i, int numlines, int closestIndex, String name, int v2003, int v2012, int v2015) {
  boolean offMap = closestIndex < 0 || closestIndex >= numlines;
  float labelY = map(i, -1, numlines, 0, rectheight)+topmargin;
  float innerEllipseDiameter = 8;
  if (i == closestIndex) {
    rect(leftmargin/2-60/2, labelY, leftmargin-60, rectheight/numlines);
    innerEllipseDiameter = 10;
  textAlign(RIGHT, CENTER);
  float labelHue = map(i, 0, numlines-1, 130, 0);
  float labelSat = 255;
  float labelBright = 100;
  if (i != closestIndex && !offMap) {
    labelSat = 50;
    labelBright = 200;
  fill(labelHue, labelSat, labelBright);
  text(name, leftmargin-60, labelY);
  float y1 = map(v2012, 65, 100, rectheight, 0)+topmargin;
  float y2 = map(v2015, 65, 100, rectheight, 0)+topmargin;
  float y0 = map(v2003, 65, 100, rectheight, 0)+topmargin;
  if (v2003 > 0) {
    fill(labelHue, labelSat, labelBright);
    ellipse(leftmargin, y0, innerEllipseDiameter, innerEllipseDiameter);
    stroke(labelHue, labelSat, labelBright);
    line (leftmargin - 58, labelY, leftmargin, y0);
    line (leftmargin, y0, x2012, y1);
    if (i == closestIndex) {
      textAlign(LEFT, TOP);
      text(""+v2003, leftmargin +5, y0+10);
  } else { //United States has no data for first column
  fill(labelHue, labelSat, labelBright);
  ellipse(x2012, y1, innerEllipseDiameter, innerEllipseDiameter);
  ellipse(width-rightmargin, y2, innerEllipseDiameter, innerEllipseDiameter);
  stroke(labelHue, labelSat, labelBright);
  line(x2012, y1, width-rightmargin, y2);
  if (i == closestIndex) {
    textAlign(LEFT, BOTTOM);
    text(""+v2012, x2012 +5, y1-10);
    textAlign(LEFT, TOP);
    text(""+v2015, width-rightmargin +5, y2+10);
    float outerEllipseDiameter = innerEllipseDiameter +3;
    if (v2003 > 0) ellipse(leftmargin, y0, outerEllipseDiameter, outerEllipseDiameter);
    ellipse(x2012, y1, outerEllipseDiameter, outerEllipseDiameter);
    ellipse(width-rightmargin, y2, outerEllipseDiameter, outerEllipseDiameter);
String data = "93,87,78,Portugal\n"+
  "91,87,79,New Zealand\n"+
  "89,87,78,OECD Average\n"+
  "89,87,75,Czech Republic\n"+
  "-1,88,79,United States\n"+

Leave a Reply

Your email address will not be published. Required fields are marked *