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

aspect ratio of image subfigure not retained #17

Closed
cmhh opened this issue Jan 8, 2018 · 6 comments
Closed

aspect ratio of image subfigure not retained #17

cmhh opened this issue Jan 8, 2018 · 6 comments

Comments

@cmhh
Copy link

@cmhh cmhh commented Jan 8, 2018

It looks to me like png images etc. get stretched vertically when included? It looks to be by a factor of 600 / 518 (or 2 / 1.73, if the linked spec is to be believed). If I flatten the image in gimp or something, then include it, it seems to come out okay.

@cmhh
Copy link
Author

@cmhh cmhh commented Jan 8, 2018

I imagine for similar reasons, when h_size is greater than 1, the border gets clipped at the top an bottom of the image. I haven't looked at the package internals yet, but it seems like the code assumes an aspect ratio of 1:1, when it is 1:0.863.

@nathaneastwood
Copy link

@nathaneastwood nathaneastwood commented Mar 5, 2018

Flattening the image didn't work for myself. The image still appears stretched. h_size doesn't seem to have any effect on the image.

@cmhh
Copy link
Author

@cmhh cmhh commented Mar 5, 2018

I shouldn't have used the term 'flatten', though, since that has a particular meaning with image processing. I more meant to change the aspect ratio in an editing program.

@gpaux
Copy link
Contributor

@gpaux gpaux commented Jan 13, 2019

I got the same issue, I revised a part of the code of the sticker function to get the original aspect ratio:

 if (inherits(subplot, "character")) {
    image <- png::readPNG(subplot)
    logo <-  grid::rasterGrob(image, interpolate = TRUE)
    sticker <- hex + ggplot2::annotation_custom(logo, xmin = s_x, xmax = s_x + s_width, ymin = s_y, ymax = s_y + s_height) 
  }
GuangchuangYu added a commit that referenced this issue Jan 14, 2019
@GuangchuangYu
Copy link
Owner

@GuangchuangYu GuangchuangYu commented Jan 14, 2019

now asp parameter supported.

@gpaux
Copy link
Contributor

@gpaux gpaux commented Jan 14, 2019

Thanks, nice update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.