I want to reproduce a graph as shown in the image I uploaded. The second image is a screenshot of my excel file. I want to make a scatter plot on the basis of species as shown in the figure. I have six different species: Mouse, maca, human, orangutan, gorilla and chimp. I have more than 1700 observations in my dataset. I tried using both qpplot and simple plot function but that didn't help me reproduce the figure. I then tried creating a subset such that I get first 23 observations for each specie in dataframe and plot those dataframes using the simple plot function. Any suggestions how I can reproduce the graph.
Asked
Active
Viewed 241 times
1 Answers
1
I think this example is similar to the figure
library(ggplot2)
data(mtcars)
mtcars$cyl <- as.factor(mtcars$cyl)
# Extend the regression lines
ggplot(mtcars, aes(x=wt, y=mpg, color=cyl, shape=cyl)) +
geom_point() +
geom_smooth(method=lm, se=FALSE, fullrange=TRUE)
The code is from http://www.sthda.com/english/wiki/ggplot2-scatter-plots-quick-start-guide-r-software-and-data-visualization

JKim
- 135
- 2
- 7