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

image legend key #18

Open
GuangchuangYu opened this issue Dec 11, 2018 · 7 comments
Open

image legend key #18

GuangchuangYu opened this issue Dec 11, 2018 · 7 comments

Comments

@GuangchuangYu
Copy link
Owner

GuangchuangYu commented Dec 11, 2018

#!/bin/env Rscript
library(ggimage)
set.seed(2018-12-11)
d  <-  data.frame(x=1:10, y=1:10,
                  type = sample(LETTERS[1:3], 10, replace=T),
                  angle = runif(10, 0, 360))

options(ggimage.keytype = "point")
ggplot(d, aes(x, y, colour=type, angle=angle)) +
    geom_pokemon(aes(image=ifelse(x>5, 'pikachu', 'tauros')))


windows()
options(ggimage.keytype = "rect")
ggplot(d, aes(x, y, colour=type, angle=angle)) +
    geom_pokemon(aes(image=ifelse(x>5, 'pikachu', 'tauros')))

windows()
options(ggimage.keytype = "image")
ggplot(d, aes(x, y, colour=type, angle=angle)) +
    geom_pokemon(aes(image=ifelse(x>5, 'pikachu', 'tauros')), angle=45)

image-key

For legend key of image color, I implemented three optional keytypes:

  1. solid circle dots ❤️
  2. rectangle 👍
  3. image (the R logo, similar to text color legend that use ) 😄
@GuangchuangYu
Copy link
Owner Author

GuangchuangYu commented Dec 11, 2018

Which one do you prefer?

❤️ for 1, 👍 for 2 and for 😄 for 3, please click the emoji icon to vote for it.

Please comment on it if you have any other idea!

@qliugithub
Copy link

😄😄😄😄😄😄😄😄😄😄😄😄😄😄😄😄😄😄😄😄😄

@panqiao
Copy link

panqiao commented Dec 11, 2018

good

@maelle
Copy link

maelle commented Dec 11, 2018

I prefer the dots... only if it's not possible to have the images themselves in the legend 😉

@GuangchuangYu
Copy link
Owner Author

@maelle personally, I also prefer the dots. The images used in the plot cannot be used in the legend, as we cannot use the text in the plot as legend. There can be several different images that belong to the same category and have identical color. None of them are suitable.

@teng-gao
Copy link

Why not make dot the default behavior and allow users to override the shapes as well?

@GuangchuangYu
Copy link
Owner Author

@teng-gao dot is indeed the default.

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

No branches or pull requests

5 participants