I have data (x,y) for dates (x) and y (values). I split y into bins by value and am plotting one point for each bin on each day, with the size of the point proportional to the number of values that fall into each bin for that day. Each day now has 5 bins with a count for the number of values in each bin. The bins look like:
Group: Value
upper: 40-50
mid-upper: 30-40
mid: 20-30
mid-lower: 10-20
lower: 0-10
I want to plot y vs x where the x axis is the date, and the y axis ticks are the bins (each day will have 5 points stacked, with the size of the point proportional to the number of values in that bin for that day).
I have the R code in place for plotting, but the y axis labels ticks are directly next to the points on the graph. However, I would like the ticks to instead fall between the points, so that the points are contained within the bin limits rather than associated with a single average value for that bin.
The code is:
breaks = c(5, 15, 25, 35, 45, 55)
ggplot(df, aes(x = df$date, y = df$group, size = df$count)) +
geom_point(aes(color = df$count), alpha = 0.8, show_guide = FALSE) +
scale_x_date(breaks = "2 weeks", minor_breaks = "1 day", labels = date_format("%m-%d-%Y")) +
scale_y_discrete(name = "Value", labels=c(round(breaks)))
I have tried a few different methods to change the y-axis tick location, including changing the labels and breaks in scale_y_discrete or adding in axis.ticks.y to theme(), but I cannot seem to get the labels to move in between the points on the graph even when the labels show the proper values.
Thanks, I appreciate any suggestions!