简体   繁体   中英

Indexing in plot x-axis label in for loop

I am making plots with a for loop in the form of

for(i in 1:10){
plot(matrix.X, ylab=expression(beta[i]))
}

This code only labels each of the 10 plots with Beta_i, however I would like the ylabs to be Beta_1,...,Beta_10. How shall I label the plots? Thanks in advance!

for(i in 1:10){
  plot(matrix.X, ylab=paste0("beta_", i)) # you need the paste function
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM