Home > Software engineering >  Issue for facet wrap function
Issue for facet wrap function

Time:11-14

I'd like to separate my result into two different plot using the facet wrap function, however, my codes seems to give me faulty plots where two different factors (genotype PsbS and T259D) were still shown in the plot despite the data of only one was being shown (This might sound confusing, please refer to my plots). Thanks! my plot

RE <- read_csv("Cq.csv")
view(RE)
data.frame(RE)
ggplot(data=RE, mapping = aes(x = factor(genotype), y = cq, fill= line)) 
  geom_bar(stat = "identity", position = "dodge") 
  geom_errorbar(data=RE, aes(ymin=cq-SEM, ymax=cq SEM), width=.2, position=position_dodge(width= 0.9)) 
  theme_bw() 
  theme(text = element_text(size = 15)) 
  facet_wrap(~genotype)


data.frame(RE)
   id genotype   line           cq       SEM
1   1     PsbS   L1.1 14.870601010 5.4970515
2   2     PsbS   L1.2 23.455655780 1.4763615
3   3     PsbS   L1.3 14.004065480 0.8800974
4   4     PsbS   L1.4  6.888686944 0.5056124
5   5     PsbS   L1.5  8.986116514 0.9482289
6   6     PsbS   L1.6  0.000703389 0.0000864
7   7     PsbS   L1.7 11.422758140 0.3682201
8   8     PsbS   L1.8  7.329694392 0.8226627
9   9     PsbS   L1.9  6.795220106 0.7286420
10 10    T259D L3.3.1 20.549244950 1.6416835
11 11    T259D L3.3.2 24.979360100 4.5510392
12 12    T259D L3.3.3 25.089471950 3.4598942

CodePudding user response:

~ facet.wrap(~ genotype, scales="free")

  • Related