求助下各位这到底是什么原因
我在画折线图的时候ggplot报错
作图时候的代码:
ggplot(huitu,aes(year,v1,colour = v2))+geom_line()
Don't know how to automatically pick scale for object of type data.frame. Defaulting to continuous.
Error: Tibble columns must have compatible sizes.
* Size 6: Column `colour`.
* Size 12: Columns `x`, `y`, and `PANEL`.
i Only values of size one are recycled.
Run `rlang::last_error()` to see where the error occurred.
但是同样的代码用一个示例的就不会报错
ggplot(df, aes(year,value, colour = type)) + geom_line()
不知道到底那里有问题也检查了数据结构,和示例的一模一样都不可以
示例的数据结构:
'data.frame': 52 obs. of 3 variables:
$ year : int 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 ...
$ type : chr "A" "A" "A" "A" ...
$ value: num 0.114 0.622 0.609 0.623 0.861 ...
我自己的数据结构
'data.frame': 12 obs. of 3 variables:
$ v1 : num 1.40e+08 1.58e+08 1.74e+08 1.91e+08 2.10e+08 ...
$ V2 : chr "A" "A" "A" "A" ...
$ year: int 2013 2014 2015 2016 2017 2018 2013 2014 2015 2016 ...
这明明也没差什么但是我自己的数据就会报错求助各位大佬,再次谢过。