我一直在使用該軟體包waffle,但無法解決如何修復此華夫餅圖以使其顯示 100 個正方形/單元格

這是資料和我的代碼:
# devtools::install_github("hrbrmstr/waffle")
library(ggplot)
library(waffle)
data <- structure(list(greenfield = c(0, 1), n = c(162L, 399L), total_investments = c(561,
561), percentage = c(28.8770053475936, 71.1229946524064), name_greenfield = c("M&A",
"Greenfield")), row.names = c(NA, -2L), groups = structure(list(
greenfield = c(0, 1), .rows = structure(list(1L, 2L), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), row.names = c(NA, -2L), class = c("tbl_df",
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"))
# Waffle plot
ggplot(data,
aes(fill = name_greenfield,
values = percentage))
coord_equal()
geom_waffle(size = 0.31,
flip = T,
make_proportional = T,
height = 0.9, width = 0.9,
color = "white")
coord_equal()
theme_ipsum_rc(grid="",
plot_title_face = "plain",
plot_title_size = 14,
plot_title_margin = 0)
theme_enhance_waffle()
labs(title = "Types of investments",
fill = "",
caption = "Source: Author's own elaboration")
scale_fill_grey(start = 0.4, end = 0.7)
我還沒有發現問題,如果有人能幫助我,我將不勝感激!
uj5u.com熱心網友回復:
代碼中有一個非常非常奇怪的錯誤。這是我懷疑正在發生的事情。在 GitHub 上的源代碼中,有一個檔案
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/398475.html
