Help with geom_dotplot() script
0
0
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!

enter image description here

# 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
)
dotplot ggplot • 1.0k views
ADD COMMENT
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

ADD REPLY
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.

ADD REPLY
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.

ADD REPLY
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

ADD REPLY
0
Entering edit mode

Thank you so much!

ADD REPLY

Login before adding your answer.

Traffic: 2756 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6