'ggplot stat_sum setting without removing x scale and intervals

I have data where I am comparing a binary variable to a continuous variable. Following a somewhat-related UCLA guide, I am using the ggplot scat_sum option.

My problem is if I do not set the x scale (for the binary variable), or set it as an xlim, then the x scale goes 0.00, 0.25, 0.5, 0.75, 1.00 for a 0/1 variable; but the only way I know how to set the exact intervals is scale_x_discrete, which drops the values on the xscale. How do I have it look like the scale_x_discrete version, but with the values on the xscale?

ggplot(temp, aes(x = date_diff_bin, y = new_own_dt_2016)) +
  stat_sum(aes(size = ..n.., group = 1)) +
  scale_size_area(max_size=10) +
  scale_x_discrete(breaks = seq(0, 1))

enter image description here

ggplot(temp, aes(x = date_diff_bin, y = CurrentAge)) +
  stat_sum(aes(size = ..n.., group = 1)) +
  scale_size_area(max_size=10) +
  xlim(0,1)

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source