我已经做了一个冲积层,但是颜色太透明了。我试着在我的代码中使用alpha =
,但是没有任何效果。这是我正在使用的代码。我在我的代码中保留了alpha =
,我已经尝试过了,你可以看到,但是我已经尝试过了,只有一个,两个,一个或另一个等等。
library(dplyr)
library(ggplot2)
library("ggalluvial")
library("viridis")
plot = ggplot(df,
aes(y = Total_Publications, axis1 = Method_Group, axis2 = Topic)) +
geom_alluvium(aes(fill = Topic, alpha = 1), width = 1/5) +
scale_fill_viridis(discrete=TRUE, alpha = 1) +
geom_stratum(width = 1/5, alpha = 0, reverse = TRUE, color = "black") +
geom_text(stat = "stratum", aes(label = after_stat(stratum)), size= 4.5) +
scale_x_discrete(limits = c("Ecological Topic", "Ecological Theme"), expand = c(.05, .05)) +
theme_minimal() +
theme(axis.title.y = element_blank(), axis.text.y= element_blank(), legend.position = "none",
plot.title = element_text(hjust=0.5, size=18), axis.text.x = element_blank())
以下是我的数据示例
df = structure(list(Theme = c("Adult migration", "Adult migration",
"Adult migration", "Adult migration", "Adult migration", "Aquaculture",
"Aquaculture", "Artificial Reefs", "Attributing behaviours to movement",
"Attributing behaviours to movement", "Attributing behaviours to movement",
"Attributing behaviours to movement", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Co_existence", "Co_existence",
"Co_existence", "Co_existence", "Commercial species", "Commercial species",
"Commercial species", "Commercial species", "Community structuring",
"Community structuring", "Cooperative Behaviour", "Demographics"
), Tracking_Group = c(Animalborne_Satellite_Archival = "NoReceiver",
Stationary_Radio = "NoReceiver", Stationary_Acoustic = "Receiver",
Stationary_Acoustic = "Receiver", Stationary_Acoustic_Radio_PIT = "Receiver",
Stationary_Acoustic = "Receiver", Stationary_Acoustic = "Receiver",
Controlled_Acoustic = "Receiver", Animalborne_Archival = "NoReceiver",
Animalborne_Archival = "NoReceiver", Animalborne_Archival = "NoReceiver",
Stationary_Radio_PIT = "Receiver", BRUV_Acoustic_Satellite = "Both",
Animalborne_Archival = "NoReceiver", Animalborne_Archival = "NoReceiver",
Animalborne_Archival = "NoReceiver", Animalborne_Archival = "NoReceiver",
Animalborne_Archival = "NoReceiver", Animalborne_Archival = "NoReceiver",
Animalborne_Archival = "NoReceiver", Animalborne_Archival = "NoReceiver",
Animalborne_Archival = "NoReceiver", Animalborne_Archival = "NoReceiver",
Animalborne_Satellite_Archival = "NoReceiver", Controlled_Archival = "NoReceiver",
Stationary_Archival = "NoReceiver", Stationary_Archival = "NoReceiver",
Stationary_Satellite = "NoReceiver", Animalborne_Acoustic = "Receiver",
Animalborne_Acoustic_Archival = "Receiver", BRUV_Acoustic = "Receiver",
BRUV_Acoustic = "Receiver", Controlled_Acoustic = "Receiver",
Controlled_Acoustic = "Receiver", Stationary_Acoustic = "Receiver",
Stationary_Acoustic = "Receiver", Stationary_Acoustic = "Receiver",
Stationary_Acoustic = "Receiver", Animalborne_Archival = "NoReceiver",
Animalborne_Archival = "NoReceiver", Stationary_Acoustic = "Receiver",
Stationary_Acoustic = "Receiver", Stationary_Archival = "NoReceiver",
BRUV_Acoustic = "Receiver", Stationary_Acoustic = "Receiver",
Stationary_Acoustic_Archival = "Receiver", BRUV_Acoustic = "Receiver",
BRUV_Acoustic = "Receiver", Animalborne_Archival = "NoReceiver",
BRUV_Acoustic_Satellite = "Both"), Combination = c("Animalborne_Satellite_Archival",
"Stationary_Radio", "Stationary_Acoustic", "Stationary_Acoustic",
"Stationary_Acoustic_Radio_PIT", "Stationary_Acoustic", "Stationary_Acoustic",
"Controlled_Acoustic", "Animalborne_Archival", "Animalborne_Archival",
"Animalborne_Archival", "Stationary_Radio_PIT", "BRUV_Acoustic_Satellite",
"Animalborne_Archival", "Animalborne_Archival", "Animalborne_Archival",
"Animalborne_Archival", "Animalborne_Archival", "Animalborne_Archival",
"Animalborne_Archival", "Animalborne_Archival", "Animalborne_Archival",
"Animalborne_Archival", "Animalborne_Satellite_Archival", "Controlled_Archival",
"Stationary_Archival", "Stationary_Archival", "Stationary_Satellite",
"Animalborne_Acoustic", "Animalborne_Acoustic_Archival", "BRUV_Acoustic",
"BRUV_Acoustic", "Controlled_Acoustic", "Controlled_Acoustic",
"Stationary_Acoustic", "Stationary_Acoustic", "Stationary_Acoustic",
"Stationary_Acoustic", "Animalborne_Archival", "Animalborne_Archival",
"Stationary_Acoustic", "Stationary_Acoustic", "Stationary_Archival",
"BRUV_Acoustic", "Stationary_Acoustic", "Stationary_Acoustic_Archival",
"BRUV_Acoustic", "BRUV_Acoustic", "Animalborne_Archival", "BRUV_Acoustic_Satellite"
), Total_Publications = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), Topic = c("Reproductive Ecology",
"Reproductive Ecology", "Reproductive Ecology", "Reproductive Ecology",
"Reproductive Ecology", "Fisheries Managemenet", "Landuse Management",
"Conservation Methods", "Methodological", "Methodological", "Methodological",
"Methodological", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Fisheries Managemenet", "Fisheries Managemenet",
"Fisheries Managemenet", "Fisheries Managemenet", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Other Drivers of Movement and Habitat Use"
), Method_Group = c("Animalborne_NoReceiver", "Stationary_NoReceiver",
"Stationary_Receiver", "Stationary_Receiver", "Stationary_Receiver",
"Stationary_Receiver", "Stationary_Receiver", "Controlled_Receiver",
"Animalborne_NoReceiver", "Animalborne_NoReceiver", "Animalborne_NoReceiver",
"Stationary_Receiver", "BRUV_Both", "Animalborne_NoReceiver",
"Animalborne_NoReceiver", "Animalborne_NoReceiver", "Animalborne_NoReceiver",
"Animalborne_NoReceiver", "Animalborne_NoReceiver", "Animalborne_NoReceiver",
"Animalborne_NoReceiver", "Animalborne_NoReceiver", "Animalborne_NoReceiver",
"Animalborne_NoReceiver", "Controlled_NoReceiver", "Stationary_NoReceiver",
"Stationary_NoReceiver", "Stationary_NoReceiver", "Animalborne_Receiver",
"Animalborne_Receiver", "BRUV_Receiver", "BRUV_Receiver", "Controlled_Receiver",
"Controlled_Receiver", "Stationary_Receiver", "Stationary_Receiver",
"Stationary_Receiver", "Stationary_Receiver", "Animalborne_NoReceiver",
"Animalborne_NoReceiver", "Stationary_Receiver", "Stationary_Receiver",
"Stationary_NoReceiver", "BRUV_Receiver", "Stationary_Receiver",
"Stationary_Receiver", "BRUV_Receiver", "BRUV_Receiver", "Animalborne_NoReceiver",
"BRUV_Both")), class = c("grouped_df", "tbl_df", "tbl", "data.frame"
), row.names = c(NA, -50L), groups = structure(list(Theme = c("Adult migration",
"Adult migration", "Adult migration", "Adult migration", "Aquaculture",
"Aquaculture", "Artificial Reefs", "Attributing behaviours to movement",
"Attributing behaviours to movement", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Behavioural states and adaptations", "Behavioural states and adaptations",
"Co_existence", "Co_existence", "Commercial species", "Commercial species",
"Commercial species", "Commercial species", "Community structuring",
"Cooperative Behaviour", "Demographics"), Topic = c("Reproductive Ecology",
"Reproductive Ecology", "Reproductive Ecology", "Reproductive Ecology",
"Fisheries Managemenet", "Landuse Management", "Conservation Methods",
"Methodological", "Methodological", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Behavioural Ecology",
"Behavioural Ecology", "Behavioural Ecology", "Fisheries Managemenet",
"Fisheries Managemenet", "Fisheries Managemenet", "Fisheries Managemenet",
"Behavioural Ecology", "Behavioural Ecology", "Other Drivers of Movement and Habitat Use"
), Tracking_Group = c(Animalborne_Satellite_Archival = "NoReceiver",
Stationary_Radio = "NoReceiver", Stationary_Acoustic = "Receiver",
Stationary_Acoustic_Radio_PIT = "Receiver", Stationary_Acoustic = "Receiver",
Stationary_Acoustic = "Receiver", Controlled_Acoustic = "Receiver",
Animalborne_Archival = "NoReceiver", Stationary_Radio_PIT = "Receiver",
BRUV_Acoustic_Satellite = "Both", Animalborne_Archival = "NoReceiver",
Animalborne_Satellite_Archival = "NoReceiver", Controlled_Archival = "NoReceiver",
Stationary_Archival = "NoReceiver", Stationary_Satellite = "NoReceiver",
Animalborne_Acoustic = "Receiver", Animalborne_Acoustic_Archival = "Receiver",
BRUV_Acoustic = "Receiver", Controlled_Acoustic = "Receiver",
Stationary_Acoustic = "Receiver", Animalborne_Archival = "NoReceiver",
Stationary_Acoustic = "Receiver", Stationary_Archival = "NoReceiver",
BRUV_Acoustic = "Receiver", Stationary_Acoustic = "Receiver",
Stationary_Acoustic_Archival = "Receiver", BRUV_Acoustic = "Receiver",
Animalborne_Archival = "NoReceiver", BRUV_Acoustic_Satellite = "Both"
), Combination = c("Animalborne_Satellite_Archival", "Stationary_Radio",
"Stationary_Acoustic", "Stationary_Acoustic_Radio_PIT", "Stationary_Acoustic",
"Stationary_Acoustic", "Controlled_Acoustic", "Animalborne_Archival",
"Stationary_Radio_PIT", "BRUV_Acoustic_Satellite", "Animalborne_Archival",
"Animalborne_Satellite_Archival", "Controlled_Archival", "Stationary_Archival",
"Stationary_Satellite", "Animalborne_Acoustic", "Animalborne_Acoustic_Archival",
"BRUV_Acoustic", "Controlled_Acoustic", "Stationary_Acoustic",
"Animalborne_Archival", "Stationary_Acoustic", "Stationary_Archival",
"BRUV_Acoustic", "Stationary_Acoustic", "Stationary_Acoustic_Archival",
"BRUV_Acoustic", "Animalborne_Archival", "BRUV_Acoustic_Satellite"
), Method_Group = c("Animalborne_NoReceiver", "Stationary_NoReceiver",
"Stationary_Receiver", "Stationary_Receiver", "Stationary_Receiver",
"Stationary_Receiver", "Controlled_Receiver", "Animalborne_NoReceiver",
"Stationary_Receiver", "BRUV_Both", "Animalborne_NoReceiver",
"Animalborne_NoReceiver", "Controlled_NoReceiver", "Stationary_NoReceiver",
"Stationary_NoReceiver", "Animalborne_Receiver", "Animalborne_Receiver",
"BRUV_Receiver", "Controlled_Receiver", "Stationary_Receiver",
"Animalborne_NoReceiver", "Stationary_Receiver", "Stationary_NoReceiver",
"BRUV_Receiver", "Stationary_Receiver", "Stationary_Receiver",
"BRUV_Receiver", "Animalborne_NoReceiver", "BRUV_Both"), .rows = structure(list(
1L, 2L, 3:4, 5L, 6L, 7L, 8L, 9:11, 12L, 13L, 14:23, 24L,
25L, 26:27, 28L, 29L, 30L, 31:32, 33:34, 35:38, 39:40, 41:42,
43L, 44L, 45L, 46L, 47:48, 49L, 50L), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -29L), .drop = TRUE))
有什么办法让它不那么透明吗?
2条答案
按热度按时间twh00eeo1#
你在找这个吗?
gopyfrb32#
如果您想强调任何特定类别,您也可以使用
scale_alpha_manual
手动添加alpha值。