ggplot2是一个积极维护的R开源图表绘图包,由Hadley Wickham编写,基于“图形语法”的原则。它部分取代了R的基本图和格子包,同时提供了一个干净,强大,正交和有趣的API。
如何正确地将线路与ggplot2图中的点连接在一起? 我正在尝试使用r中的ggplot2创建一个散点图,其中每个点都由其组中的一条线连接。数据代表影响各种结果的不同条件,每个条件...
# Sample data set.seed(123) example_data <- data.frame( condition = rep(c("Condition A", "Condition B", "Condition C"), each = 3), outcome = rep(c("Outcome 1", "Outcome 2", "Outcome 3"), 3), estimate = runif(9, -2, 2), error = runif(9, 0.5, 1.5) ) example_data$lower <- example_data$estimate - example_data$error example_data$upper <- example_data$estimate + example_data$error # Attempt to plot library(ggplot2) ggplot(example_data, aes(x = estimate, y = outcome, group = interaction(condition, outcome), color = condition)) + geom_point(position = position_dodge(width = 0.5), size = 3) + geom_line(aes(group = condition), position = position_dodge(width = 0.5)) + geom_errorbar(aes(xmin = lower, xmax = upper), width = 0.1, position = position_dodge(width = 0.5)) + theme_minimal() + labs(title = "Effect of Different Conditions on Various Outcomes", x = "Coefficient Estimate", y = "Outcome") + scale_color_manual(values = hcl.colors(3, "Berlin"))
将值绘制到具有粗体字体的一定值的水平堆叠条图中。有一个美学可用。问题是:一旦我使用
...... 我有一个看起来像这样的数据框架: # A tibble: 6 × 8 N S DG P locus replicate MLE_s_BwS MLE_s_WF <int> <dbl> <int> <int> <int> <int> <dbl> <dbl> 1 100 0 1 1 0 0 -0.174 -0.183 2 100 0 1 1 1 0 0.143 0.143 3 100 0 1 1 2 0 -0.0758 -0.0758 4 100 0.1 10 1 3 0 -0.141 -0.141 5 100 0.1 10 1 4 0 0.102 0.102 6 100 0.1 10 1 5 0 0.102 0.102
我尝试了堆栈流的所有建议,涉及类似问题。我删除并重新安装了Rlang和GGPLOT2,甚至还重新安装了计算机上的整个R-Studio。 我仍然得到...
GGPLOT基于predivions(),get_datagrid()和get_predicated()函数
我有此数据:<- efc %> <- datawizard::to_factor(efc, c("c161sex", &...
我的代码: ggplot(datas,aes(x = property_name,y = val_int,fill = property_name)) + GEOM_BOXPLOT()+YLIM(0,4.5)+ stat_summary(fun.y =均值,color =“ darkred”,geom =“ poin ...
这是我的数据: A1<- c(1,2,9,6,4) A2 <- c(5,1,9,2,3) A3 <- c(1,2,3,4,5) B1 <- c(2,4,6,8,10) B2 <- c(0,3,6,9,12) B3 <- c(1,1,2,8,7) DF2 <- data.frame( x = c(c...