Interactive plotting learn-a-thon

In the last two workshops, @stefan.pfenninger and I put together visualisation tutorials. This learn-a-thon will build on those, to ensure that we’re all making beautiful and useful visualisation from our models.

As I’ve never had the patience to fully grasp Bokeh, we’ll concentrate on building visualisations in Plotly, via Python. @tom_brown, I would very much welcome your contributions in injecting Javascript (a la https://www.pypsa.org/animations/pypsa-eur-30/)!

Proposed structure:

  1. Introduction to good/bad visualisation
  2. Plotting capacity data
  3. Plotting timeseries data
  4. Plotting on maps
  5. Bringing it all together in a dashboard

This could span two slots, if the appetite is there. In that case, this would extend to a hack-a-thon in which we create an energy-system specific HTML template for visualising results from a model.

22 Likes

Sure! That example is using D3.js directly and only using Python to generate the data files. I could briefly introduce D3.js if that makes sense.

It goes perhaps more in the direction of hack-a-thon, but I’d like to:

  • Investigate options to dynamically generate such custom D3.js graphics directly in the Jupyter notebooks
  • Add more information that appears on hovering

Installation instructions are here!

Setup

1. Install the Anaconda Python distribution

Download the Miniconda Python distribution from:

If you have Anaconda already installed, that’s fine! Miniconda is just a slimmer version. Make sure you download the Python 3 version.

2. Create an environment

Once Miniconda is installed, create a new conda environment with the required packages, by running the following command in a terminal (Linux or macOS) or a command-line window (Windows), making sure you run this command inside the directory containing our requirements.yaml file:

conda env create -f requirements.yaml

3. Ensure that you can successfully run a Jupyter Notebook

If you are unfamiliar with the Jupyter Notebook, have a look at this quick start guide, in particular the section on running the notebook. During the tutorial session we will not have time to solve installation problems, so make sure that you are able to run the Jupyter Notebook before you arrive.

4. Optional: get mapbox token:

If you would like to visualise your spatial plots on a Mapbox base map then you’ll need a Mapbox API token. You can get that by creating a mapbox account: https://www.mapbox.com/

Data

We are using data made available from the Open Power System Data project for this tutorial. These datasets can be found in the data subdirectory and are based on the following download links:

Notebook

To get the notebook, data, and requirements.yml file all in one, just download from this handy link

Hi everyone, I’ve decided to maintain this tutorial on Github. You can find the installation instructions and the tutorial notebook on there. Feel free to come up with interesting takes on the data - I’ll happily accept pull requests :slight_smile:

Happy visualising, all!