Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
204 views
in Technique[技术] by (71.8m points)

r - How to generate multiple ggplots using a for loop


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try with this:

library(ggplot2)
#Function does not return graph
for (i in list){
  var <- sym(i)
  print(ggplot(data = test_df, aes(x= DateTime.lub, y = !!var))+
    geom_line(aes(colour = Step))+
    ggtitle(paste0('plot_',i)))
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...