ggimage icon indicating copy to clipboard operation
ggimage copied to clipboard

image legend key

Open GuangchuangYu opened this issue 6 years ago • 7 comments

#!/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 avatar Dec 11 '18 06:12 GuangchuangYu

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!

GuangchuangYu avatar Dec 11 '18 06:12 GuangchuangYu

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

qliugithub avatar Dec 11 '18 07:12 qliugithub

good

panqiao avatar Dec 11 '18 07:12 panqiao

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

maelle avatar Dec 11 '18 07:12 maelle

@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.

GuangchuangYu avatar Dec 11 '18 08:12 GuangchuangYu

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

teng-gao avatar Dec 11 '18 12:12 teng-gao

@teng-gao dot is indeed the default.

GuangchuangYu avatar Dec 11 '18 12:12 GuangchuangYu