I would like to plot two variables in a scatterplot using ggplot2 and assign different colors to the data points from two variables

0

I have the data for organic matter from two sources i.e. from field and lab. I want to see how close the data from two sources is by fitting two lines across the datasets from the two sources. I was thinking of plotting a scatterplot for the data from field and lab and color the data points with two different colors depending on the source. Could you please suggest how to plot such data?

I just plotted one variable on y axis and don't know how to add another variable on y axis and color the data points.

Please show a sample of your data. You can do that by posting the output of the dput() function. If your data are in a data frame named DF, post the output of

dput(head(DF, 20))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.