Data visualisation with Blender and Python

Today we’ll have a look on how to use blender CLI to automate Data Visualisation.

In those COVID-19 times we’ll use a public API to get fresh data about COVID spread around countries.

https://www.data.gouv.fr/fr/datasets/donnees-hospitalieres-relatives-a-lepidemie-de-covid-19/#_

Covid-19 French data (reanimations)
Covid-19 French data (hospitalizations)
Covid-19 French data (death)

Here Python we’ll be use to launch Blender passing it a Python Script. Don’t be confused, the same Blender python script could be launch with your favorite langage.Look Point 3

Software used :

Be sure (on Mac, Windows or Linux) to have Blender, Python in your PATH so you’ll be able to execute those executables wherever folder you are on your computer.

  1. Check requirements

Open command line.

If Blender is in the path you would be able to launch it typing :

$ blender

Same for Python :

$ python -v

2. Choose your playground !

Next you have to choose where you want to plot your datas and what kind of data you want to visualize.

For the tutorial i will use Japan to plot datas.

I’ll get an SVG File of the country with districts on Wikipedia:

https://upload.wikimedia.org/wikipedia/commons/6/6e/Japan_location_map.svg

$ wget https://upload.wikimedia.org/wikipedia/commons/6/6e/Japan_location_map.svg

You could now open Blender and import the SVG file.

svg import in Blender

You make the import. Once is done, no worries. You won’t see anything new on the 3D view, but have a look at the Outliner:

SVG file is well imported even if you don’t see anything on the 3D View
Zoom on the 3D View to make your svg appears

For the tutorial we’ll use a simple example using only 2 districts. Let’s choose a big one, Curve.055 for example. Click on Curve.055 on the Outliner. (Hokkaidō District IRL)

Posted in 3D