Download notebook (.ipynb)

Venn Diagram#

from math import sqrt

from lets_plot import *
LetsPlot.setup_html()
r = .5
h = r * sqrt(3)/2
sets_data = {
    'x': [0, r, r/2],
    'y': [0, 0, h],
    'size': [2*r, 2*r, 2*r],
    'color': ['#e24462', '#306998', '#ffe873'],
}
texts_data = {
    'x': [-r/2, r + r/2, r/2, r/2, -r/8, r + r/8, r/2],
    'y': [-r/4, -r/4, h + r/2, -3*r/8, 5*r/8, 5*r/8, 5*r/16],
    'text': ["Kotlin", "Geospatial\nVisualization", "Grammar\nof\nGraphics", "ArcGIS", "Kandy", "ggmap", "Lets-Plot"],
    'size': [.4*r]*7,
}
ggplot() + \
    geom_point(aes('x', 'y', size='size', fill='color'), \
               data=sets_data, size_unit='x', \
               shape=21, alpha=.5, color='black', \
               tooltips='none') + \
    geom_text(aes('x', 'y', label='text', size='size'), \
              data=texts_data, size_unit='x') + \
    scale_size_identity() + scale_fill_identity() + \
    xlim(-r, 2*r) + ylim(-r, h + r) + \
    coord_fixed() + \
    ggsize(600, 600) + \
    theme_void()