I´m working on my thesis project and need some help.
Previously, I posted a similar question but now I simplify the DataFrame (DF), because the previous question and answer work but not how I expect for my results.
Now, I´m using a DF for made a Scatter Plot (SP) with ggplot2. This is part of my DF (9 columns and 723 rows):
ID1 ID2 dN dS t Label_ID1 Label_ID2 Group YP_009724393 AFR79253 0.5756 1.8977 2.7739 SARS2-CoV 229E-CoV Inter YP_009724393 AFR79260 0.5756 1.8977 2.7739 SARS2-CoV 229E-CoV Inter YP_009724393 AAG48596 0.5984 1.4520 2.5175 SARS2-CoV 229E-CoV Inter YP_009724393 AVP78034 0.0166 0.3459 0.3185 SARS2-CoV SARSr-bat-CoV Inter YP_009724393 AVP78045 0.0166 0.3459 0.3185 SARS2-CoV SARSr-bat-CoV Inter YP_009724393 ATO98112 0.0172 0.7249 0.6923 SARS2-CoV SARSr-bat-CoV Inter
Previously, I made different SPs with only Group column (color = Group, i.e: Intra or Inter). Now I´m looking for a specific comparison with the columns Label_ID1 and ID2 . The column Label_ID1 has only one Label (SARS2-CoV) and the column Label_ID2 has 24 different labels.
My goal is to represent the values in the columns dN vs dS, dN vs t, and dS vs t with only a specifics comparison (Label_ID1 vs Label_ID2) represent with different colors with this "versus":
SARS2-CoV vs SARS1-CoV; (red, for example) SARS2-CoV vs MERS-CoV, (blue...) SARS2-CoV vs SARSr-bat-CoV, (green...) SARS2-CoV vs SARSr-bat-RaTG13-CoV, (...) SARS2-CoV vs SARSr-bat-BM4831-CoV; SARS2-CoV vs SARSr-Pangolin-CoV.
I´m using RStudio (ggplot2) to plot this DF. My question is:
It´s possible to represent this comparison? I tried different ways but nothing works for me. This is part of my code which previously plot SC with only Group column with two different color:
df_M %>% ggplot(aes(x = dN, y = t)) + geom_point(aes(color = Group)) + scale_y_continuous(trans='log10') + scale_x_continuous(trans='log10') + labs(title = "Pairwise Comparison M Protein", subtitle = "Inter versus Intragroup", x = "dN rate", y = "t rate", color = "Group") + theme_gray() + theme(axis.title = element_text())
Any idea or help is welcome! Thank! Best!