I am attempting produce a scatter plot using the ggplot2 library. My data frame (called scatterPlotData) is in this form:
115 2.3
120 1.6
.
.
.
132 4.3
(The ... signifies many other similar values). Essentially, a 2 column data frame. I also have labels to go along with each of those points. Firstly, I'm having trouble with the scatterplot itself. I'm using the following code:
p <- ggplot(scatterPlotData, aes("Distance (bp)", "Intensity"))
p + geom_point()
However, using the above code, I get the following plot:
Obviously, it's not a scatter plot. So, I'd be very helpful if someone could point out what I'm doing wrong.
Secondly, it's about the labels. I will have many datapoints which would have the risk of overlapping datapoints. How should I go about just putting on labels to each point using ggplot? Also, it states that I could use the directlabels package to get a good overlap free labelled scatterplot using different colors, however, I'm not sure how I would go about that with ggplot
as I haven't found any documentations regarding the use of directlabels with ggplot
.
Any help with either (or both) question(s) are greatly appreciated - thanks.