import numpy as np
from lets_plot import *
LetsPlot.setup_html()
np.random.seed(0)
N = 200
noise = dict(
x = np.random.uniform(0, 200, N),
y = np.random.uniform(100, 400, N),
size = np.random.uniform(0.1, 2, N)
)
backdrop = geom_point(aes("x", "y", size="size"), data=noise, tooltips='none')
items = [
dict(
name="Lets-Plot\nMultiplatform",
documentation_url="https://lets-plot.org",
sources_url="https://github.com/JetBrains/lets-plot",
x=0, y=0, size=14, shape=16, angle=0
),
dict(
name="Lets-Plot\nfor Python",
documentation_url="https://lets-plot.org/kotlin/get-started.html",
sources_url="https://github.com/JetBrains/lets-plot-kotlin",
x=130, y=150, size=9, shape=15, angle=15
),
dict(
name="Lets-Plot\nfor Kotlin",
documentation_url="https://lets-plot.org/kotlin/get-started.html",
sources_url="https://github.com/JetBrains/lets-plot-kotlin",
x=200, y=200, size=7, shape=15, angle=-15
),
dict(
name="Lets-Plot\nCompose Multiplatform",
documentation_url="https://github.com/JetBrains/lets-plot-skia",
sources_url="https://github.com/JetBrains/lets-plot-skia",
x=80, y=250, size=7, shape=15, angle=30
),
dict(
name="Geocoding",
documentation_url="https://lets-plot.org/python/pages/geocoding.html",
sources_url="https://github.com/JetBrains/lets-plot",
x=70, y=320, size=7, shape=17, angle=0
),
dict(
name="Kandy",
documentation_url="https://kotlin.github.io/kandy/welcome.html",
sources_url="https://github.com/Kotlin/kandy",
x=195.0, y=150.0, size=4.0, shape=16, angle=0.0
),
]
map_to = lambda key: [item[key] for item in items]
data = dict(name=map_to("name"),
documentation_url=map_to("documentation_url"),
sources_url=map_to("sources_url"),
x=map_to("x"),
y=map_to("y"),
size=map_to("size"),
shape=map_to("shape"),
angle=map_to("angle"))
(ggplot(data) + backdrop
+ geom_point(aes("x", "y", size="size", shape="shape", angle="angle", color="name"), show_legend=False,
tooltips=layer_tooltips().title("@name")
.line("Links: <a href=\"@{documentation_url}\">docs</a>, "
"<a href=\"@{sources_url}\">sources</a>"))
# Kandy orbit
+ geom_point(x=200, y=200, size=37, shape=1, stroke=.07)
# Kandy stick
+ geom_spoke(x=195, y=150, angle=-3.14/2/1.05, radius=30, size=1, color="rgb(255,255,97)")
# Guide
+ geom_text(x=50, y=250, size=12,
label="Hover, then click\nto <a href=\"https://www.merriam-webster.com/dictionary/freeze\">freeze</a> "
"the tooltip.\nClick links\nto navigate.")
+ geom_segment(x=70, y=250, xend=0, yend=0,
size_start=150, size_end=20,
arrow=arrow(type='open', angle=40))
+ scale_y_continuous(breaks=[150, 200, 250, 320])
+ scale_shape_identity() + scale_size_identity()
+ coord_polar()
+ ylim(0, 400) + ggsize(800, 800)
+ labs(title='The <a href=\"https://lets-plot.org/python/pages/gallery.html\">Observable</a> LP-verse',
subtitle='Latest <a href="https://github.com/JetBrains/lets-plot/releases/latest">news</a>.',
caption='User <a href="https://github.com/JetBrains/lets-plot/issues">stories</a>.')
+ theme(plot_title=element_text(size=25, face="bold", hjust=0.5),
plot_subtitle=element_text(hjust=0.5),
plot_margin=[40, 0, 0],
axis_title='blank',
axis_text='blank',
axis_ticks='blank',
panel_grid='blank',
panel_grid_major_y=element_line(size=3, linetype='dotted'))
+ flavor_high_contrast_dark()
)