是否可以使用自定义图片作为条形图中的条形图?

Is it possible to use a custom picture as the bars in a bar chart?

我有想要绘制的数据,而不是显示 y 轴值的常规垂直条,我想要:

1) 用图片(例如圣诞装饰图案)填满栏

2) 使用自定义图片(比如蜡烛)作为柱状图

这可能吗?我的首选平台是 R Excel 或 Tableau public.

在 excel 2013 年,您可以使用图像文件填充图表中的列。 Select 右键单击​​该列,然后从弹出菜单中 select 格式化数据点。 Select 油漆桶选项卡,在填充选项下选择图片或纹理填充,然后从文件中插入图片。该图像现在覆盖在图表的列上。

你可以试试

library(jpeg)
library(grid)
library(lattice)

#download Chrismas tree image which will be used as bar in barplot
download.file("https://upload.wikimedia.org/wikipedia/commons/f/fa/Poinsettia_tree.jpg", "Poinsettia_tree.jpg")
chrismas_tree <- readJPEG("Poinsettia_tree.jpg")

#sample data for barplot
counts <- table(mtcars$gear)

#barplot
barchart(counts, origin=0, col="white",horizontal = FALSE,
             panel=function(x, y, ...) {
             panel.barchart(x, y, ...)
             grid.raster(chrismas_tree, y=0, height=y, x=x,
                               default.units="native", 
                               just="bottom",
                               width=unit(0.2,"npc"))
             },
         ylab = "Counts",
         xlab = "Gear",
         main = "Gear counts plot (mtcars)")