我想获得多个条形图。我的问题是绘图的标题,x轴和y轴未显示在绘图上。图例也显示了一半的单词。
我已经尝试过此代码
library(plotly)
library(RColorBrewer)
library(wesanderson)
par(mar = rep(2, 4))
par(mfrow=c(4,2))
xdata <- c( 200,400,600,800,1000,1200,1400,1600,1800,2000 )
y1=c(0.700, 0.788, 0.780, 0.744, 0.706, 0.700, 0.708 , 0.750 , 0.751 , 0.707)
y2=c(0.701, 0.734, 0.702, 0.705, 0.707, 0.708, 0.700, 0.754 , 0.752 , 0.747)
y3=c(0.900, 0.876, 0.900, 0.907, 0.905, 0.903 , 0.900 , 0.990 , 0.994 , 0.908)
y4=c(0.580, 0.505, 0.502, 0.504, 0.502, 0.577, 0.501, 0.602 , 0.580 ,0.500 )
y5=c(0.903, 0.902, 0.902, 0.998, 1, 0.999, 1, 1, 1, 1 )
test2 <- rbind( y1, y2, y3,y4,y5)
barplot(test2, ylim=c(0,1), beside=TRUE,,
xlab="Sample Size", ylab="Relative Frequency",
col= c("forestgreen", "chocolate", "red", "darkorchid","blue" ),
legend.text = c("AIC","AICc", "BIC","LASSO","AdLASSO"),
args.legend = list(x = "right", bty="n",inset=c(-0.25,0),text.col =
"black",horiz = F, xpd = T),
names.arg =
c("200","400","600","800","1000","1200","1400","1600","1800","2000" ))
xdata <- c( 200,400,600,800,1000,1200,1400,1600,1800,2000 )
y1=c(0.700, 0.788, 0.780, 0.744, 0.706, 0.700, 0.708 , 0.750 , 0.751 , 0.707)
y2=c(0.701, 0.734, 0.702, 0.705, 0.707, 0.708, 0.700, 0.754 , 0.752 , 0.747)
y3=c(0.900, 0.876, 0.900, 0.907, 0.905, 0.903 , 0.900 , 0.990 , 0.994 , 0.908)
y4=c(0.580, 0.505, 0.502, 0.504, 0.502, 0.577, 0.501, 0.602 , 0.580 ,0.500 )
y5=c(0.903, 0.902, 0.902, 0.998, 1, 0.999, 1, 1, 1, 1 )
test2 <- rbind( y1, y2, y3,y4,y5)
barplot(test2, ylim=c(0,1), beside=TRUE,,
xlab="Sample Size", ylab="Relative Frequency",
col= c("forestgreen", "chocolate", "red", "darkorchid","blue" ),
legend.text = c("AIC","AICc", "BIC","LASSO","AdLASSO"),
args.legend = list(x = "right", bty="n",inset=c(-0.25,0),text.col =
"black",horiz = F, xpd = T),
names.arg =
c("200","400","600","800","1000","1200","1400","1600","1800","2000" ))
xdata <- c( 200,400,600,800,1000,1200,1400,1600,1800,2000 )
y1=c(0.700, 0.788, 0.780, 0.744, 0.706, 0.700, 0.708 , 0.750 , 0.751 , 0.707)
y2=c(0.701, 0.734, 0.702, 0.705, 0.707, 0.708, 0.700, 0.754 , 0.752 , 0.747)
y3=c(0.900, 0.876, 0.900, 0.907, 0.905, 0.903 , 0.900 , 0.990 , 0.994 , 0.908)
y4=c(0.580, 0.505, 0.502, 0.504, 0.502, 0.577, 0.501, 0.602 , 0.580 ,0.500 )
y5=c(0.903, 0.902, 0.902, 0.998, 1, 0.999, 1, 1, 1, 1 )
test2 <- rbind( y1, y2, y3,y4,y5)
barplot(test2, ylim=c(0,1), beside=TRUE,,
xlab="Sample Size", ylab="Relative Frequency",
col= c("forestgreen", "chocolate", "red", "darkorchid","blue" ),
legend.text = c("AIC","AICc", "BIC","LASSO","AdLASSO"),
args.legend = list(x = "right", bty="n",inset=c(-0.25,0),text.col =
"black",horiz = F, xpd = T),
names.arg =
c("200","400","600","800","1000","1200","1400","1600","1800","2000" ))
xdata <- c( 200,400,600,800,1000,1200,1400,1600,1800,2000 )
y1=c(0.700, 0.788, 0.780, 0.744, 0.706, 0.700, 0.708 , 0.750 , 0.751 , 0.707)
y2=c(0.701, 0.734, 0.702, 0.705, 0.707, 0.708, 0.700, 0.754 , 0.752 , 0.747)
y3=c(0.900, 0.876, 0.900, 0.907, 0.905, 0.903 , 0.900 , 0.990 , 0.994 , 0.908)
y4=c(0.580, 0.505, 0.502, 0.504, 0.502, 0.577, 0.501, 0.602 , 0.580 ,0.500 )
y5=c(0.903, 0.902, 0.902, 0.998, 1, 0.999, 1, 1, 1, 1 )
test2 <- rbind( y1, y2, y3,y4,y5)
barplot(test2, ylim=c(0,1), beside=TRUE,,
xlab="Sample Size", ylab="Relative Frequency",
col= c("forestgreen", "chocolate", "red", "darkorchid","blue" ),
legend.text = c("AIC","AICc", "BIC","LASSO","AdLASSO"),
args.legend = list(x = "right", bty="n",inset=c(-0.25,0),text.col =
"black",horiz = F, xpd = T),
names.arg =
c("200","400","600","800","1000","1200","1400","1600","1800","2000" ))
xdata <- c( 200,400,600,800,1000,1200,1400,1600,1800,2000 )
y1=c(0.700, 0.788, 0.780, 0.744, 0.706, 0.700, 0.708 , 0.750 , 0.751 , 0.707)
y2=c(0.701, 0.734, 0.702, 0.705, 0.707, 0.708, 0.700, 0.754 , 0.752 , 0.747)
y3=c(0.900, 0.876, 0.900, 0.907, 0.905, 0.903 , 0.900 , 0.990 , 0.994 , 0.908)
y4=c(0.580, 0.505, 0.502, 0.504, 0.502, 0.577, 0.501, 0.602 , 0.580 ,0.500 )
y5=c(0.903, 0.902, 0.902, 0.998, 1, 0.999, 1, 1, 1, 1 )
test2 <- rbind( y1, y2, y3,y4,y5)
barplot(test2, ylim=c(0,1), beside=TRUE,,
xlab="Sample Size", ylab="Relative Frequency",
col= c("forestgreen", "chocolate", "red", "darkorchid","blue" ),
legend.text = c("AIC","AICc", "BIC","LASSO","AdLASSO"),
args.legend = list(x = "right", bty="n",inset=c(-0.25,0),text.col =
"black",horiz = F, xpd = T),
names.arg =
c("200","400","600","800","1000","1200","1400","1600","1800","2000" ))
xdata <- c( 200,400,600,800,1000,1200,1400,1600,1800,2000 )
y1=c(0.700, 0.788, 0.780, 0.744, 0.706, 0.700, 0.708 , 0.750 , 0.751 , 0.707)
y2=c(0.701, 0.734, 0.702, 0.705, 0.707, 0.708, 0.700, 0.754 , 0.752 , 0.747)
y3=c(0.900, 0.876, 0.900, 0.907, 0.905, 0.903 , 0.900 , 0.990 , 0.994 , 0.908)
y4=c(0.580, 0.505, 0.502, 0.504, 0.502, 0.577, 0.501, 0.602 , 0.580 ,0.500 )
y5=c(0.903, 0.902, 0.902, 0.998, 1, 0.999, 1, 1, 1, 1 )
test2 <- rbind( y1, y2, y3,y4,y5)
barplot(test2, ylim=c(0,1), beside=TRUE,,
xlab="Sample Size", ylab="Relative Frequency",
col= c("forestgreen", "chocolate", "red", "darkorchid","blue" ),
legend.text = c("AIC","AICc", "BIC","LASSO","AdLASSO"),
args.legend = list(x = "right", bty="n",inset=c(-0.25,0),text.col =
"black",horiz = F, xpd = T),
names.arg =
c("200","400","600","800","1000","1200","1400","1600","1800","2000" ))
我想在R中的一个窗口中获得6个条形图。此外,我想知道如何获得每个图的标题以及x轴和y轴的名称。我也想得到每个情节的传说。
请您帮忙!