Questions tagged [ggplot2]
Advanced R visualisation and plotting package based on the grammar of graphics. ggplot2 is also available in Python via 'plotnine' which uses ggplot2 code
83
questions
7
votes
1
answer
2k
views
Density plot, scale it to 0-1
Doubt regarding density plot what is the scale being plotted in the Y axis.Is it possible to scale it to 1?.
This is my code
...
7
votes
1
answer
12k
views
FeaturePlot from Seurat: change its title
FeaturePlot is a function in Seurat package.
And in the vignette it is written that if we specify parameter do.return = TRUE it ...
4
votes
1
answer
2k
views
How to enlarge a section of y-axis?
I am using ggplot2 to plot a scatter plot.
...
4
votes
2
answers
97
views
Arrange ggplot Figure for scRNA-seq data
I have generated a ggplot for 8 single-cell libraries, with the purpose of visualizing the tSNE facet plot by sample, colored by cell type -- with percentages. The best I could get to is this -
...
4
votes
1
answer
801
views
How to plot p-values in a circular barplot?
Im trying to plot reactome pathway in for of circular bar plot using ggplot2
my data
...
4
votes
1
answer
432
views
Plot to show the expression of genes between tumor and normal
I have RNA-seq raw counts data for 50 samples. 20 Normal and 30 tumor. After differential analysis I got 30 DEGs. I want to make a violin plot showing the expression of each gene. I transformed counts ...
3
votes
3
answers
6k
views
Mapping a list of cells in seurat featureplot
I have 209 cells, I clustered them by Seurat to 4 clusters. By Featureplot I am able to track a gene in clusters:
Higher color shows higher expression.
Now, for some genes I want to highlight some ...
3
votes
2
answers
1k
views
Changing a wide range of colours to a limited gradient
I returned a FeaturePlot from Seurat to ggplot. My plot has a weird range of colours as below
I produced this plot by this code
...
3
votes
1
answer
2k
views
How to set the position of groups in a Seurat object on a FeatureHeatmap plot
I am analysing singe cell sequence data and I have followed this tutorial, https://satijalab.org/seurat/pbmc3k_tutorial.html to perform QC and various differential analyses using the Seurat package on ...
3
votes
1
answer
3k
views
Percentage distribution of cells in all clusters based on their treatment condition?
I have 2151 cells, I clustered them by Seurat to 5 clusters. With the code below, I am able to have the number of cells per cluster and per condition:
...
3
votes
2
answers
5k
views
Separate boxplots for multiple violin plot
I am using the following function from seurat package to generate multiple violon plots and I am interested in adding box plots to them but it doesn't work when I have plotted different data at once.
...
3
votes
2
answers
5k
views
Which data is being used for violin plot?
Sorry I just got totally confused conceptually.
If this is my raw count data
Likely, Seurat divides each value by sum of the column afterward times by 10000.
which gives so
...
3
votes
1
answer
223
views
How to make bar bigger in UpsetR plot
I have tried to use UpsetR to visualize the input file which can be found here.
...
3
votes
1
answer
1k
views
Grouping x-axis in scatter plot
I am trying to plot one scatter plot for each group, where each group has continous values in x-axis.
Reference Data
Gives continuous x-axis but all groups are combined.
...
3
votes
1
answer
304
views
How do I prevent the FeatureHeatmap function from the Seurat package, from sorting my data groups in alphabetical order when plotting data?
How can I prevent a function from sorting my data groups (factors) in alphabetical order without affecting the integrity of the data? I am analysing single cell RNA sequencing data using Seurat 2.3.4. ...
3
votes
0
answers
448
views
Expending UpsetR plot with Orthofinder families and gene numbers
I can create an Upset plot with the input file, which can be found here
...
2
votes
2
answers
149
views
Display row and column names in R
I have plotted a heat-map with 235 rows and 570 columns which is below: how do we make clear names of row and columns on this graph using R?
2
votes
1
answer
110
views
Removing missing categories from geom_bar
I have a simple dataframe that includes points where the x values are 0, 1, 2, 3, 4, and 7. When I go to plot the data this is what ggplot2 gives me:
I only want to include the points mentioned above....
2
votes
1
answer
392
views
Plot information stored in dataframe within a tree (ggtree)
Hello to the entire Stackoverflow community!
I'm writing to you because I'm currently building a phylogeny with ggtree and I have in parallel a table like this one:
df :
...
2
votes
1
answer
3k
views
Pulling out a certain gene in a volcano plot
I have generated a volcano plot with a differential expression file.
Code for inputing file:
...
2
votes
1
answer
3k
views
Create a Grouped Barchart
I’m trying to create a Group Chart like this:
I have 7 classes for each of 4 species, not 5 like in the diagram. I want to build i diagram to show the distributions of the classes in each species
...
2
votes
1
answer
62
views
How can I find out the code DRIMSeq uses to make dmplotProportions objects?
I'm using DRIMSeq to do some analysis but I'd like to make my own figures from the results ideally using what they've done as a base.
I'm trying to find how they make their ggplot objects in the ...
2
votes
1
answer
855
views
How to change the position of groups colors in DimPlot of Seurat
I have a Seurat object and plotted the Dimplot for UMAP visualization for 2 variables, as shown in the image below.
Now, the problem is that I want the group by variables such as ...
2
votes
2
answers
1k
views
How to remove black outline from Seurat's VlnPlot violin plot
Using Seurat's VlnPlot, how can I remove the black outline around the violin plot?
For example, how can I change from the following graph with a (black) outline:
...
2
votes
1
answer
120
views
Multiple line chart
I am trying to create a multiple coloured line graph based on six lines.
Essentially I have data that identifies different units of vegetation by the variable” NDVI (vegetation index)” I want to ...
2
votes
1
answer
268
views
Question about the dots on Quartile groups in boxplot
I have Microarray Normalized Expression data for a specific Gene. It looks like below in a dataframe B
...
2
votes
1
answer
74
views
ggtree:How to keep leading zero ‘0’ in the tiplabel?
I am using ggtree to draw a phylogenetic tree.
Some taxa IDs have a 0 at the beginning.
However, when I plot the tiplabel the leading zero is automatically dropped. ...
2
votes
1
answer
109
views
Can I run dotPlotly from Rstudio?
I'd like to run dotPlotly from RStudio but I can't find any description/help for this. Is it at all possible?
Another side to this question: does anyone know any tool for dot plots for genome ...
2
votes
1
answer
314
views
How to plot stacked bar chart using R showing mean with range and labelled values?
I am trying to plot a stacked bar graph with mean values from multiple repeats, also showing the range of the data and values labelled.
My data frame is below:
...
2
votes
2
answers
4k
views
How do I add a colour annotation bar to the heatmap generated by DoHeatmap function of Seurat v2?
I am using Seurat v2 for professional reasons (I am aware of the availablity of Seurat v3). I am clustering and analysing single cell RNA seq data. How do I add a coloured annotation bar to the ...
2
votes
1
answer
2k
views
Plotting gene models - alternatives to ggbio
I am curious how people make genome track plots such as what can be done with the Bioconductor package ggbio.
For example this plot was made w/ ggbio:
I think ...
2
votes
0
answers
86
views
Pulling out genes in a scatterplot
I'm comparing gene expression among 2 different datasets (in vivo and in vitro) I have made a heatmap showing the correlation for each and then plotted the data frame to create a scatterplot. Now I ...
2
votes
0
answers
27
views
Calculating percent mouse cells per sample
I want to see the correlation between % mouse reads per sample vs % mouse cells per sample. I've already calculated the % mouse reads per sample but I'm stuck on calculating the % of mouse cells per ...
2
votes
0
answers
193
views
How to plot gene mutation frequencey in terms of percnatge alteration in samples?
I'm taking data from cbioportal of gene and their mutation frequency with percentage which I'm trying to categorize with various sub class.
The issue I'm facing is I have to plot it in mutation ...
1
vote
1
answer
90
views
A two color bar plot in R
I have raw read counts of miRNAs in two conditions like below
...
1
vote
1
answer
310
views
How to make a violin plot around quasirandom dots
I want to have a plot violin plot around quasirandom dots - like below
This is my data
...
1
vote
2
answers
3k
views
PCA plot in R coloured by sample type
I'm a biologist, not a programmer so please be gentle.
So I have a dataset that looks like
...
1
vote
2
answers
102
views
Grouping a set of genes in a ggplot object
I have a boolean matrix of mutated or non mutated genes across some samples
...
1
vote
1
answer
2k
views
Visualizing the difference among three groups
I have 3 data frames for three groups of patients and in each of them I have the number of mutation types like insertion, deletion, SNP and total of mutations for each patients. In each group I have ...
1
vote
1
answer
100
views
How to plot the gap distribution of contigs wrt to reference genome
I have a contigs file that I generated using Minia and then I have used Minimap2 to map these contigs again to the reference genome. Now I want to plot the gap distribution i.e. gap distance of the ...
1
vote
1
answer
6k
views
Seurat VlnPlot presenting expression of multiple genes in a single cluster
Seurat VlnPlots are most commonly used to visualize differences in any given gene expression across multiple clusters or cell types. For example:
...
1
vote
2
answers
6k
views
How do I increase the minimum dot size in Seurat's DotPlot function?
I want to use the DotPlot function from Seurat v3 to visualise the expression of some genes across clusters. However when the expression of a gene is zero or very low, the dot size is so small that it ...
1
vote
1
answer
77
views
Error in annotating row names as data points in a PCA plot
I made a PCA plot and was trying to plot the eigenvenctors in R so that each data point is actually the sample name. All the samples are in column 1. The following are the R commands I am using:
<...
1
vote
1
answer
431
views
Histogram of different classes of variables in one column [closed]
I have a basic ggplot2 R question. I have a dataframe in which data looks like this:
AA 4
AA 6
BB 6
AB 5
BA 4
AA 3
NN 2
AN 6
NN 5
AN 4
NA 3
BB 6
BN 5
NB 1
BN 7
...
1
vote
1
answer
86
views
stacked barplot with error bars
I need to create a barplot with error bars, my data consists of 2 groups called "Genot", with 3 sub-groups "Suberin" for each, associated with a value "Percent".
...
1
vote
1
answer
52
views
Intepreting and applying ordinal logistic regression coefficients to calculate probabilities?
Can someone help hint me how I can interpret ordinal logistic regression coefficients and how I can use the .L, .Q and .C terms to calculate probabilities? I am analysing a dataset, where people ...
1
vote
1
answer
79
views
Jitter violin coloured by sample id
I want to have a jitter violin coloured by sample ids but I get this weird plot
...
1
vote
1
answer
794
views
ggplot2 geom_bar() , do not merge y-values shared same x-ids [closed]
I am plotting a barplot using ggplot + geom_bar() function in R.
I have some the recoreds which share the same x-axis ...
1
vote
1
answer
56
views
A box plot of qualitative variables
I have 2 groups of patients; responders to chemotherapy and non-responders
I have calculated cancer cell fraction (CCF) of a set of driver genes (by variant allele frequency) for each group and I ...
1
vote
1
answer
698
views
How do I add external labels and connecting lines to a Ternary Plot in R?
I have plotted a triangular plot,that three dimensions of which represent three herbal strategies. One dimension represents the strategy of C (competitive plant), the second dimension “S” (stress ...