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

Function to create a sticker #12

Open
lgatto opened this issue Mar 8, 2017 · 16 comments
Open

Function to create a sticker #12

lgatto opened this issue Mar 8, 2017 · 16 comments

Comments

@lgatto
Copy link
Collaborator

lgatto commented Mar 8, 2017

Based on @GuangchuangYu's script, I created the make_sticker function to make it easier to re-use and adapt. It's rough around the edges but a decent start. Suggestions and patches welcome.

 make_sticker()

mypackage

library("ggplot2")
p <- ggplot(aes(x = mpg, y = wt), data = mtcars) + geom_point()
x <- make_sticker(p, "Bioconductor", 
                  grob_xmin = 0.5, grob_xmax = 1.5,
                  grob_ymin = .35, grob_ymax = 1.25)

bioconductor

@GuangchuangYu
Copy link
Contributor

that's awesome. Thanks @lgatto

@jorainer
Copy link
Collaborator

jorainer commented Mar 9, 2017

Very nice 👍 🥇

@lgatto
Copy link
Collaborator Author

lgatto commented Mar 9, 2017

TODO

- [ ] Adjust dimensions to get an image of height 5cm, ready for printing.
- [ ] Fix hexagon not filling the full square; on the left side there is a small gap.

TODO list has been moved to sticker issue 1.

@lgatto
Copy link
Collaborator Author

lgatto commented Mar 9, 2017

@LiNk-NY @mtmorgan - the make_sticker function seems to be quite useful (to me, at least). I would rather move it to a package for convenience. Would you consider it fit for BiocStyle, for example, or should it get its own package?

@lgatto
Copy link
Collaborator Author

lgatto commented Mar 9, 2017

New defaults
bioconductor

@GuangchuangYu
Copy link
Contributor

I vote for new package, maybe BiocSticker. Developers can PR for their sticker_pkgname function and then we can have a package of reproducible sticker collections.

@GuangchuangYu
Copy link
Contributor

GuangchuangYu commented Mar 10, 2017

p <- ggplot(aes(x = mpg, y = wt), data = mtcars) + geom_point()
p = p + theme_void() + theme_transparent()
make_sticker(p, "Bioconductor")

bioconductor

142d1f5 change the dimension according to https://twitter.com/robbie_bonelli/status/795211775679418372.

@lgatto
Copy link
Collaborator Author

lgatto commented Mar 10, 2017

I vote for new package, maybe BiocSticker. Developers can PR for their sticker_pkgname function and then we can have a package of reproducible sticker collections.

Ok for a package; I would rather name it stickeR or sticker to make it more general.

If we push actual sticker creation functions in there, then this repo becomes obsolete. The advantage of an external package is that it easier for me to control what version I use for my sticker; otherwise, every change in the function (like 142d1f5, for example), possibly breaks stickers.

With respect to the package, having it on github allows to install versions based on SHA commit hashes; this enables me to keep using one consistently for different stickers, as long as I record which SHA I was using upon creation.

@jorainer
Copy link
Collaborator

I would only make a package of the functionality to create the stickers and would not include the actual stickers or sticker functions into that package. 1) some stickers (mine ;) ) were made manually and 2) I would simply keep functionality (the function) and results (the stickers) separate.

@jorainer
Copy link
Collaborator

I realized that the hexagon is not filling the full square. On the left side there is a small gap. Could this be fixed?

@lgatto lgatto mentioned this issue Mar 10, 2017
2 tasks
@lgatto
Copy link
Collaborator Author

lgatto commented Mar 10, 2017

I have created a sticker package with the make_sticker function.

@jorainer
Copy link
Collaborator

@lgatto Is the function in the package different from the one we had here? I'm asking because the same code that generated this sticker https://github.com/jotsetung/BioC-stickers/blob/master/mzR/mzR.png now creates:
mzr

@lgatto
Copy link
Collaborator Author

lgatto commented Mar 10, 2017

There have been a couple of PRs recently, but I think that the text size is also influenced by other parameters (at least that's what I observed yesterday, when preparing the pRoloc stickers). That why we need a package and the flexibility to install a use a specific SHA has to preserve old stickers, at least until we have a stable make_sticker.

@GuangchuangYu
Copy link
Contributor

This is because the units are in two different spaces (data and pixel).

@jorainer
Copy link
Collaborator

Yup, I just reduced the size of the text - works now.

@GuangchuangYu
Copy link
Contributor

I have some ideas to improve it and create a package separately for not breaking your existing codes.

see https://github.com/GuangchuangYu/hexSticker.

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