0

My problem is exactly like this link enter link description here

I used facet but I got this erorr: Warning: Error in combine_vars: At least one layer must contain all faceting variables: w3.

  • Plot is missing w3
  • Layer 1 is missing w3

this is a part of my code (I have written only server side):

output$fancyPlot <- renderPlotly({
 s = input$fancyTable_rows_selected
for (i in 1: length(s)) {
  mat = matrix(ncol = 0, nrow = 0)
  E = data.frame(mat)
  E2 = P2[[i]]
  E2 = as.data.frame(E2)
  E1 = P1[[i]]
  E1 = as.data.frame(E1)
  E = cbind(E1, E2)
  colnames(E) = c("group1", "group2")
  w1 = group1_vectors[i]
  w2 = group2_vectors[i]
  w3 = gene_vectors[i]
 
  plot1 = ggplot(E, aes(x = group1 , y = group2)) +
    geom_point(color='tomato')+
    facet_wrap(~w3)
    
  plot1 =   ggplotly(plot1)
  plot_list_final[[i]] = plot1
}


plot_list_final =  do.call(tagList, plot_list_final)
f = length(s)
p_last <- subplot(plot_list_final[1:f], shareX = TRUE, shareY = TRUE) 
dev.off()
return(p_last) 

})

I would like each subplot has own title

shamimash
  • 3
  • 2
  • You maximise your chance of getting a useful answer if you provide a minimal reproducible example. [This post](https://stackoverflow.com/help/minimal-reproducible-example) may help. Without any test data and with only partial code, it's difficult - if not impossible - to help you. – Limey May 11 '22 at 08:37

0 Answers0