How do I avoid overwriting plot on top of each other while running the plot inside for loop in R (jupyter notebook)?

73 Views Asked by At

enter image description here

I am running a code which will print multiple plots while in a for loop in a jupyter notebook.But I am getting a behavior as shown above. How do I avoid this and not print each plot top of each other while running inside for loop in jupyter?

for(i in names(cb_sniffer_outs_list)){
    if(length(cb_sniffer_outs_list[[i]]) > 2 || length(vartrix_outs_list_comb[[i]]) > 2){
      ven <- venndetail(list(cb_sniffer = cb_sniffer_outs_list[[i]], 
                vartrix = vartrix_outs_list_comb[[i]])) 
      print(i)
      print(plot(ven))
    }
    else{next}
    }

I tried the following code

for(i in names(cb_sniffer_outs_list)){
    if(length(cb_sniffer_outs_list[[i]]) > 2 || length(vartrix_outs_list_comb[[i]]) > 2){
      ven <- venndetail(list(cb_sniffer = cb_sniffer_outs_list[[i]], vartrix = vartrix_outs_list_comb[[i]])) 
      print(i)
      print(plot(ven))
    }
    else{next}
    }

and got this (image attached above)

0

There are 0 best solutions below