1

I am plotting a chart using ggplot2 in R. I have the same scatter-plot made using Excel and I really like the aesthetics of the dots plotted in Excel see image below).

Scatter-plot in Microsoft Excel

My ggplot2 codes currently stand as follows:

ggplot(mydata2, aes(TotalStay, TotalExpenses)) +  
    geom_point(shape = 19, position = position_jitter(width = 1, height = .5))

What do I need to add to my existing codes to get the same effect as the scatter-plot in Excel?

alistaire
  • 42,459
  • 4
  • 77
  • 117
user3115933
  • 4,303
  • 15
  • 54
  • 94

1 Answers1

4

Use a symbol that has a fill and a border color and specify both accordingly:

library(ggplot2)
df <- as.data.frame(replicate(2, runif(1e4)))
ggplot(df,aes(V1,V2)) + 
  geom_jitter(shape=21, width=1, height=.5, fill="#A1C0E5", color="#639DD2") + 
  theme_minimal()

enter image description here

lukeA
  • 53,097
  • 5
  • 97
  • 100