Entering edit mode
2.2 years 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
deconv <- read.csv("dtangle_VL_dataset.csv",
sep= ",",
header = TRUE,
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
)
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
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.
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.
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 whatgeom_dotplot
gives you.For a dot plot like Seurat
DotPlot
I usegeom_point
instead ofgeom_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.htmlThank you so much!