Reputation: 533
I'm using the function scale_size_manual()
for the first time. I'm trying to decrease the size of the points using the script below:
p2<-ggplot(data = dfnew, aes(x = Area, y = Proportion, group=linegroup)) +
geom_point(aes(shape = as.character(Collar)), size = 6, stroke = 0,
position = myjit)+
geom_line(aes(group = linegroup),linetype = "dotted",size=1, position = myjit) +
theme(axis.text=element_text(size=15),
axis.title=element_text(size=20)) +
geom_errorbar(aes(ymin = Lower, ymax = Upper), width=0.3, size=1,
position = myjit) + scale_shape_manual(values=c("41361´"=19,"41365´"=17)) + scale_size_manual(values=c(2,2)) +
scale_color_manual(values = c("SNP" = "black",
"LGCA" = "black")) + labs(shape="Collar ID") + ylim(0.05, 0.4)
However, the size of the points doesn't regardless of the number entered. I've seen other internet posts implementing this function in the same way, so I wondered if somebody could set me on the right track?
Thanks in advance!
P.S. My data:
> dput(dfnew)
structure(list(Proportion = c(0.181, 0.289, 0.099, 0.224), Lower = c(0.148,
0.242, 0.096, 0.217), Upper = c(0.219, 0.341, 0.104, 0.232),
Area = c("LGCA", "SNP", "LGCA", "SNP"), Collar = c("41361´",
"41361´", "41365´", "41365´"), ymin = c(0.033, 0.047, 0.003,
0.00700000000000001), ymax = c(0.4, 0.63, 0.203, 0.456),
linegroup = c("LGCA 41361´", "SNP 41361´", "LGCA 41365´",
"SNP 41365´")), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-4L))
Upvotes: 1
Views: 4474
Reputation: 2581
You're setting the size of your points in the geom_point
layer by using the argument size
.
geom_point(aes(shape = as.character(Collar)), size = 6, stroke = 0,
position = myjit)+
The only way to decrease the size of the points in your case is by decreasing size
, e.g. to 4.
geom_point(aes(shape = as.character(Collar)), size = 4, stroke = 0,
position = myjit)+
You can only use scale_size_manual
if the size is mapped within aes
using a variable within data, like in the example below.
ggplot(data = dfnew, aes(x = Area, y = Proportion, group = linegroup, size = Area))
Upvotes: 2