Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
312 views
in Technique[技术] by (71.8m points)

r - How can I change the point color in my scatter plot for each column of my dataframe (one color for each column)?

I'm trying to change the color of my data in a Scatter Plot. I have 5 columns (only 3 with values for my Plot) with 264.000 rows, this my dataframe:

ID1         ID2         dN      dS      t
QJY77946    NP_073551   0.0241  0.1402  0.1479
QJY77954    NP_073551   0.0119  0.0912  0.0870
QJY77954    QJY77946    0.0119  0.0439  0.0566

My Scatter Plot when I make Column dN vs dS is this:

enter image description here

My question: How I can change the color for points in each column (one color for column dN, other for the column dS...)??

I′m using ggplot2 and tidyverse libraries in RStudio, this is my code for Scatter Plot:

Any idea or help is welcome! Thank!

  ggplot(aes(x = dN, y = t)) + 
  geom_point(size = 0.2) +
  labs(title = "Pairwise Comparison S Protein",
       subtitle = "dS vs dN with YN00",
       x = "dS rate",
       y = "dN rate") +
  theme_bw() + 
  theme(axis.title = element_text())```
question from:https://stackoverflow.com/questions/65890252/how-can-i-change-the-point-color-in-my-scatter-plot-for-each-column-of-my-datafr

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...