这是什么类型的图表?它可以使用ggplot2创建吗? [英] What type of graph is this? And can it be created using ggplot2?

查看:23
本文介绍了这是什么类型的图表?它可以使用ggplot2创建吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张我正在尝试复制的图表.对于 X & 它有两个连续变量.Y 轴,并用一条线将这两个变量随时间变化的关系绘制成图表.

I have this chart that I'm attempting to replicate. It has two continuous variables for the X & Y axes, and charts the relationship between these two variables through time with a line.

我的问题有两个部分:

  • 首先,这种图表叫什么?这是不寻常的,因为点之间的线是由第三个变量(年份)决定的,而不是它们在 X 轴上的位置.

  • First, what is this type of chart called? It is unusual because the line between the points is determined by a third variable (the year) rather than their positions on the X axis.

第二,有谁知道ggplot能不能实现?到目前为止,我已经创建了一个类似于上面的图表,但没有连接点的线.这段代码ggplot(data, aes(x = Weekly_Hours_Per_Person, y = GDP_Per_Hour)) + geom_point() 得到以下输出:但是如何获得多年来的路线?

Second, does anyone know whether this can be achieved with ggplot? I have so far created a chart similar to the above but without the line connecting the points. This code ggplot(data, aes(x = Weekly_Hours_Per_Person, y = GDP_Per_Hour)) + geom_point() has gotten the below output: But how to get the line over years?

对任何一点的任何帮助都将不胜感激.谢谢!

Any help on either point will be appreciated. Thanks!

推荐答案

使用geom_path,即

libraray(ggplot2)
ggplot(data, aes(x = Weekly_Hours_Per_Person, y = GDP_Per_Hour)) +
geom_point() + 
geom_path()

这篇关于这是什么类型的图表?它可以使用ggplot2创建吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆