I've been plotting one continuous variable as a function of another without difficulty for a project -- until now. I expect
scale_x_continuous(breaks = seq(1, 13, 1))
to produce an x-axis ranging from 1 to 13 with labeled tic marks at each integer position. Instead, I get
Error:
! Discrete value supplied to continuous scale
The data frame containing the values I'm plotting was produced by ezStats, and I'm plotting Mean as a function of CR. Its first few entries look like this:
## CR N Mean SD FLSD
## 1 1.81625441696113 8 98.43750 4.4194174 4.361602
## 2 1.85964912280702 8 96.25000 7.4402381 4.361602
## 3 1.88288743059061 8 98.75000 3.5355339 4.361602
## 4 1.90014130946773 8 98.43750 4.4194174 4.361602
A few of the values for CR are integers, with no decimal point -- don't know if that's relevant.
If I omit the scale_x_continuous statement, leaving
coord_cartesian(xlim = c(1, 13), ylim = c(0, 110))
to affect the axis scaling, I get this:
So it appears that ggplot2 thinks CR is a categorical variable. It plots the first 13 (out of 176) entries and tries to label each tic mark with the value of CR for the associated data point.
I' don't understand why this problem occurs only in this case or how to fix it.
