BiocStickers icon indicating copy to clipboard operation
BiocStickers copied to clipboard

Function to create a sticker

Open lgatto opened this issue 8 years ago • 16 comments

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

lgatto avatar Mar 08 '17 21:03 lgatto

that's awesome. Thanks @lgatto

GuangchuangYu avatar Mar 09 '17 03:03 GuangchuangYu

Very nice 👍 🥇

jorainer avatar Mar 09 '17 06:03 jorainer

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 avatar Mar 09 '17 09:03 lgatto

@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 avatar Mar 09 '17 15:03 lgatto

New defaults bioconductor

lgatto avatar Mar 09 '17 15:03 lgatto

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 avatar Mar 10 '17 04:03 GuangchuangYu

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

bioconductor

https://github.com/jotsetung/BioC-stickers/commit/142d1f54aa018197f80dca305a50428f7e19627b change the dimension according to https://twitter.com/robbie_bonelli/status/795211775679418372.

GuangchuangYu avatar Mar 10 '17 07:03 GuangchuangYu

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 142d1f54aa018197f80dca305a50428f7e19627b, 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.

lgatto avatar Mar 10 '17 09:03 lgatto

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 avatar Mar 10 '17 09:03 jorainer

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

jorainer avatar Mar 10 '17 09:03 jorainer

I have created a sticker package with the make_sticker function.

lgatto avatar Mar 10 '17 11:03 lgatto

@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

jorainer avatar Mar 10 '17 13:03 jorainer

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.

lgatto avatar Mar 10 '17 14:03 lgatto

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

GuangchuangYu avatar Mar 12 '17 15:03 GuangchuangYu

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

jorainer avatar Mar 12 '17 16:03 jorainer

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

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

GuangchuangYu avatar Mar 13 '17 08:03 GuangchuangYu