YuLab-SMU / aplot

Decorate a plot with associated information
https://yulab-smu.top/aplot
92 stars 14 forks source link

updating funky_point and funky_bar #29

Closed xiangpin closed 1 year ago

xiangpin commented 1 year ago
library(aplot)
library(tidyverse)
library(ggfun)
data("mtcars")

d <- yulab.utils::scale_range(mtcars) |>
  rownames_to_column("id") |>
  arrange(desc(mpg))

g0 = funky_text(d, 1)
g1 = funky_point(d, 8, shape = 15)
g2 = funky_point(d, 9, shape = 13, fill = "#7fc97f")
g3 = funky_point(d, 10, shape = 28, size = 5)
g4 = funky_point(d, 11, shape = 11)
g5 = funky_point(d, 12, shape = 23)
p = funky_heatmap(g0, g1, g2, g3, g4, g5,
              options = theme(legend.position='none')
    )
p

image


library(aplot)
library(ggfun)
library(tidyverse)
data("mtcars")

d <- yulab.utils::scale_range(mtcars) |>
  rownames_to_column("id") |>
  arrange(desc(mpg))

set.seed(1)
d$level_A = sample(1:10, nrow(d), replace = T)
set.seed(2)
d$level_B = sample(1:10, nrow(d), replace = T)
set.seed(3)
d$level_C = sample(1:10, nrow(d), replace = T)

g0 = funky_text(d, 1)
g1 = funky_bar(d, 2)
g2 = funky_bar(d, 13:15)

p = aplot::funky_heatmap(g0, g1, g2)
p                                 

image

related issue https://github.com/YuLab-SMU/ProjectYulab/issues/6#issuecomment-1600020198

GuangchuangYu commented 1 year ago

nice.

I would suggest the shape parameter to support:

  1. default is NULL, and map column names to different shapes.
  2. length of 1 to set all the columns to identical shape.
  3. length that equals to the cols and set shape correspondingly.