Point Shapes

In [1]:
from lets_plot import *

from common import docs_dark_theme
In [2]:
LetsPlot.setup_html()
In [3]:
def get_data():
    n = 26
    return {
        "x": (list(range(7)) * 4)[:n],
        "y": ([3] * 7 + [2] * 7 + [1] * 7 + [0] * 7)[:n],
        "shape": list(range(n)),
    }
In [4]:
def get_plot():
    return ggplot(get_data(), aes("x", "y")) + scale_shape_identity() + \
        geom_text(aes(label="shape"), size=15, family="mono", position=position_nudge(y=.3)) + \
        geom_point(aes(shape="shape"), size=10, fill="#fa9fb5", tooltips="none") + \
        coord_cartesian(xlim=[-.5, 6.5], ylim=[-.25, 3.5]) + \
        ggsize(800, 600) + \
        theme_void()
In [5]:
plot = get_plot()
ggsave(plot, "aesthetics_shape.png")
plot
Out[5]:
In [6]:
plot_dark = get_plot() + docs_dark_theme()
ggsave(plot_dark, "aesthetics_shape_dark.png")
plot_dark
Out[6]: