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

[Feature Request]: Watermarking #264

Open
3 tasks done
npaszty opened this issue Sep 3, 2024 · 1 comment
Open
3 tasks done

[Feature Request]: Watermarking #264

npaszty opened this issue Sep 3, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@npaszty
Copy link

npaszty commented Sep 3, 2024

Feature description

would be great to have a standard solution across all teal modules to allow user to provide watermark text to overlay on table and visualization output while also using the plot_with_settings functions. see issue #263

image

I suspect this is substandard compared to the core dev work but this is a simple function we use for applying watermark to visualization outputs.

# watermark
h2oMark <- function(plot2wm, 
                    text_value = "Not for GxP Use",
                    text_size = c(20),
                    text_opacity = c(0.75),
                    text_color = "grey",
                    text_rotation = c(45),
                    text_xmin = -Inf,
                    text_xmax = Inf,
                    text_ymin = -Inf,
                    text_ymax = Inf) {
  
  # add text watermark
  watermark <- textGrob(text_value, 
                        gp = gpar(fontsize = text_size, alpha = 0.75, col = "grey"),
                        rot = 45)
  
  # add the watermark to the plot
  plot2wm + annotation_custom(grob = watermark, xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)
  
}

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.
@npaszty npaszty added the enhancement New feature or request label Sep 3, 2024
@pawelru
Copy link
Contributor

pawelru commented Oct 18, 2024

I think that we are in progress of developing such general feature and enable it for all the modules. We call it a "decoration module" that would allow you (app developer) to take an output (e.g. plot) from the module, run some user provided "code" that returns the same type of object (e.g. continue to return plot). Exactly as you did in your snippet.
The most updated state is available here and you can track the progress of implementation here. I don't expect you to go very much into the details but just FYI that it's ongoing.

CC @kumamiao @donyunardi - yet another good use case for that feature

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

2 participants