Я пытаюсь поместить объект ggplot в абсолютную панель. Я создал свой сюжет вместе с пользовательской темой. Я установил панель и цвет фона графика, а также цвет фона абсолютной панели, в которую входит мой график. Однако, когда график отображается на экране, он отображается белым с обеих сторон объекта графика. Как я могу это исправить?
# CSS
#qualitative-info-box {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 80%;
width: 80%;
z-index: 100;
border-radius: 15px;
border-style: solid;
border-color: white;
border-width: 2px;
background-color: #4B4B4C;
opacity: 0.97;
}
BACKGROUND_COLOR <- "#4B4B4C"
theme_new <- theme_bw() + theme(
text = element_text(family = "Montserrat", size = 15, color = "white"),
plot.caption = element_text(hjust = 0),
plot.title = element_text(size = 20, face = "bold", hjust = 0.5),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
axis.line = element_line(color = "white"),
strip.background = element_rect(fill = ALT_COLOR,
colour = SECONDARY_COLOR, linetype = 2),
strip.switch.pad.wrap = unit(1, "cm"),
strip.text = element_text(face = "bold", color = SECONDARY_COLOR, size = 13),
panel.background = element_rect(fill = BACKGROUND_COLOR,
color = NA),
plot.background = element_rect(fill = BACKGROUND_COLOR,
color = NA),
legend.background = element_rect(fill = BACKGROUND_COLOR,
color = "white"),
legend.position = "bottom"
)
ui <- fluidPage(
absolutePanel(
id = "qualitative-info-box", fixed = TRUE,
fluidRow(align = "right", style = "margin-right: 10px; margin-top: 10px;",
actionButton("close", label = "", icon = icon("times"),
class = "button")),
h2("This is a heading for a qualitative summary."),
p("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum."),
plotOutput("influence_plot"),
h2("This is a heading for a quantitative summary.")
)
)
server <- function(session, input, output) {
output$influence_plot <- renderPlot({
data <- data.frame(expand.grid(1:3, 1:3)) %>%
mutate(value = 1:9)
ggplot(data = data, mapping = aes(x = factor(Var1), y = factor(Var2),
fill = factor(value))) +
geom_tile(stat = "identity") +
scale_fill_brewer(palette = "OrRd") +
labs(x = "Probability", y = "Impact", "Future Influence Impact") +
coord_equal() +
geom_text(mapping = aes(x = 2, y = 1, label = "More Likely ->")) +
geom_text(mapping = aes(x = 1, y = 2, label = "<- More Impact"),
angle = 270, stat = "identity") +
theme_new
})
}