I have produced a chart using ggplot2 and the geom_freqpoly function. I am not able to post an image but hopefully I can describe my issue.
My chart displays two lines for the number of observations at given points along an x-axis which is in increments of 0.50 and values in my data only exists along these 0.50 intervals.
I have created this example data set to hopefully illustrate:
AvgMargin <- c(0.00, 0.50, 2, 1, 1, 0.5, 0.5)
Median <- as.factor(c("High", "Low", "Low", "High", "High", "Low", "Low"))
Matches <- data.frame(AvgMargin, Median)
the code I have used is as follows:
ggplot(Matches, aes(AvgMargin, colour=Median)) + geom_freqpoly(binwidth=0.5) + scale_x_continuous(breaks=-5:5)
The problem I have is that the peaks of my lines do not correspond with the values I would expect on the x axis. The values on my x axis are only in increments of 0.50 yet I seem to have peaks inbetween these points (for at 0.25 and 0.75 but I have no values of 0.25 and 0.75 in my data).
What I would like to know is how do I get my lines to correspond with my x axis please?