Skip to content

Instantly share code, notes, and snippets.

@smillies
Created November 6, 2018 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smillies/2575831ddfa5731b8d04d08d0f1bdad1 to your computer and use it in GitHub Desktop.
Save smillies/2575831ddfa5731b8d04d08d0f1bdad1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib
matplotlib.use('agg') # avoid use of tkinter (not preinstalled on Linux)
# GIF support requires ImageMagick which is installed by default on many Linux installations
import holoviews as hv
hv.extension('matplotlib')
# create a series of 5 x 5 heatmaps
numHeatMaps = 2
measurements = [[(i + 1, j + 1, k * 100 + i * 10 + j) for i in range(5) for j in range(5)] for k in range(numHeatMaps)]
heatMapDict = {k:hv.HeatMap(measurements[k]) for k in range(len(measurements))}
holo = hv.HoloMap(heatMapDict, kdims='index')
# render the heatmaps as an animated GIF
renderer = hv.renderer('matplotlib')
renderer.fps = 5
renderer.save(holo, 'holo', fmt='gif') # broken in Python 3.7 under Windows 10 for any value of numHeatMaps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment