Download notebook (.ipynb)

stroke aesthetic#

Affects the thickness of the point boundaries (in case the given shape has a boundary).

Available for the following geometries: geom_point(), geom_jitter(), geom_qq(), geom_qq2(), geom_pointrange(), geom_dotplot(), geom_ydotplot().

from lets_plot import *
LetsPlot.setup_html()
data1 = {
    'x': (list(range(7)) * 4)[:26],
    'y': ([3] * 7 + [2] * 7 + [1] * 7 + [0] * 7)[:26],
    'shape': list(range(26)),
}
p1 = ggplot(data1, aes('x', 'y')) + scale_shape_identity() + \
    xlim(-1, 7) + ylim(-1, 4) + \
    theme(legend_position='none')

Default Stroke#

p1 + geom_point(aes(shape='shape'), size=12, color="#54278f", fill="#dd1c77")

Increased Stroke#

p1 + geom_point(aes(shape='shape'), size=12, stroke=6, color="#54278f", fill="#dd1c77")

Stroke Scales#

data2 = {
    'x': [0, 1, 2],
    'y': [0, 0, 0],
    'stroke': [4, 16, 8],
}
p2 = ggplot(data2, aes('x', 'y')) + \
    geom_point(aes(stroke='stroke'), size=12, shape=21, color="#54278f", fill="#dd1c77")
gggrid([
    p2 + ggtitle("Default scale"),
    p2 + scale_stroke(range=[2, 4]) + ggtitle("scale_stroke()"),
    p2 + scale_stroke_identity() + ggtitle("scale_stroke_identity()"),
], ncol=2)