RPubs will retire in June 2027. Your existing documents will stay accessible through December 31, 2031
and Connect Cloud is the recommended home for new publishing. Read the blog post

Recently Published

Plot
# ==================================================== # Figure 1: Technological Evolution Curve (2016-2030) # ==================================================== # 1. 检查并安装必要的包 required_packages <- c("ggplot2", "dplyr", "tidyr", "scales") for(pkg in required_packages) { if(!require(pkg, character.only = TRUE)) { install.packages(pkg) library(pkg, character.only = TRUE) } } # 2. 创建数据框 df <- data.frame( Year = 2016:2030, EI_Score = c(0.32, 0.36, 0.41, 0.45, 0.52, 0.58, 0.65, 0.71, 0.82, 0.94, 0.97, 0.99, 1.01, 1.02, 1.03), Accuracy = c(75, 77, 80, 82, 86, 88, 90, 92, 94, 95, 96, 97, 98, 98.5, 98.5), Type = c(rep("Actual", 10), rep("Predicted", 5)) ) # 3. 创建区域数据框用于背景色 regions <- data.frame( xmin = c(2016, 2018.5, 2020.5, 2022.5, 2024.5), xmax = c(2018.5, 2020.5, 2022.5, 2024.5, 2030.5), Era = c("Early CNNs", "Hybrid Models", "Transformer Era", "Personalization Era", "Clinical Translation Era") ) # 4. 创建标注数据框 annotations <- data.frame( Year = c(2020, 2021, 2023), EI = c(0.58, 0.65, 0.71), EI_label = c(0.65, 0.72, 0.78), Label = c("ViT (2020)", "MAE (2021)", "DINOv2 (2023)") ) # 5. 分割数据为实际值和预测值 df_actual <- df[1:10, ] df_pred <- df[10:15, ] # 6. 使用ggplot2创建图形 p <- ggplot() + # 添加背景区域 geom_rect(data = regions, aes(xmin = xmin, xmax = xmax, ymin = -Inf, ymax = Inf, fill = Era), alpha = 0.2, inherit.aes = FALSE) + # 添加EI曲线 - 实际值 geom_line(data = df_actual, aes(x = Year, y = EI_Score, color = "EI Score"), linetype = "solid", size = 1) + geom_point(data = df_actual, aes(x = Year, y = EI_Score, color = "EI Score"), shape = 16, size = 3) + # 添加EI曲线 - 预测值 geom_line(data = df_pred, aes(x = Year, y = EI_Score, color = "EI Score"), linetype = "dashed", size = 1) + geom_point(data = df_pred, aes(x = Year, y = EI_Score, color = "EI Score"), shape = 1, size = 3) + # 添加Accuracy曲线 - 实际值 geom_line(data = df_actual, aes(x = Year, y = Accuracy/83.33, color = "Accuracy"), linetype = "solid", size = 1) + geom_point(data = df_actual, aes(x = Year, y = Accuracy/83.33, color = "Accuracy"), shape = 15, size = 3) + # 添加Accuracy曲线 - 预测值 geom_line(data = df_pred, aes(x = Year, y = Accuracy/83.33, color = "Accuracy"), linetype = "dashed", size = 1) + geom_point(data = df_pred, aes(x = Year, y = Accuracy/83.33, color = "Accuracy"), shape = 0, size = 3) + # 添加垂直线 geom_vline(xintercept = 2025, linetype = "dashed", color = "black", alpha = 0.5) + # 添加标注 geom_segment(data = annotations, aes(x = Year, xend = Year, y = EI, yend = EI_label), arrow = arrow(length = unit(0.2, "cm")), color = "black") + geom_text(data = annotations, aes(x = Year, y = EI_label + 0.02, label = Label), size = 3, hjust = 0.5) + # 添加区域文本标签 geom_text(data = data.frame(x = c(2017.25, 2019.5, 2021.5, 2023.5, 2027.5), y = rep(1.15, 5), label = c("Early CNNs", "Hybrid Models", "Transformer Era", "Personalization", "Clinical Translation")), aes(x = x, y = y, label = label), size = 3.5, fontface = "italic") + # 设置坐标轴 scale_x_continuous(breaks = seq(2016, 2030, 2), limits = c(2016, 2030)) + scale_y_continuous( name = "Evolution Index (EI)", sec.axis = sec_axis(~.*83.33, name = "Accuracy (%)", breaks = seq(70, 100, 5)), limits = c(0, 1.2), breaks = seq(0, 1.2, 0.2) ) + # 设置颜色 scale_color_manual( name = "", values = c("EI Score" = "#2563EB", "Accuracy" = "#DC2626"), labels = c("EI Score (Actual)", "Accuracy (Actual)") ) + # 设置填充色 scale_fill_manual( name = "Technological Eras", values = c("Early CNNs" = "gray80", "Hybrid Models" = "lightblue", "Transformer Era" = "lightgreen", "Personalization Era" = "lightyellow", "Clinical Translation Era" = "orange") ) + # 添加主题设置 theme_minimal() + theme( plot.title = element_text(size = 14, face = "bold", hjust = 0.5, margin = margin(b = 20)), axis.title.x = element_text(size = 12, face = "bold"), axis.title.y.left = element_text(color = "#2563EB", size = 12, face = "bold"), axis.title.y.right = element_text(color = "#DC2626", size = 12, face = "bold"), axis.text.y.left = element_text(color = "#2563EB"), axis.text.y.right = element_text(color = "#DC2626"), legend.position = "bottom", legend.box = "vertical", legend.margin = margin(t = 10), panel.grid.minor = element_blank(), panel.grid.major = element_line(color = "gray90"), plot.margin = margin(1, 1, 1, 1, "cm") ) + # 添加标题 labs( title = "Figure 1: Technological Evolution of Pain Expression Recognition (2016-2030)", x = "Year", caption = "Predicted values (2025-2030) shown with dashed lines. Actual data (2016-2025) shown with solid lines. Predictions generated from exponential growth model (α=0.25, β=0.15, γ=0.12, δ=0.08, ω=2.1)." ) + # 添加图例说明 annotate("text", x = 2027, y = 0.2, label = "Solid: Actual\nDashed: Predicted", size = 3, hjust = 0, fontface = "italic") # 7. 显示图形 print(p) # 8. 保存为高分辨率PNG ggsave("figure1_evolution_curve.png", plot = p, width = 12, height = 6, dpi = 600, bg = "white") # 9. 保存为SVG矢量格式(用于出版物) ggsave("figure1_evolution_curve.svg", plot = p, width = 12, height = 6, bg = "white")
Prompt_universal_de_evaluación_Hoja_Manuscrita
Prompt_universal_de_evaluación_Hoja_Manuscrita
hkc
BS2077 Tutorial 5
Analysis and interpretation of the data from the "Barnacle Goose vigilance" practical.
HTML
TIME SERIES - DATA BIKE
Visualisasi data timeseries yaitu lineplot dan smoothing plot
Guía_para_la_Evaluación_de_la_Hoja_Manuscrita
Guía_para_la_Evaluación_de_la_Hoja_Manuscrita