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

Independent adjustment of picture and line transparency when using PhyloPic/Images and align=true parameter #633

Open
iliapopov17 opened this issue Oct 11, 2024 · 0 comments

Comments

@iliapopov17
Copy link

When using geom_tiplab(), it would be useful to adjust the transparency of pictures and lines separately.

For example, when using:

test_tree <- ggtree(newick.tree) %<+% metadata + 
  geom_tiplab(image=df_sorted$uid,
              geom="phylopic",
              size = ifelse(df_sorted$uid == "6e42ac62-37f4-458c-bf44-3f7decb1f14e", 0.025, 0.05),
              alpha= ifelse(df_sorted$name == "NC_004290.1" | df_sorted$name == "NC_000936.1" | df_sorted$name == "NC_005040.1", 0.4, 0.8),
              offset = 1.5,
              align=TRUE) +
  xlim(0,5.2) + 
  geom_tiplab(
    aes(label=Full.Name),
    color="black",
    geom="label",
    fill = "white",
    label.size = 0
  )

I expect the alpha= parameter to adjust the transparency of the picture. But instead it adjusts the transparency of the line, since I have the align=TRUE parameter active.

In documentation of the geom_tiplab() function I did not find a solution to this problem. On the contrary, I was proved that it is not a bug, but a feature:

The following parameters for geom="image" or geom="phylopic".
- `image` the image file path for geom='image', but when geom='phylopic', it should be the uid of phylopic databases.
- `size` the image size, defaults to 0.05.
- `colour` the color of image, defaults to NULL.
- `alpha` the transparency of image, defaults to 0.8.

The following parameters for the line when align = TRUE.
- `colour` the colour of line, defaults to 'black'.
- `alpha` the transparency of line, defaults to NA.
- `arrow` specification for arrow heads, as created by arrow(), defaults to NULL.
- `arrow.fill` fill color to usse for the arrow head (if closed), defaults to 'NULL', meaning use 'colour' aesthetic.

I just want to adjust the transparency (and color too) of pictures separately from the line :(

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

1 participant