Skip to content

Commit

Permalink
add asp parameter for image file,
Browse files Browse the repository at this point in the history
see also #17
  • Loading branch information
GuangchuangYu committed Jan 14, 2019
1 parent 8da0601 commit 080fb72
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 48 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hexSticker
Title: Create Hexagon Sticker in R
Version: 0.4.5
Version: 0.4.6
Authors@R: c(person(given = "Guangchuang", family = "Yu", email = "guangchuangyu@gmail.com", role = c("aut", "cre")),
person(given = "Laurent", family = "Gatto", email = "lg390@cam.ac.uk", role = "ctb"),
person(given = "Johannes", family = "Rainer", email = "johannes.rainer@eurac.edu", role = "ctb"),
Expand Down
44 changes: 0 additions & 44 deletions NEWS

This file was deleted.

49 changes: 49 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
CHANGES IN VERSION 0.4.6
------------------------
+ asp parameter in sticker <2019-01-14, Mon>
- <https://github.com/GuangchuangYu/hexSticker/issues/17>

hexSticker 0.4.5
------------------------
+ dpi paramter in sticker <2018-09-10, Mon>
+ ... parameter in save_sticker <2018-09-03, Mon>

hexSticker 0.4.2
------------------------
+ update code according to the change +f geom_subview <2017-11-22, Wed>

hexSticker 0.4.0
------------------------
+ remove ggforce dependency <2017-06-19, Mon>

hexSticker 0.3.0
------------------------
+ URL at lower border +f sticker <2017-04-19, Wed>
- https://github.com/GuangchuangYu/hexSticker/issues/9

hexSticker 0.2.1
------------------------
+ bug fixed +f whiteTrans <2017-04-19, Wed>
- https://github.com/GuangchuangYu/hexSticker/pull/8

hexSticker 0.2.0
------------------------
+ support spotlight <2017-04-05, Wed>
- <https://github.com/GuangchuangYu/hexSticker/issues/7>

hexSticker 0.1.0
------------------------
+ geom_hexagon, geom_pkgname, theme_sticker <2017-03-21, Tue>
+ use ggimage::geom_subview and ggimage::geom_image <2017-03-21, Tue>

hexSticker 0.0.2
------------------------
+ support select font typeface <2017-03-15, Wed>
- https://github.com/GuangchuangYu/hexSticker/issues/4
+ move package name to top layer <2017-03-14, Tue>
- https://github.com/GuangchuangYu/hexSticker/issues/3

hexSticker 0.0.1
------------------------
+ initial version based on my script to generate ggtree sticker <2017-03-13, Mon>
- https://github.com/jotsetung/BioC-stickers/blob/master/ggtree/ggtree_sticker.R
5 changes: 3 additions & 2 deletions R/sticker.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
##' @param u_family font family for url
##' @param u_size text size for url
##' @param filename filename to save sticker
##' @param asp aspect ratio, only works if subplot is an image file
##' @param dpi plot resolution
##' @return gg object
##' @importFrom ggplot2 ggplot
Expand All @@ -47,12 +48,12 @@ sticker <- function(subplot, s_x=.8, s_y=.75, s_width=.4, s_height=.5,
h_size=1.2, h_fill="#1881C2", h_color="#87B13F",
spotlight=FALSE, l_x=1, l_y=.5, l_width=3, l_height=3, l_alpha=0.4,
url = "", u_x=1, u_y=0.08, u_color="black", u_family="Aller_Rg", u_size=1.5,
filename = paste0(package, ".png"), dpi = 300) {
filename = paste0(package, ".png"), asp=1, dpi = 300) {

hex <- hexagon(size=h_size, fill=h_fill, color=h_color)
if (inherits(subplot, "character")) {
d <- data.frame(x=s_x, y=s_y, image=subplot)
sticker <- hex + geom_image(aes_(x=~x, y=~y, image=~image), d, size=s_width)
sticker <- hex + geom_image(aes_(x=~x, y=~y, image=~image), d, size=s_width, asp=asp)
} else {
sticker <- hex + geom_subview(subview=subplot, x=s_x, y=s_y, width=s_width, height=s_height)
}
Expand Down
4 changes: 3 additions & 1 deletion man/sticker.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 080fb72

Please sign in to comment.