在使用geom_rect创建gggraph图表时,我遇到以下错误:
Error in `geom_rect()`:
! Problem while computing aesthetics.
ℹ Error occurred in the 1st layer.
Caused by error in `FUN()`:
! object 'Weekly_Sales' not found
我的代码是:
ggplot(data = df1, aes(x = Date, y = Weekly_Sales)) +
geom_rect(data = df2, color = 'white',aes(xmin = as.Date(xmin),
ymin = ymin, xmax = as.Date(xmax), ymax = ymax, fill = changes),alpha = .4) +
geom_line(color = 'orange', size = 1.25) +
scale_fill_manual(values = c('blue', 'green'))
Weekly_Sales
列位于df1
数据集中.