Hello,

Your example is not reproducible but here it goes.

Data:

df1 <- iris[c(1, 2, 5)]

Use scale_size_manual.

1. If Stage is a factor or character



df1$Stage <- "a"

p <- ggplot(df1, aes(Sepal.Length, Sepal.Width, color = Species))
p1 <- p +
  geom_point(aes(size = Stage), alpha = 1/3) +
  xlab ("X") +
  ylab("Y") +
  geom_smooth(method = 'loess', formula = y ~ x)



2. If Stage is numeric, coerce to factor manually


df1$Stage <- 5

p <- ggplot(df1, aes(Sepal.Length, Sepal.Width, color = Species))
p1 <- p +
  geom_point(aes(size = factor(Stage)), alpha = 1/3) +
  xlab ("X") +
  ylab("Y") +
  geom_smooth(method = 'loess', formula = y ~ x)


Then add the scale_size


p1 + scale_size_manual(values = 0.8)


Hope this helps,

Rui Barradas

Às 16:05 de 30/09/20, Medic escreveu:
The code works as I want, but the points are too big. How to decrease
them? (Where to insert: size = 0.8?)
p1 <- p + geom_point(aes(size = Stage), alpha = 1/3) + xlab ("X") +
ylab("Y") + geom_smooth()

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to