我正在尝试绘制交互式树形图,以根据不同的日期输入来描述库存的移动情况
原始数据:
sraw <- structure(list(Date = c("2018-02-28", "2018-02-28", "2018-02-28",
"2018-02-28", "2018-02-28", "2018-02-28"), Category = c("Bakery ",
"Household ", "Household ", "Personal care", "Personal care",
"Breakfast "), Sub_Category = c("Wafers ", "laundry ", "Pet Care",
"Womens grooming ", "Womens grooming ", "Instant food"), Product
= c("strawbery",
"washing powder ", "Cat food ", "sanitary pad ", "sanitary pad ",
"Noodles "), Brand = c("NO BRAND", "wheel ", "Whiskars", "whisper",
"whisper", "Yipee"), Day = c(28L, 28L, 28L, 28L, 28L, 28L), Month = c(2L,
2L, 2L, 2L, 2L, 2L), Year = c(2018L, 2018L, 2018L, 2018L, 2018L,
2018L), MRP = c("5", "48", "160", "34", "40", "45"), Quantity = c(2,
1, 1, 1, 1, 1), Sales = c(10, 48, 160, 34, 40, 45), Wday = c("Wednesday",
"Wednesday", "Wednesday", "Wednesday", "Wednesday", "Wednesday"
), Week = c(9L, 9L, 9L, 9L, 9L, 9L), X = c(NA, NA, NA, NA, NA,
NA), X. = c(NA, NA, NA, NA, NA, NA)), .Names = c("Date", "Category",
"Sub_Category", "Product", "Brand", "Day", "Month", "Year", "MRP",
"Quantity", "Sales", "Wday", "Week", "X", "X."), row.names = 870158:870163,
class = "data.frame")
我一直在干预树形图,但是对此没有任何积极的看法:
treeMapCoordinates <- treemapify(sraw,
area = sraw$Quantity,
fill = sraw$Category,
label = sraw$Sub_Category,
group = sraw$Category)
treeMapPlot <- ggplotify(treeMapCoordinates) +
scale_x_continuous(expand = c(0, 0)) +
scale_y_continuous(expand = c(0, 0)) +
scale_fill_brewer(palette = "Dark2")
print(treeMapPlot)
但是显示错误。 :
treemapify中的错误(sraw,area = sraw $ Quantity,fill = sraw $ Category,: 未使用的参数(填充= sraw $ Category,标签= sraw $ Sub_Category,组= sraw $ Category)
有人可以帮我吗?
谢谢