I have a graphic in RStudio that takes too long to compile up to the point after several minutes, it doesn´t produce any plot. Actually, the plot does not appear and I have to force R to stop the compilation, giving the following message (and after that RStudio doesn´t work any more):
Avisos:
1: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
2: Removed 11 rows containing missing values or values outside the scale range
(`geom_text()`).
However, when I run the code in RGui, it works completely fine and produce the plot in a few seconds. The reproducible minimal example is found below:
library(ggplot2)
library(ggpubr)
library(tidyverse)
library(ggpattern)
library(ggrepel)
library(ggpmisc)
ATPSTime_pry_summary <-
structure(list(atps = structure(c(3L, 7L, 5L, 3L, 7L, 5L, 3L,
7L, 5L, 4L, 8L, 6L, 4L, 8L, 6L, 4L, 8L, 6L, 1L, 1L, 1L, 2L, 2L
), levels = c("1a", "1b", "2a", "2b", "3a", "3b", "4a", "4b"), class = "factor"),
time = structure(c(3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 3L,
3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 2L, 3L), levels = c("10",
"30", "120"), class = "factor"), pry_mean = c(16, 10, 4,
11, 6, 1, 15, 8, 3, 5, 12, 17, 13, 7, 23, 2, 21, 19, 22,
9, 20, 14, 18), sd = c(16, 10, 4, 11, 6, 1, 15, 8, 3, 5,
12, 17, 13, 7, 23, 2, 21, 19, 22, 9, 20, 14, 18), Tukey = c("a",
"ab", "ab", "abc", "abc", "bc", "bc", "bc", "c", "a", "ab",
"ab", "abc", "bc", "bc", "c", "c", "c", "a", "ab", "b", "b",
"ab"), time_combined = structure(c(3L, 3L, 3L, 2L, 2L, 2L,
1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 3L, 2L, 1L,
2L, 3L), levels = c("10", "30", "120"), class = "factor")), row.names = c(NA,
-23L), class = c("tbl_df", "tbl", "data.frame"))
ggplot(ATPSTime_pry_summary, aes(
x = atps,
y = pry_mean,
fill = time,
pattern = time,
pattern_angle = time,
group = time
)) +
geom_col_pattern(
position = position_dodge(0.8),
color = "black",
width = 0.7,
pattern_density = 0.15,
pattern_spacing = 0.02,
pattern_key_scale_factor = 0.2,
pattern_fill = "black",
pattern_colour = NA,
pattern_size = 0.4, # grosor del patrón
show.legend = TRUE
) +
geom_errorbar(
aes(ymin = pry_mean - sd, ymax = pry_mean + sd),
position = position_dodge(0.8),
width = 0.2,
size = 0.8,
alpha = 0.7,
show.legend = FALSE
) +
geom_text(
aes(label = Tukey, y = pry_mean + sd),
vjust = -0.5,
size = 7.5,
color = "gray25",
position = position_dodge(0.8),
show.legend = FALSE
) +
scale_fill_manual(
values = c("10" = "#d4c7ea", "30" = "#9a7dce", "120" = "#4e3182"),
name = "Time / min"
) +
scale_pattern_manual(
values = c("10" = "none", "30" = "circle", "120" = "stripe")
) +
scale_pattern_angle_manual(
values = c("10" = 0, "30" = 0, "120" = 45)
) +
guides(
fill = guide_legend(
override.aes = list(
pattern = c("none", "circle", "stripe"),
pattern_angle = c(0, 0, 45),
pattern_fill = "black",
pattern_density = 0.15,
pattern_spacing = 0.07,
pattern_size = 0.8
)
),
pattern = "none",
pattern_angle = "none"
) +
labs(
x = "ATPS",
y = expression(bold("Recovery Yield / %")),
subtitle="(a)"
) +
theme_bw(base_size = 20) +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text = element_text(size = 28),
axis.title.x = element_text(size = 30, face = "bold"),
axis.title.y = element_text(size = 30, face = "bold"),
legend.title = element_text(size = 25, face = "bold"),
legend.text = element_text(size = 23),
legend.position="none", #legend.position = c(0.98, 0.98),
legend.justification = c("right", "top"),
legend.direction = "vertical",
legend.background = element_rect(fill = "white", color = "white"),
plot.subtitle = element_text(size = 25, face = "bold")
) +
scale_y_continuous(expand = c(0, 0), limits = c(0, 25))
System Information:
- RStudio Edition: (Desktop or Server)
- RStudio Version: RStudio 2025.05.1+513 "Mariposa Orchid" Release (ab7c1bc795c7dcff8f26215b832a3649a19fc16c, 2025-06-01) for windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2025.05.1+513 Chrome/132.0.6834.210 Electron/34.5.1 Safari/537.36, Quarto 1.6.42 - OS Version:
- R Version: 4.5.1 (2025-06-13 ucrt)
sessionInfo()
: <!-- R version 4.5.1 (2025-06-13 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)
Matrix products: default
LAPACK version 3.12.1
locale:
[1] LC_COLLATE=Spanish_Spain.utf8 LC_CTYPE=Spanish_Spain.utf8
[3] LC_MONETARY=Spanish_Spain.utf8 LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.utf8
time zone: Europe/Madrid
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] RColorBrewer_1.1-3 R6_2.6.1 tidyselect_1.2.1 farver_2.1.2
[5] magrittr_2.0.3 gtable_0.3.6 glue_1.8.0 tibble_3.3.0
[9] pkgconfig_2.0.3 generics_0.1.4 dplyr_1.1.4 lifecycle_1.0.4
[13] ggplot2_3.5.2 cli_3.6.5 scales_1.4.0 grid_4.5.1
[17] vctrs_0.6.5 compiler_4.5.1 rstudioapi_0.17.1 tools_4.5.1
[21] cowplot_1.2.0 pillar_1.11.0 rlang_1.1.6 /-->
The memory usage is high, but I´ve tried to clear all the objects from the workspace, but every time I restart RStudio they appear again.
Referred here from support.rstudio.com