First intermediate implementations

Milton Ossamu
WHW Notes
Published in
4 min readApr 21, 2021

In the past weeks, we are introduced with Vega and Vega Lite. These tools are quite handy and provide easy-to-implement visualizations for our sketches. Another important reason for selecting vega is that it does not require a javascript background and the learning curve is flatter than other more advanced frameworks like D3. While we are still learning how to make better visualizations with Vega, we have done some basic exploratory data analysis to see whether we are on a good track for our project.

Happiness by Country

In this plot it is possible to geographically visualize the average happiness by country.

One can quickly see that North Europe countries like Iceland, Sweden, Norway, Finland, and Denmark show higher average happiness, and Eastern Europe Countries like Bulgaria, Ukraine, and Russia present lower average happiness among the respondents.

Happiness by country

One can check the vega implementation in this link Happiness by country, which is possible to hover over the circles and check the exact average happiness.

Proportion of trust aspects among respondents:

The dataset contains trust in seven different aspects. In this sense, we used a normalized stacked bar chart to analyze the proportion of each trust aspect. Trust was evaluated on a scale from 0 to 10.

One can see that trust in political parties and in politicians are quite similar and present higher indices of 0 among the trust aspects. We can also perceive that Trust in the United Nations and in the legal system receive better grades from the respondents.

Trust aspects

The link of the Vega implementation can be found on Trust aspects. By hovering over the rectangles, one can see the exact number of respondents for each trust aspect and value.

Does happiness affect trust in the country’s parliament?

We tried to visualize the relationship between happiness and trust in the country’s parliament. We explored signals, data transforms with this basic plot.

Below, we have plotted a heat-map-like scatterplot. There are 11 x 11 points in the plot which shows the values of happiness and trust in parliament. The size of the circles demonstrates the number of respondents for the particular happiness and trust in parliament values.

Does happiness affect trust in country’s parliament?

According to the plot, we can see that there is a positive correlation between happiness and trust in parliament. If you want to explore what is going on behind the scenes, you can go to vega online editor for our source code.

Comparing well-being by countries

From the EFA result, well-being items from ESS 6 (Jeffrey et al., 2015) can be categorized into 6 dimensions (factors). We initially renamed them as Bad feeling, Meaning — Purpose of work, Good feeling, Optimism - Autonomy - Competence, Social skepticism, Community well-being. All factor scores have been computed and standardized due to the variety of item scales (0–10, 0–6, 1–5, 1–4).

To illustrate the third combination (see in the previous blog post), a stacked bar chart with dynamical interactions was chosen. We tried d3.js following the work of Mike Bostock, however, the output shows some issues. Firstly, the negative values (z-scores) are removed from the graph. Secondly, some categories are not stacked properly for some countries. Lastly, the Optimism — Autonomy — Competence does not fade properly when other factors are chosen. One can found some of the issues faced below.

Problems with the interaction with d3.js

Although there is a problem with d3.js, Vega is a good alternative to have a general idea of how the stacked bar graph should be. Nevertheless, these simple solutions cannot support the interactive comparison between countries in each well-being dimension.

Stacked bar chart with Vega
Overview with Excel

As we are proceeding with learning vega, D3 and its functionalities, we will dive more into the dataset and hope to extract more information soon.

Reference

Jeffrey, K., Abdallah, S., & Quick, A. (2015). Europeans’ Personal and Social Wellbeing Topline Results from Round 6 of the European Social Survey ESS Topline Results Series Issue. European Social Survey, April.

--

--