plotnine icon indicating copy to clipboard operation
plotnine copied to clipboard

Fill with patterns

Open geochemistry opened this issue 6 years ago • 3 comments

Is it possible to fill barplots with patterns using plotnine? I needed to create some black & white figures. If I fill the bars with grays, different groups are hard to distinguish. I can use the hatch property in matplotlib to fill my bar plots with patterns, something like this. figure_1

geochemistry avatar Dec 14 '18 12:12 geochemistry

This is a feature that depends on a refactoring in Matplotlib. When that happens, then we will have scale_hatch_discrete in plotnine.

has2k1 avatar Dec 16 '18 20:12 has2k1

To elaborate a bit on @has2k1 statement: hatching in matplotlib suffers from neglect. Hatch-width and hatch-color are not exposed via API (they must be set globally with via rcParams), and hatch itself on PolyCollections (which geom_rect, bar, polygon, tile, bin2d and colorbar use) is a 'second-class' parameter - it only accepts one for all polygons drawn, unlike e.g. fill.

TyberiusPrime avatar Jan 11 '19 08:01 TyberiusPrime

Can we use scale_hatch_discrete() in plotnine now ?

wangjiawen2013 avatar Nov 18 '21 07:11 wangjiawen2013