I visualize the variable using the size of the point. My problem is that the first (smallest) point size (in this case, "70") is significantly (not proportional) smaller than the rest. (See Legend for CP)

This is the code I'm using:
ggplot(data=testdata, aes(x=variable, y=value, group=ID, size=CP)) + geom_point()
According to this data:
ID CP variable value
1 C1 70 A 76
2 C2 95 A 20
3 C3 100 A 30
4 C4 NA A 17
5 C1 70 B 36
6 C2 95 B 10
7 C3 100 B 51
8 C4 NA B 41
9 C1 70 C 89
10 C2 95 C 1
11 C3 100 C 94
12 C4 NA C 6
13 C1 70 D 100
14 C2 95 D 98
15 C3 100 D 16
16 C4 NA D 33
Now when I try to adjust the size of the points, R doesn't like it:
> testplot = ggplot(data=testdata, aes(x=variable, y=value, group=ID, size=CP)) + geom_point()
> testplot = testplot + scale_size_discrete(range=c(3,5))
Warning message:
Using size for a discrete variable is not advised.
> testplot
Error: Continuous value supplied to discrete scale
And no plot is created. For this:
> testplot = ggplot(data=testdata, aes(x=variable, y=value, group=ID, size=CP)) + geom_point()
> testplot = testplot + scale_size_continuous(to=c(3,5))
Error in scale_size_continuous(to = c(3, 5)) :
unused argument (to = c(3, 5))
> testplot
Error: Continuous value supplied to discrete scale
source
share