Skip to content

Instantly share code, notes, and snippets.

@eboisseau
eboisseau / bargraph_annotation_upon_hovering.py
Last active April 17, 2018 16:17
This files creates a pyplot bar graph and shows a tooltip at the middle of a bar when it is hovered.
# This files creates a pyplot bar graph and shows a tooltip at the middle of a bar when it is hovered.
# Licenced under CC0 1.0 Universal Public Domain Dedication
# adapted from https://stackoverflow.com/a/47166787/5433628
import matplotlib.pyplot as plt
# input data
x = [2010, 2011, 2012, 2013]
y = [13, 17, 42, 4]