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

Filter by
Sorted by
Tagged with
2 votes
1 answer
27 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. ...
user avatar
  • 81
0 votes
1 answer
53 views

Violin plots appear as vertical lines

I want to perform a violin plot from a Seurat object and I rather have vertical lines. How can I stop this and rather have a standard Violin plot? code ...
user avatar
  • 497
3 votes
1 answer
48 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. ...
user avatar
  • 345
2 votes
0 answers
55 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 ...
user avatar
  • 319
1 vote
1 answer
75 views

A two color bar plot in R

I have raw read counts of miRNAs in two conditions like below ...
user avatar
  • 1,617
4 votes
2 answers
58 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 - ...
user avatar
  • 51
2 votes
0 answers
24 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 ...
user avatar
  • 319
0 votes
2 answers
293 views

ViolinPlot x-axis

I'm trying to set the x-axis in my Violin Plot to go by each patient rather than it being scattered. ...
user avatar
  • 319
1 vote
1 answer
43 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 ...
user avatar
1 vote
1 answer
35 views

Barplot without alphabetizing x-axis

I'm inputting a .csv file and then plotting a barplot based on the colnames but when I go plot the order the names are being alphabetized rather than get the order that is in the .csv file. How to I ...
user avatar
  • 319
1 vote
2 answers
944 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 ...
user avatar
-1 votes
1 answer
98 views

Multiple box plot

I am using below code to plot multiple box plot but I am still struggling to understand how I can add whisker to box plot and how to change sample order like in this figure SampleType? ...
user avatar
1 vote
0 answers
32 views

How to call this : some dots in volcano plot aligned a line after add a very small value to padj

when I plotting the volcano plot, I got some dots very top of the Y-axis because their padj nearly reached 0(I checked the data, I think they are reliable), so I followed the advice to add a very ...
user avatar
  • 13
1 vote
1 answer
387 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 ...
user avatar
  • 81
2 votes
1 answer
134 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 : ...
user avatar
0 votes
1 answer
41 views

Very low probability densities

I'm generating a density plot using the ggplot2 library: ...
user avatar
  • 353
0 votes
1 answer
695 views

Getting weird plot with ggpubr package

I have a data frame for two groups and 9 variables ...
user avatar
  • 1,617
1 vote
2 answers
89 views

Grouping a set of genes in a ggplot object

I have a boolean matrix of mutated or non mutated genes across some samples ...
user avatar
  • 1,617
-4 votes
1 answer
63 views

How to visualise the proportion of clonal genes to sub clonal genes [duplicate]

I have a data frame ...
user avatar
  • 1,617
-4 votes
1 answer
72 views

Attempting to generate a heat map like in this figure [closed]

I have a data frame ...
user avatar
  • 1,617
1 vote
1 answer
46 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 ...
user avatar
  • 1,617
0 votes
1 answer
72 views

Griding ggplot object in r

I have this data frame head(d) ...
user avatar
  • 1,617
-1 votes
1 answer
97 views

Showing name of genes in boxplot

I have a long format data frame like this ...
user avatar
  • 1,617
0 votes
2 answers
62 views

Clustered column chart for single cell data

I want to create a column plot for my single cell analysis that has 2 sample types, a normal and PDAC. I want to show, the percentage of different cell types per sample type. How do I go about ...
user avatar
  • 319
1 vote
1 answer
1k 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 ...
user avatar
  • 1,617
0 votes
2 answers
710 views

Making a volcano plot look less cluttered

I have generated a volcano plot with a differential expression file. Code for inputing file: ...
user avatar
  • 319
0 votes
1 answer
108 views

Bar plot with error bars

I am trying to plot a box plot/stacked bar graph with error bars. output of dput(DF) ...
user avatar
  • 319
0 votes
1 answer
45 views

Dodged bar chart

I want to create a dodged barchart with different cell cycles for each cell type within each condition. dput(DF_count) ...
user avatar
  • 319
2 votes
1 answer
2k 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: ...
user avatar
  • 319
0 votes
1 answer
4k views

stacked bargraph with error bars

I'm attempting to plot a stacked barplot with ggplot2 with this code: ...
user avatar
-1 votes
2 answers
331 views

Making a boxplot or violinplot for several dataframe with different number of samples

I have 3 data frames for treatment of 3 different drugs 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 ...
user avatar
  • 1,617
0 votes
1 answer
279 views

Stacked barplot for single cell analysis

I want to create a stacked bar-graph with different cell cycles for each cell type within each condition. I have uploaded the file for it. Don't know how to go about it as now I have another condition ...
user avatar
0 votes
3 answers
127 views

Boxplot of read length distributions from multiple samples

Newbie R user here. I want to create a plot with boxplots of read length distribution on the Y-axis, and samples on the X-axis -- like this image from doi: 10.1038/srep16498 However, I'm not sure ...
user avatar
  • 3
7 votes
1 answer
709 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 ...
user avatar
  • 1,640
0 votes
1 answer
4k 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: ...
user avatar
  • 149
1 vote
2 answers
3k 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 ...
user avatar
  • 497
0 votes
1 answer
240 views

Customizing colors in geom_arc_bar (ggforce)

I am trying to plot scatter plot of pie charts using ggplot2 and ggforce. Following is my code ...
user avatar
  • 345
0 votes
1 answer
1k views

Changing the axis limits of ggplot objects

By EnhancedVolcano R package I have this plot with this code ...
user avatar
  • 1,617
2 votes
1 answer
2k 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 ...
user avatar
  • 364
2 votes
1 answer
109 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 ...
user avatar
1 vote
1 answer
501 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 ...
user avatar
1 vote
0 answers
179 views

How can I correctly get 3D scatter plot for micro-array pheno data in R [updated]?

I intend to see data points distribution (each reows) within labeled groups (different batchs such as 1,2,3, and so on) in 3D scatter plot, because I want to see the distribution of the data points ...
user avatar
  • 133
2 votes
2 answers
3k 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 ...
user avatar
  • 497
1 vote
0 answers
90 views

Missing lower IQR in boxplot [closed]

Im not able to figure it out why the lower quartile of the two data points missing. Data Code ...
user avatar
  • 1,640
3 votes
1 answer
2k 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: ...
user avatar
  • 497
3 votes
1 answer
217 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. ...
user avatar
  • 497
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 ...
user avatar
  • 497
3 votes
2 answers
3k 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. ...
user avatar
  • 33
4 votes
1 answer
694 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 ...
user avatar
  • 1,640
2 votes
0 answers
132 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 ...
user avatar
  • 1,640