Skip to content

Instantly share code, notes, and snippets.

@Swarchal
Created December 28, 2016 15:07
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Swarchal/b938933ae9ded94b3c14d6485b27cf69 to your computer and use it in GitHub Desktop.
Save Swarchal/b938933ae9ded94b3c14d6485b27cf69 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@secchimribeiro
Copy link

Dear Dr. Warchal, thanks for the amazing tool! It has been helping me a lot!

As I am relatively new in coding, I wonder if it would be possible to highlight the border of specific wells (based on a separate variable, for exemple). I tried to modify the final plot using common ggplot2 functions, without success. I wonder if you ever had a similar issue.

Thanks a lot in advance for the feedback!

@Swarchal
Copy link
Author

Swarchal commented Sep 26, 2023

Hi Lucas,

It's possible (but ugly) to to this with ggplot functions.

My idea was to plot squares over the top of the wells with another geom_point() call, and set the stroke conditionally on another column in the dataframe.

library(platetools)
library(ggplot2)

# create example data with 10% wells highlighted
df <- data.frame(
    vals = rnorm(384),
    well = num_to_well(1:384, plate=384),
    highlight = sample(c(TRUE, FALSE), prob=c(0.1, 0.9), 384, replace=TRUE)
)

raw_map(
    data=df$vals,
    well=df$well,
    plate=384,
    size=5
) +
geom_point(
    aes(stroke=df$highlight),
    color="red",
    pch=22,
    size=5
) +
theme_dark()

image

@secchimribeiro
Copy link

Dear Dr. Warchal, thank you very much for the reply!
It worked quite nicely for me! I haven't thought about the stroke argument and it was, indeed, a very elegant solution!
Have a nice day!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment