Search code examples
rggplot2scatter-plotaesthetics

Why and when "Using size for a discrete variable is not advised"?


I made a scatterplot with ggplot2 and I mapped a binary variable to point size. The result was satisfactory but I got the warning "Using size for a discrete variable is not advised".

I understand that using size to map a non ordinal categorical variable with several levels may be less clear than using point shape or different colors. However, I wonder whether that warning is intended to warn us about anything more serious.

Is there a more advisable way to change point size according to a binary or categorical variable than using aes(size=...)?

Is the warning "Using size for a discrete variable is not advised" just a design tip?

If my result looks good, should I worry about that warning next time I want the same kind of graphic on similar data?


Solution

  • As the comments and you have mentioned, if you use size for categorical variables, then you mislead the reader.

    If you have numbers and have this error, convert them with as.numeric(), as they may have been stored as factors or character values. That will sort out the legend too.