#!/usr/bin/env python # coding: utf-8 # # `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()`. # In[1]: from lets_plot import * # In[2]: LetsPlot.setup_html() # In[3]: data1 = { 'x': (list(range(7)) * 4)[:26], 'y': ([3] * 7 + [2] * 7 + [1] * 7 + [0] * 7)[:26], 'shape': list(range(26)), } # In[4]: p1 = ggplot(data1, aes('x', 'y')) + scale_shape_identity() + \ xlim(-1, 7) + ylim(-1, 4) + \ theme(legend_position='none') # #### 1. Default Stroke # In[5]: p1 + geom_point(aes(shape='shape'), size=12, color="#54278f", fill="#dd1c77") # #### 2. Increased Stroke # In[6]: p1 + geom_point(aes(shape='shape'), size=12, stroke=6, color="#54278f", fill="#dd1c77") # #### 3. Stroke Scales # In[7]: data2 = { 'x': [0, 1, 2], 'y': [0, 0, 0], 'stroke': [4, 16, 8], } # In[8]: p2 = ggplot(data2, aes('x', 'y')) + \ geom_point(aes(stroke='stroke'), size=12, shape=21, color="#54278f", fill="#dd1c77") # In[9]: gggrid([ p2 + ggtitle("Default scale"), p2 + scale_stroke(range=[2, 4]) + ggtitle("scale_stroke()"), p2 + scale_stroke_identity() + ggtitle("scale_stroke_identity()"), ], ncol=2)