Tiptop
Tiptop

Reputation: 623

Lines on circles in ggplot graph

I'm struggling to get black lines around the circle and triangles in my plot. Any ideas?

Here's the code

  ggplot(df, aes(x=days_incubated, y=emission))+
  geom_point(aes(shape=compound, color=compound, size=compound, fill=compound)) +
  scale_shape_manual(values=c(21, 25))+
  scale_size_manual(values=c(2.8, 2.8))+
  #scale_fill_manual(values=c("green", "white"))+
  scale_color_manual(values=c("white", "gray31")) +
  labs(color = "Compound", shape = "Compound") +
  theme_bw() +
  facet_wrap(vars(jar), scales = "free_y")

The data:

df <- structure(list(days_incubated = c(0, 0, 0, 0, 0, 0, 4, 4, 4, 
4, 4, 4, 10, 10, 10, 10, 10, 10, 24, 24, 24, 24, 24, 24), jar = structure(c(1L, 
1L, 3L, 3L, 2L, 2L, 1L, 1L, 3L, 3L, 2L, 2L, 1L, 1L, 3L, 3L, 2L, 
2L, 1L, 1L, 3L, 3L, 2L, 2L), .Label = c("1", "51", "24"), class = "factor"), 
    compound = c("Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", 
    "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", 
    "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", 
    "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", 
    "Acetaldehyde", "Acetone", "Acetaldehyde", "Acetone", "Acetaldehyde"
    ), emission = c(2.27, 2.48, 1.12, 1.36, 19.88, 9.38, 6.26, 
    0.92, 2.07, 10.23, 37.04, 39.78, 9.1, 0.32, 1.77, 10.79, 
    320.7, 29.54, 0.08, 0, 0.29, 0.02, 0, 0.01)), row.names = c(NA, 
-24L), class = c("tbl_df", "tbl", "data.frame"))

Upvotes: 0

Views: 38

Answers (1)

teunbrand
teunbrand

Reputation: 38013

If you drop any colour specifications, you'd get the contours of the points in the standard black. You can use the fill specification.

ggplot(df, aes(x=days_incubated, y=emission))+
  geom_point(aes(shape=compound, size=compound, fill=compound)) +
  scale_shape_manual(values=c(21, 25))+
  scale_size_manual(values=c(2.8, 2.8))+
  labs(fill = "Compound", shape = "Compound", size = "Compound") +
  theme_bw() +
  facet_wrap(vars(jar), scales = "free_y")

enter image description here

Upvotes: 2

Related Questions