Size of geom_point based on absolute value

Hi, this is my first post so I apologize for any mistakes. I am trying to make a scatterplot with the size of the points based on the values in the "corr" column. I want the points to be smallest at zero, and to get larger as the value moves away from zero (in both the positive and negative directions). Any advice would be greatly appreciated!

library(ggplot2)

lat<-c(20,21,22,23,22.5)
long<-c(55,52,51,50,49)
corr<-c(-5,5,1,-1,-3)
df<-data.frame(lat,long,corr)

ggplot(df,aes(x=long,y=lat,size=corr))+
geom_point()

Hi,

Welcome! If you take 'corr^2' (square) it will look better?

JW

1 Like

Yes, that does the trick! I have spent more time trying to figure this out than I care to admit. Thanks so much for the quick response.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.