Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treemapify::geom_treemap() support #6

Open
luisDVA opened this issue May 26, 2020 · 3 comments
Open

treemapify::geom_treemap() support #6

luisDVA opened this issue May 26, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@luisDVA
Copy link

luisDVA commented May 26, 2020

Hi,
As discussed on Twitter, just requesting support for pattern fill in treemaps created by treemapify::geom_treemap.
I'll try to work on it myself and send a PR, but I'm not too confident about it.
cheers

@coolbutuseless coolbutuseless self-assigned this Jun 28, 2020
@coolbutuseless coolbutuseless added the enhancement New feature or request label Jun 28, 2020
@trevorld trevorld changed the title geom_treemap support treemapify::geom_treemap() support Jun 28, 2021
@BernhardClemm
Copy link

This would be a great feature to have!

@trevorld
Copy link
Owner

A user recently wrote in an email:

I recently wanted to apply patterns to geom_treemap() ... I am wondering whether this is on your agenda – and whether I could potentially help building this functionality ... Let me know whether my contribution could make sense, and if so how I could best get going (would probably need a short intro to the logic of the package).

  • Adding new geoms like this one isn't on my agenda for ggpattern v1.1.1 #104

  • A PR that adds support for this functionality would be welcome and I could help guide potential contributors through the process

  • After the release of ggplot2 v3.5.0 there are two approaches to adding pattern support to a geom:

    • Update the original geom to support grid::pattern() / gradient fills (I opened an issue for this at Support grid::pattern() / gradient fills wilkox/treemapify#50)

      • Pros: Low amount of developer effort
      • Cons: Works in fewer graphics devices and versions of R, less ability to customize patterns in legends and with scales
    • Add a new geom based on the original geom to {ggpattern}

      • Pros: Works in more graphics devices and versions of R, more ability to customize patterns in legends and with scales
      • Cons: High amount of developer effort
  • If you desire to add a new geom to {ggpattern} some notes:

    • One can use a good difftool like nvim -d to compare the geom files in {ggpattern} with those in {ggplot2}:

    • We usually inherit the original Geom so we don't need to duplicate data setup code

    • We usually add some code to handle the new pattern aesthetics

    • We usually update the drawing code to instead of drawing one polygon/rect/path to instead

      • Draw the polygon/rect/path with fill and no border
      • Draw the patterns
      • Draw the polygon/rect/path with no fill and the col border
  • You may need to copy and paste code from {treemapify} and/or ask them nicely to export more low-level functionality

  • If importing code from {treemapify} please put the package in the Suggests instead of Imports field of our DESCRIPTION

@trevorld trevorld changed the title treemapify::geom_treemap() support treemapify::geom_treemap() support Apr 24, 2024
@trevorld
Copy link
Owner

  • Pattern fills (such as those returned by gridpattern::patternFill()) should now work in the development version of {treemapify}: wilkox/treemapify@082641a
  • We'll keep this issue open in case someone would like to add a PR for a geom_treemap_pattern()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants