R中有2个Y轴的条形图

时间:2014-07-04 18:36:46

标签: r graph

我正在尝试在r中创建一个双向条形图。或者是带有两个y轴的条形图,用于表示不同的变量。

我有以下代码:

x<-c("1820s", "1830s", "1840s", "1850s", "1860s", "1870s", "1880s", "1890s", "1900s")
y<- cbind(c(1.16, 1.36, 1.10, 1.16, 1.18, 1.19, 1.26, 1.32, 1.95)
y2<-c(58.71, 54.42, 39.36, 41.7, 51.14, 50.35, 59.53, 58.88, 75.31)

bp<-barplot(t(y), beside=TRUE)
xlim<-c(floor(min(bp)), ceiling(max(BP)))
par(new=TRUE)

但是,从这里开始,我不确定如何插入第二个变量。

我希望我的条形图的格式与此类似。

enter image description here

0 个答案:

没有答案