I'm new to r and I want to recreate this scatterplot: enter image description here But I don't know how to get there. This is the code I have at this moment:

ggplot(萨特夫, aes(x=`Satisfaction Coefficient`, y=`Dissatisfaction Coefficient`)) + geom_point() + expand_limits(x=c(0.00, 1.00), y=c(0.00, -1.00))

which results in the following: enter image description here

萨特夫

enter image description here

数据帧的CSV版本:

"","Attribute","Satisfaction Coefficient","Dissatisfaction Coefficient"
"1","Create an enjoyable interaction","0.47","-0.43"
"2","Create an enjoyable interaction","0.38","-0.24"
"3","Create an enjoyable interaction","0.29","-0.17"
"4","Create an enjoyable interaction","0.49","-0.49"
"5","Create an enjoyable interaction","0.48","-0.36"
"6","Create an enjoyable interaction","0.36","-0.26"
"7","Create an enjoyable interaction","0.37","-0.4"
"8","Create an enjoyable interaction","0.32","-0.29"
"9","Create an enjoyable interaction","0.25","-0.16"
"10","Create an enjoyable interaction","0.61","-0.57"
"11","Create an enjoyable interaction","0.49","-0.49"
"12","Create an enjoyable interaction","0.08","-0.18"

structure(list(Attribute = c("Create an enjoyable interaction", 
"Create an enjoyable interaction", "Create an enjoyable interaction", 
"Create an enjoyable interaction", "Create an enjoyable interaction", 
"Create an enjoyable interaction"), `Satisfaction Coefficient` = c("0.47", 
"0.38", "0.29", "0.49", "0.48", "0.36"), `Dissatisfaction Coefficient` = c("-0.43", 
"-0.24", "-0.17", "-0.49", "-0.36", "-0.26")), row.names = c(NA, 
6L), class = "data.frame")
if(!require('ggplot2')) {
  install.packages('ggplot2')
  library('ggplot2')
}
萨特夫 <- read.csv("")
ggplot(萨特夫, aes(x=`Satisfaction Coefficient`, y=`Dissatisfaction Coefficient`)) + geom_point(col="blue") + expand_limits(x=c(0.00, 1.00), y=c(0.00, -1.00)) + geom_text(label=rownames(萨特夫), nudge_x = -0.25, nudge_y = -0.25)

推荐答案

你在找这样的东西吗?

satDf$`Satisfaction Coefficient` <- as.numeric(satDf$`Satisfaction Coefficient`)
satDf$`Dissatisfaction Coefficient` <- as.numeric(satDf$`Dissatisfaction Coefficient`)

ggplot(satDf, aes(x=`Satisfaction Coefficient`, 
                  y=-`Dissatisfaction Coefficient`)) + 
  geom_label(x = 0.0, y = 0.55, label = 'Must - be', hjust = 0) +
  geom_label(x = 0.0, y = 0.45, label = 'Indifferent', hjust = 0) +
  geom_label(x = 1, y = 0.55, label = 'Performance', hjust = 1) +
  geom_label(x = 1, y = 0.45, label = 'Attractive', hjust = 1) +
  geom_point(col = 'deepskyblue3', size = 3) + 
  geom_text(aes(label = seq(nrow(satDf))), size = 3, nudge_x = -0.015,
            nudge_y = -0.02, check_overlap = TRUE) +
  geom_text(aes(label = 11), size = 3, nudge_x = -0.015,
                nudge_y = 0.02, data = satDf[11,]) +
  theme_light() +
  theme(panel.grid = element_blank()) +
  geom_hline(yintercept = 0.5) +
  geom_vline(xintercept = 0.5) +
  scale_y_continuous(labels = function(x) paste0('-', x),
                     limits = c(0, 1)) +
  xlim(c(0, 1))

enter image description here

R相关问答推荐

当y大于阈值和值范围时,在时间序列中突出显示区域

使用lapply的重新定位功能

使用gggrassure减少地块之间的空间

在发布到PowerBI Service时,是否可以使用R脚本作为PowerBI的数据源?

在特定Quarto(reveal.js)幻灯片上隐藏徽标

删除具有相同标题的tabPanel(shinly)

如何使用STAT_SUMMARY向ggplot2中的密度图添加垂直线

如何自定义3D散点图的图例顺序?

用关联字符串替换列名的元素

将. xlsx内容显示为HTML表

使用rvest从多个页面抓取时避免404错误

计算两列中满足特定条件连续行之间的平均值

更新R中的数据表(使用data.table)

如何从向量构造一系列双边公式

正则表达式在第二个管道和第二个T之后拆分R中的列

我们如何在R中透视数据并在之后添加计算

如何使用前缀作为匹配来连接数据帧?

在R中使用列表(作为tibble列)进行向量化?

如何在使用因子时获得Sankey图的Scale_Fill_Viridis的全范围

为什么将负值向量提升到分数次方会得到NaN