2023 Week 35 | Power BI: Create a Faceted Instance Chart

Introduction

Sometimes it can be useful to show all data points instead of aggregating them. That is where an instance chart, also called a strip plot or a barcode plot, can be useful. A strip plot is like a single-axis scatter plot. The symbol or shape used in the instance chart can vary, but it’s often a tick mark, which is what makes it look like a barcode and gives it the name barcode plot. We made a violin plot with an overlayed barcode plot back in 2021 week 10.  

Inspired by a Makeover Monday entry from 2016, we are making a strip plot using updated Corruption Perceptions Index from Transparency International.

Requirements

  1. Retrieve the data from Wikipedia and data.world
  2. Combine the data from the two sources in Power Query so that each country is associated with a continent.
  3. Remove columns that don’t contain the country, rank, or CPI value from 2020 – 2022.
  4. Unpivot the data so there is one column containing the year attribute and one column containing the CPI values from all years.
  5. Create a strip plot that contains one tick mark per row of data.
    • The continent should be shown on the y-axis. 
    • The CPI value should be shown on the x-axis. 
    • The visual should be faceted (turned into small multiples) by year. 
    • A tooltip should show the country and the CPI value when you hover over a tick mark. 

I created my instance chart using Vega-Lite in a Deneb custom visual. Feel free to use any method you’d like (a code-free custom visual, Plotly.JS visual, a matrix with SVG images, etc.) as long as you can meet the requirements above.

Dataset

There are two data sources for this week.

  1. Corruption Perceptions Index table from Wikipedia: https://en.wikipedia.org/wiki/Corruption_Perceptions_Index#2020%E2%80%932022
  2. The Countries and Continents file on data.world: https://data.world/mlongoria/countriescontinents

You can use the data.world connector in Power BI (recommended) or download the Excel file to your local machine. You will need to log in to data.world to retrieve the data, but accounts are free.

Share

After you finish your workout, share on Twitter using the hashtags #WOW2023 and #PowerBI, and tag @MMarie, @shan_gsd, @KerryKolosko. Also make sure to fill out the Submission Tracker so that we can count you as a participant this week in order to track our participation throughout the year.

Solution

Solution File available for download via Data Stories Gallery

Coming soon.

1 thought on “2023 Week 35 | Power BI: Create a Faceted Instance Chart”

  1. Pingback: Chart Snapshot: Barcode Plot - The Data Visualisation Catalogue Blog

Comments are closed.

Scroll to Top