Spaces:
Runtime error
Runtime error
Update app.R
Browse files
app.R
CHANGED
|
@@ -540,21 +540,35 @@ server <- function(input, output,session) {
|
|
| 540 |
fontfamily = "roboto"))
|
| 541 |
|
| 542 |
# Final arrangement with logo in title
|
| 543 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 544 |
title_with_logo,
|
| 545 |
labels_plot,
|
| 546 |
main_plot,
|
| 547 |
caption_grob,
|
| 548 |
-
heights =
|
| 549 |
)
|
| 550 |
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
)
|
| 556 |
)
|
| 557 |
-
|
|
|
|
|
|
|
|
|
|
| 558 |
}
|
| 559 |
|
| 560 |
# Run the app
|
|
|
|
| 540 |
fontfamily = "roboto"))
|
| 541 |
|
| 542 |
# Final arrangement with logo in title
|
| 543 |
+
# Set fixed dimensions for the plot
|
| 544 |
+
plot_width <- 750
|
| 545 |
+
plot_height <- 750
|
| 546 |
+
|
| 547 |
+
# Create a viewport with fixed dimensions
|
| 548 |
+
grid.newpage()
|
| 549 |
+
pushViewport(viewport(width = unit(1, "npc"), height = unit(1, "npc")))
|
| 550 |
+
|
| 551 |
+
# Adjust the layout heights to be proportional
|
| 552 |
+
layout_heights <- c(0.15, 0.05, 0.75, 0.05)
|
| 553 |
+
|
| 554 |
+
# Create the final plot with fixed dimensions
|
| 555 |
+
final_plot <- arrangeGrob(
|
| 556 |
title_with_logo,
|
| 557 |
labels_plot,
|
| 558 |
main_plot,
|
| 559 |
caption_grob,
|
| 560 |
+
heights = layout_heights
|
| 561 |
)
|
| 562 |
|
| 563 |
+
# Add padding with fixed units
|
| 564 |
+
padded_plot <- gtable_add_padding(
|
| 565 |
+
final_plot,
|
| 566 |
+
padding = unit(c(20, 20, 20, 20), "points")
|
|
|
|
| 567 |
)
|
| 568 |
+
|
| 569 |
+
# Draw the plot in the viewport
|
| 570 |
+
grid.draw(padded_plot)
|
| 571 |
+
}, height = 750, width = 750, res = 96)
|
| 572 |
}
|
| 573 |
|
| 574 |
# Run the app
|