Swarchal / platetools

An R package for plotting microtitre plates
Other
54 stars 15 forks source link

Add option to overlay numeric values on grid visualizations #32

Closed HColeWarren closed 2 years ago

HColeWarren commented 2 years ago

Hey Scott,

I'm wondering if it's possible to include the actual value associated with the well in the final visualization. Like a heat map but with each well's value stamped on top of it.

Thanks, Cole

Swarchal commented 2 years ago

Hi Cole,

Yes you can add text to the plot with the usual ggplot functions like geom_text.

So for example:

library(platetools)
library(ggplot2)

df = data.frame(
    val = runif(96, 1, 10),
    well = num_to_well(1:96)
)

raw_map(df$val, df$well) +
    geom_text(aes(label=round(df$val))) +
    scale_fill_distiller()

image

However, you might have to play with the formatting and size of the label to make it fit well within the wells.

HColeWarren commented 2 years ago

Hey thanks for the quick response. That's super helpful!

Feel free to close this issue, or am I suppose to? This is the first issue I've ever submitted so I'm not sure if this was the right place to ask the question. Thanks again!

Swarchal commented 2 years ago

Not a problem, I'll close the issue.