plotnine
plotnine copied to clipboard
Fill with patterns
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.
This is a feature that depends on a refactoring in Matplotlib. When that happens, then we will have scale_hatch_discrete
in plotnine.
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.
Can we use scale_hatch_discrete() in plotnine now ?