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

Using plot arithmetic functions with :: syntax? #351

Closed
petzi53 opened this issue Feb 5, 2024 · 3 comments
Closed

Using plot arithmetic functions with :: syntax? #351

petzi53 opened this issue Feb 5, 2024 · 3 comments

Comments

@petzi53
Copy link

petzi53 commented Feb 5, 2024

Thank you for the wonderful package!

My question: Is there a way to work with the plot arithmetic functions without loading and attaching the package via library()? I am referring to the <package name>::<function> syntax.

@mschilli87
Copy link

Can you give an example? Like code that works with calling library first so we could try to provide the alternative without it?

@Fan-iX
Copy link

Fan-iX commented Feb 7, 2024

I think you can use patchwork:::"-.ggplot"(p1, p2).

For example:

patchwork:::"-.ggplot"(
  ggplot(iris)+geom_point(aes(Petal.Length,Petal.Width)),
  ggplot(iris)+geom_point(aes(Sepal.Length,Sepal.Width))
)

Available functions:

operator function
+ ggplot2:::"+.gg"()
- patchwork:::"-.ggplot"()
| patchwork:::"|.ggplot"()
/ patchwork:::"/.ggplot"()
* patchwork:::"*.gg"()
& patchwork:::"&.gg"()

@petzi53
Copy link
Author

petzi53 commented Feb 10, 2024

@Fan-iX Thank you, that answers my question in all details! (I didn't anticipate that there would be different function calls for the different operators.)

@petzi53 petzi53 closed this as completed Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants