{{ message }}
feat(geom_rect): add a hatch aesthetic - #1122
Open
floringogianu wants to merge 1 commit into
Open
floringogianu wants to merge 1 commit into
floringogianu wants to merge 1 commit into
Conversation
Adds a `hatch` aesthetic to geom_rect and everything built on it (geom_bar, geom_col, geom_histogram, geom_tile, geom_bin_2d), settable as a literal (geom_col(hatch="//")) or mapped through a discrete scale (geom_col(aes(hatch="grp"))). A matplotlib Collection takes one hatch pattern for all of its paths, so each distinct pattern gets an overlay PolyCollection with no fill and no border, drawn over the parent. The strokes take the `color` aesthetic, matplotlib's convention for a hatch, and fall back to rcParams["patch.edgecolor"] when color is unset. The overlay's linewidth is zero so the parent keeps sole ownership of the border and its linetype. geom_polygon.draw_group carries the hatch through as well, since geom_rect delegates to it under a non-linear coord. Legend keys repeat the pattern by round(HATCH_KEY_SIZE / key_size), so a small key stays legible while a large one converges on the density the panel draws. Scale family modeled on scale_linetype: - scale_hatch (discrete) / scale_hatch_discrete - scale_hatch_identity - scale_hatch_manual (custom per-level patterns) - scale_hatch_continuous raises PlotnineError, mirroring scale_linetype_continuous `labs(hatch=...)` names the legend.
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #238
Adds a
hatchaesthetic to geom_rect and everything built on it (geom_bar, geom_col, geom_histogram, geom_tile, geom_bin_2d), settable as a literal (geom_col(hatch="//")) or mapped through a discrete scale (geom_col(aes(hatch="grp"))).A matplotlib Collection takes one hatch pattern for all of its paths, so each distinct pattern gets an overlay PolyCollection with no fill and no border, drawn over the parent. The strokes take the
coloraesthetic, matplotlib's convention for a hatch, and fall back to rcParams["patch.edgecolor"] when color is unset. The overlay's linewidth is zero so the parent keeps sole ownership of the border and its linetype.geom_polygon.draw_groupcarries the hatch through as well, sincegeom_rectdelegates to it under a non-linear coord.Legend keys repeat the pattern by round(HATCH_KEY_SIZE / key_size), so a small key stays legible while a large one converges on the density the panel draws.
Scale family modelled on
scale_linetype:scale_hatch(discrete) /scale_hatch_discretescale_hatch_identityscale_hatch_manual(custom per-level patterns)scale_hatch_continuousraisesPlotnineError, mirroringscale_linetype_continuouslabs(hatch=...)names the legend.