0

I have a dataframe of 4 variables and let's say 100 entries. This variables are dummies that varies in small scales (1-5). Is there a way to acknowledge the density of the points plotted in the scatterplot? By having my points varying only between 1,2,3,4,& 5 many of them are located at the same place therefore I cannot see a pattern emerging as they are perfectly overlapping.

  • This depends on the type of plot you are using but this could be achieve more generally using some level of transparency, for example `alpha = 0.3` om `ggplot2` . In any case, it is not possible to help you here if you don't give us more details of your plot and a reproducible example. Example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – rafa.pereira Jun 20 '16 at 09:10

1 Answers1

0

A first possibility would be to use jitter; and a second to use transparent Colors:

set.seed(1)
df <- data.frame(var1 = sample(1:5, size = 100, replace = TRUE),
                 var2 = sample(1:5, size = 100, replace = TRUE))

plot(jitter(var1) ~ jitter(var2), data = df)

plot(var1 ~ var2, data = df, col = "#20000050")
Qaswed
  • 3,649
  • 7
  • 27
  • 47