有没有一种方法可以在没有任何数据的情况下创建一个类似于下图的图形?

enter image description here

推荐答案

对于箭头,可以使用以下代码:geom_segment中的arrow = arrow(length = unit(0.5, "cm")).没有任何数字有点棘手,但也许你想要这样的东西:

library(ggplot2)
ggplot() + 
  geom_abline(slope = 1) +
  geom_curve(aes(x = 0, y = 0, xend = 1, yend = 1), curvature = -0.4) +
  geom_curve(aes(x = 0, y = 1, xend = 1, yend = 0.1), curvature = 0.4, linetype = "dashed") +
  geom_segment(aes(x=0.9,y=0.98,xend=0.9,yend=0.12), arrow = arrow(length = unit(0.5, "cm"))) +
  geom_segment(aes(x=0.02,y=0.85,xend=0.02,yend=0.23), arrow = arrow(length = unit(0.5, "cm"))) +
  annotate("text", x = 0.5, y = 0.5, label = "Line of Equality", angle = 45, vjust = 2) +
  annotate("text", x = 0.25, y = 0.75, label = "Income (etc.)", angle = 45, vjust = 2) +
  annotate("text", x = 1.2, y = 0.1, label = "Corresponding\nExposure", angle = 0) +
  labs(x = "Individuals Neighbourhoods\nAcross Space", y = "Scoioeconomic Position") +
  scale_x_continuous(limits = c(0, 1.3)) +
  theme_minimal() +
  theme(axis.text = element_blank())

输出:

enter image description here

R相关问答推荐

使用较长的查询提取具有部分匹配的列表中的较短目标,

传递ggplot2的变量作为函数参数—没有映射级别以正确填充美学

在R gggplot2中是否有一种方法将绘图轴转换成连续的 colored颜色 尺度?

plotly hover文本/工具提示在shiny 中不起作用

R spatstat Minkowski Sum()返回多个边界

当我们有多个反斜杠和/特殊字符时使用Gsubing

使用Scale_*_MANUAL时在图例中保留未使用的系数级别

基于Key->Value数据帧的基因子集相关性提取

从R中发出的咕噜声中的BUG?

当由base::限定时,`[.factor`引发NextMethod错误

如何准确地指出Read_delim所面临的问题?

为各个小节生成单独的选项卡

判断R中多个数据帧中的公共ID

R-有没有办法比较列字符串之间的单个项目?

在R中的Sankey图表中添加标题

如何使用str_Detect计算并返回列表中检测到的字符串?

将一个二次函数叠加到一个被封装为facet的ggplot2对象的顶部

从txt文件中删除前n行

计算R中各列之间的差异

在ggplot中创建一个折线图,根据百分比的变化,线条采用不同的 colored颜色