Help with geom_dotplot() script
0
0
Entering edit mode
11 weeks ago
marina.wakid ▴ 10

I'm rather new to R so any help would be much appreciated. Does someone know how to adjust the following script so that I can present a dot plot with these sort of deconvolution proportions? I can't seem to make it work.

Many thanks!

# read in the Subject*Counts (raw counts) matrix
sep= ",",
row.names=1,
stringsAsFactors = F)

geom_dotplot(data = deconv,
position = "identity",
binwidth = NULL,
binaxis = "x",
method = "dotdensity",
binpositions = "bygroup",
stackdir = "up",
stackratio = 1,
dotsize = 1,
stackgroups = FALSE,
origin = NULL,
right = TRUE,
width = 0.9,
drop = FALSE,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)

dotplot ggplot • 346 views
2
Entering edit mode

You need to always put ggplot() first in order to construct the initial object that your geoms etc are placed on. So just put 'ggplot()+' before geom_dotplot

1
Entering edit mode

are you sure that you want a ggplot dot plot and not something more like the Seurat dot plots seen at https://satijalab.org/seurat/reference/dotplot?

Else, is there an error that you are getting when running the above code? It will be helpful to know in order to troubleshoot.

0
Entering edit mode

would I be able to create a Seurat object with the table I've shown above? I obtained these numbers by feeding normalized counts into a deconvolution shiny app so the above table is all I have to work with.

1
Entering edit mode

I was not trying to suggest that you use the Seurat DotPlot function for making your plot. I only referenced Seurat as an example dot plot that seemed more like what you are looking for than what geom_dotplot gives you.

For a dot plot like Seurat DotPlot I use geom_point instead of geom_dotplot and set the point color and point size to a continuous value.

Also note, to use ggplot2 your table above will need to be reformatted from wide to long, see https://tidyr.tidyverse.org/reference/pivot_longer.html

0
Entering edit mode

Thank you so much!