我正在寻找带有旋转 X 轴的散点图。基本上,我想绘制 2 个 Y 轴之间的相关性。理想情况下,我希望 x 轴代表时间,Y 轴代表相关性
data <- data.frame( words = c( "Aliens", "Aliens", "Constitution", "Constitution", "Entitled", "Entitled" ),
dates = as.Date( c ("2010-01-05", "2010-02-13", "2010-04-20", "2010-06-11","2010-03-18", "2010-09-13" )),
Rep = c( .18, .14, .16, .45, .33, .71 ), Dem = c( .16, .38, .24, .11, .59, .34 ))
到目前为止,这就是我能够做到的。我认为它并没有真正说明问题。我可以按相关性和颜色按月调整大小吗?
plot(x=data$dates, y=data$Rep, ylim=c(0,1.1*max(data$Rep)),
col='blue', pch = 15,
main='Rep Correlations stock close', xlab='date', ylab='Republican')
axis(2, pretty(c(0, 1.1*max(data$Rep))), col='blue')
par(new=T)
plot(x=data$date, y=data$Dem, ylim=c(0,1.1*max(data$Dem)),
col='green', pch = 20,
xaxt='n', axes = F, xlab = '', ylab='')
axis(4, pretty(c(0, 1.1*max(data$Dem))), col='green')
mtext("Democrat",side=4)
有什么想法/提示吗?