我目前正在处理 ggplot 柱状图,并且正在尝试在右下角添加徽标。这是图表的代码:
df <- data.frame(Names = c("2001", "2004", "2008", "2012", "2018"),
Value = c(47053, 68117, 171535, 241214, 234365))
p <- ggplot(df, aes(x = Names, y = Value)) +
geom_col(fill = "#DB4D43") + theme_classic() +
geom_text(aes(label = Value, y = Value + 0.05),
position = position_dodge(0.9),
vjust = 0)
Run Code Online (Sandbox Code Playgroud)
我遵循了我在网上找到的这个教程,但由于某种原因,它不会让我调整徽标的大小,并且无论我在 image_scale 函数上输入什么,它最终看起来都太小了。
img <- image_read("Logo.png")
img <- image_scale(img,"200")
img <- image_scale(img, "x200")
g <- rasterGrob(img)
size = unit(4, "cm")
heights = unit.c(unit(1, "npc") - size,size)
widths = unit.c(unit(1, "npc") - …Run Code Online (Sandbox Code Playgroud)