0
  1. How can I add a black outline to all points? -> I have tried: geom_point(aes(size = scaled_val, colour = value), colour "black") - but it turns the filling black. Also I have tried adding another: geom_point(colour= "black") but it plots black points on top of the scaled points

  2. Can I ignore the colour by value for one of the variables? (ie: I would like variable C to be ploted in size as scaled value like it is, but ignore the colouring by value and have an independent colour (black))

data <- tibble::tibble(
  value = c(4.07, 5.76, 2.87,4.94,5.48, 6.75,1.53,1.35, 1.32), 
  Variable = rep(c(rep("A",3),rep("B",3), rep("C",3))),
  Experiment = rep(c(1:3),3))

data <- data %>%group_by(Variable)%>%
  mutate(scaled_val = scale(value)) %>%
  ungroup()

data$Variable <- factor(data$Variable,levels=rev(unique(data$Variable)))

ggplot(data, aes(x = Experiment, y = Variable, label=NA)) +
  geom_point(aes(size = scaled_val, colour = value)) + 
  geom_text(hjust = 1, size = 2) +
  theme_bw()+
  scale_color_gradient(low = "lightblue", high = "darkblue")+
  scale_x_discrete(expand=c(1,0))+
  coord_fixed(ratio=4)

enter image description here

Thanks!

Community
  • 1
  • 1
Ecg
  • 908
  • 1
  • 10
  • 28
  • 1
    You need to use `geom_point(..., shape = 21)` – markus May 05 '20 at 13:04
  • 1
    Yep. [See this](http://www.sthda.com/english/wiki/ggplot2-point-shapes). `shape` 21 through 25 are all outlined points which have a `fill=` and an outline (`color=`). – chemdork123 May 05 '20 at 13:07
  • The solution is to add another geom_point such as: ``geom_point(aes(size = scaled_val, colour = value), shape=21, colour="black") +`` – Ecg May 05 '20 at 14:54

0 Answers0