Mortality rates for different causes over selectable timeframes

Here’s a mortality rate visualisation for Australians I made the other month. This wouldn’t have been possible without a huge amount of help and patience from everyone in the forums, in particular from @p-himik, who tirelessly answered all my dumbass questions.

This was made from a desire to give some perspective to COVID-19, regardless of what opinions you might hold towards it. When learning about the virus I found myself questioning at what rates do people normally die from different causes, and this tries to answer that question.

Initially this was drafted with only the heatmap as normal people find heatmaps intuitive but I realised line graphs are better at depicting probabilities, so we’ve got both. Choosing the heatmap’s color scale was tricky as elderly mortality rates increase more rapidly than expected, and we need to compromise between:

  • proportional differences being easy to accurately perceive
  • small differences in lower values being easy to distinguish
  • colours intuitively representing life and death

A log scale would’ve worked, but that would’ve been too confusing for normal people. I ended up using a modified CET_CBTL1 from Colorcet, adding a little green and transitioning faster through low values.

There’s still one thing that’d be nice to improve: I couldn’t work out how to make the line graph adapt to the selected gender. @p-himik nearly got me there on the forums, but frankly by that stage I was too tired to learn more JavaScript, and I had already asked too much of everyone here. If anyone can be bothered figuring out the code I’d be very grateful.

Also, the line graph tooltips for muted lines are hidden, which is a new Bokeh feature @p-himik and @Bryan instantaneously rolled out when I asked how to do this. Thank you both very much!


Great visualization and presentation. Clearly shows causes of mortality based on age/gender.

For what it’s worth, here is my feedback:

  • Age range with 1 as minor tick seems to be overkill. Maybe using 20 years (0-20, 21-40, etc.) or 10 years makes information more easier to digest? Helps to focus on age ranges most affected by a particular cause of death.

  • Red and Green colors make it tough for people with color-blindness. You can use the Adobe Color Wheel to come up with a more accessible set of colors.


Thanks to @carolyn’s help with JavaScript and other dumb questions I’ve updated the vis with gender now being selectable in the line graph. Thank you once again for all the help.

Also, I’ve learned that sizing_mode="stretch_both" made this display differently based on the size and resolution of your monitor, and while it looked great on mine it didn’t on others, and I now understand the difference between px and pt font sizes… How embarrassing. I’ve tweaked it so it hopefully displays a little better on smaller and low resolution monitors that scale by 125% on default.

Hey @tvkyq,

Thanks so much for sharing! Is it alright if we tweet about your project? Is there a Twitter handle we should tag?

For sure, go for it! And no, I don’t have an active Twitter handle.