首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏育种数据分析之放飞自我

    ggplot2中 ggsave如何用?

    问题:我将ggsave应用在pipe %>%符号中,报错! grid.draw") : "grid.draw"没有适用于"c('LayerInstance', 'Layer', 'ggproto', 'gg')"目标对象的方法 ❞ 查阅了资料,ggplot2中调用ggsave ("plot2.png") 这里,直接用+连接ggsave,而不是%>%文件如下: ? 这里面,用()将ggplot作图的代码括住,它会输出到屏幕上,使用%>%将其作为对象传递给ggsave,用.表示它,写作ggsave("plot3.png",.),即可。 保存文件: ? 4. 之前作图,都是用png(),或者pdf(),调用,然后用dev.off()关掉保存,发现了ggsave保存图片很方便,真得很方便。就灌水文一篇。

    4.9K10发布于 2021-01-12
  • 来自专栏生信菜鸟团

    病毒感染相关单细胞文献复现-2

    sce <- RunUMAP(object = sce, dims = 1:15, do.fast = TRUE) DimPlot(sce,reduction = "umap",label=T) ggsave sce, resolution = 0.2) table(sce@meta.data$seurat_clusters) DimPlot(sce,reduction = "umap",label=T) ggsave p <- DotPlot(sce, features = unique(genes_to_check), assay='RNA' ) + coord_flip() p ggsave /check_RV_marker_by_seurat_cluster.pdf") p_umap<-DimPlot(sce,reduction = "umap",label=T ) p+p_umap ggsave split.by = "group",flip = T,stack = T,cols = c("red","grey"), split.plot =T );v1 ggsave

    36720编辑于 2023-09-09
  • 来自专栏文献分享及代码学习

    单细胞数据复现-肺癌文章代码复现6

    ("DimPlot_imm_Normal_Tumor.pdf", path = "output/fig4", width = 15, height = 15, units = "cm") #ggsave2 = 15, units = "cm") DimPlot(imm_anno, group.by = "patient_id", cols = use_colors, pt.size = 0.5) #ggsave2 (imm_anno, group.by = "cell_type_imm", split.by = "tissue_type", cols = use_colors, pt.size = 0.5) #ggsave2 theme(axis.text.x = element_text(angle = 90, hjust = 1)) + coord_flip() + scale_color_viridis() ggsave2 position = "fill") + scale_fill_manual(values = use_colors) + coord_flip() + scale_y_reverse() ggsave2

    67820编辑于 2022-05-23
  • 来自专栏单细胞天地

    单细胞转录组基础分析五:细胞再聚类

    ') write.csv(embed_tsne,'subcluster/embed_tsne.csv') plot1 = DimPlot(scRNAsub, reduction = "tsne") ggsave ("subcluster/tSNE.pdf", plot = plot1, width = 8, height = 7) ggsave("subcluster/tSNE.png", plot = plot1 ("subcluster/UMAP.pdf", plot = plot2, width = 8, height = 7) ggsave("subcluster/UMAP.png", plot = plot2 /tSNE_UMAP.pdf", plot = plotc, width = 10, height = 5) ggsave("subcluster/tSNE_UMAP.png", plot = plotc =7 ,height=6) ggsave("subcluster/celltype.pdf", p3, width=10 ,height=5) ggsave("subcluster/celltype.png

    8.2K35发布于 2020-09-04
  • 来自专栏生信菜鸟团

    对单细胞每个cluster进行批量富集分析

    ('degs_compareCluster-BP_enrichment--3.pdf',plot = p,width = 13,height = 40,limitsize = F) ggsave ('degs_compareCluster-CC_enrichment--3.pdf',plot = p,width = 13,height = 40,limitsize = F) ggsave ('degs_compareCluster-MF_enrichment--3.pdf',plot = p,width = 13,height = 40,limitsize = F) ggsave ('degs_compareCluster-GO_enrichment--3.pdf',plot = p,width = 13,height = 40,limitsize = F) ggsave ('degs_compareCluster-BP_enrichment--3.pdf',plot = p,width = 13,height = 40,limitsize = F) ggsave

    1.5K41编辑于 2023-09-24
  • 来自专栏育种数据分析之放飞自我

    R语言如何合并本地图片

    x = rnorm(100), y = rnorm(100) ) # 创建散点图 ggplot(df, aes(x=x, y=y)) + geom_point() + xlab("育种") ggsave ("plot1.tiff") ggplot(df, aes(x=x, y=y)) + geom_point() + xlab("数据") ggsave("plot2.tiff") ggplot(df , aes(x=x, y=y)) + geom_point() + xlab("分析") ggsave("plot3.tiff") ggplot(df, aes(x=x, y=y)) + geom_point () + xlab("之") ggsave("plot4.tiff") ggplot(df, aes(x=x, y=y)) + geom_point() + xlab("放飞") ggsave("plot5 .tiff") ggplot(df, aes(x=x, y=y)) + geom_point() + xlab("自我") ggsave("plot6.tiff") ## 读取 library(

    63310编辑于 2024-07-05
  • 来自专栏生信技能树

    cytof数据处理难点之细胞亚群继续分群

    : sce pro='Cd4-Tcells_sub' p <- plotExprs(sce, color_by = "condition") p$facet$params$ncol <- 3 p ggsave2 ) # PCA-based non-redundancy score (NRS) plotNRS(sce, features = "type", color_by = "condition") ggsave2 p2 <- p2 + theme(legend.position = "none") plot_grid(p1, p2, lgd, nrow = 1, rel_widths = c(5, 5, 2)) ggsave2 umap_vs_tSNE.pdf')) # facet by sample plotDR(sce, "TSNE", color_by = "meta10", facet_by = "sample_id") ggsave2 plotDR(sce, "UMAP", color_by = "meta8")) plotAbundances(sce, k = "meta10", by = "sample_id") ggsave2

    1.3K20发布于 2020-11-23
  • 来自专栏文献分享及代码学习

    单细胞数据复现-肺癌文章代码复现7

    = "tissue_type", cols.use = list(tissue_type = use_colors), draw.lines = F) + scale_fill_viridis()#ggsave2 ("HeatMap_Macro.pdf", path = "output/fig4", width = 30, height = 40, units = "cm")ggsave2("SuppFig7B.png /results", width = 30, height = 40, units = "cm")#ggsave2("HeatMap_Macro.emf", path = "output/fig4", ("HeatMap_T.pdf", path = "output/fig4", width = 30, height = 35, units = "cm")没有出来,怀疑是heatmap没有加载出来ggsave2 /results", width = 30, height = 35, units = "cm")#ggsave2("HeatMap_T.emf", path = "output/fig4", width

    86320编辑于 2022-06-09
  • 来自专栏文献分享及代码学习

    单细胞数据复现-肺癌文章代码复现4

    $gene, group.by = "patient_id", draw.lines = F, group.colors = use_colors) + scale_fill_viridis() ggsave2 ("HeatMap_Tumor.pdf", path = "output/fig2", width = 30, height = 30, units = "cm") ggsave2("Fig2C.png geom_bar(position = "fill", width = 0.75) + scale_fill_manual(values = use_colors) + coord_flip() ggsave2 = sample_id, values_from = avg) %>% column_to_rownames("Pathway") %>% as.matrix() ##这里画图的时候我发现还是ggsave ("DimHeatmap_epitumor_PC1.pdf", path = "output/fig2", width = 10, height = 20, units = "cm") ggsave2(

    1.2K20编辑于 2022-05-18
  • 来自专栏生信技能树

    (IF=14.5)11个高分杂志的scATAC-seq数据分析实战:GSE173682(paper代码学习)

    "log10(TSS Enrichment+1)"   ) + ggtitle(paste0("GMM classification:\n",i," log10(fragments)")) #+   ggsave  "log10(TSS Enrichment+1)"   ) + ggtitle(paste0("GMM classification:\n",i," TSS Enrichment"))  #+   ggsave log10(df.depth$proj.i.nFrags)),linetype = "dashed") +     ggtitle(paste0("QC thresholds:\n",i)) #+   ggsave df.depth$proj.i.nFrags)),linetype = "dashed") +     ggtitle(paste0("Doublet Enrichment:\n",i)) #+   ggsave = "log10(TSS Enrichment+1)"   ) + ggtitle(paste0("GMM classification:\n",i," log10(fragments)"))   ggsave

    32500编辑于 2025-06-09
  • 来自专栏单细胞天地

    单细胞转录组高级分析一:多样本合并与批次校正

    ("QC/vlnplot_before_qc.pdf", plot = violin, width = 12, height = 6) ggsave("QC/vlnplot_before_qc.png ("QC/vlnplot_after_qc.pdf", plot = violin, width = 12, height = 6) ggsave("QC/vlnplot_after_qc.png", ("CellType/tSNE_celltype_DICE.png", p4, width=7 ,height=6) ggsave("CellType/UMAP_celltype_DICE.png", p5, width=7 ,height=6) ggsave("CellType/celltype_DICE.png", p6, width=10 ,height=5) #对比两种数据库鉴定的结果 p8 = p1+p4 ggsave("CellType/Monaco_DICE.png", p8, width=12 ,height=5) ##保存数据 saveRDS(scRNA,'scRNA.rds')

    40.7K2131发布于 2020-09-04
  • 来自专栏生信菜鸟团

    免疫抑制剂-TNBC单细胞数据集聚类分群

    0.01, ncol = 3, same.y.lims=T) + scale_y_continuous(breaks=seq(0, 100, 5)) + NoLegend() p2 ggsave ) p3=FeatureScatter(sce.all, "nCount_RNA", "nFeature_RNA", group.by = "orig.ident", pt.size = 0.5) ggsave features = c("S.Score", "G2M.Score"), group.by = "orig.ident", ncol = 2, pt.size = 0.1) ggsave ) p1=VlnPlot(sce.all, features = feats, pt.size = 0, ncol = 2) + NoLegend() p1 library(ggplot2) ggsave = 0, ncol = 3, same.y.lims=T) + scale_y_continuous(breaks=seq(0, 100, 5)) + NoLegend() p2 ggsave

    78140编辑于 2023-09-09
  • 来自专栏小明的数据分析笔记本

    跟着Nature Microbiology学作图:R语言ggplot2做散点图添加拟合曲线和p值

    .]`, y=`mean Colonization [log10(CFU/mg)]`))+ geom_point(aes(color=Phylum))+ ggsave geom_smooth(method = "lm", formula = "y~x", se=F, color="grey")+ ggsave label=expression(italic(R)~"="~0.49~","~italic(P)~"="~5.4%*%10^-15), parse=T)+ ggsave 4.5, ymax = 7, alpha=0, color="black", lty="dashed")+ ggsave = element_blank())+ scale_fill_manual(values = colors)+ scale_color_manual(values = colors)+ ggsave

    1.5K40发布于 2021-12-01
  • 来自专栏单细胞天地

    单细胞转录组基础分析六:伪时间分析

    #排序 mycds <- orderCells(mycds) #State轨迹分布图 plot1 <- plot_cell_trajectory(mycds, color_by = "State") ggsave ("pseudotime/State.pdf", plot = plot1, width = 6, height = 5) ggsave("pseudotime/State.png", plot = plot1 ("pseudotime/Cluster.pdf", plot = plot2, width = 6, height = 5) ggsave("pseudotime/Cluster.png", plot ("pseudotime/Pseudotime.pdf", plot = plot3, width = 6, height = 5) ggsave("pseudotime/Pseudotime.png" ", plot = plotc, width = 10, height = 3.5) ggsave("pseudotime/Combination.png", plot = plotc, width =

    16.2K63发布于 2020-09-04
  • 来自专栏单细胞天地

    单细胞转录组基础分析八:可视化工具总结

    = "FCN1") p2 = RidgePlot(scRNA, features = "PC_2") plotc = p1/p2 + plot_layout(guides = 'collect') ggsave p2 = VlnPlot(scRNA, features = "CD8A", pt.size = 0) plotc = p1/p2 + plot_layout(guides = 'collect') ggsave , reduction = 'umap') p2 <- FeaturePlot(scRNA,features = "CD79A", reduction = 'umap') plotc = p1|p2 ggsave 点图 genelist = c('LYZ','CD79A','CD8A','CD8B','GZMB','FCGR3A') p = DotPlot(scRNA, features = genelist) ggsave - DimPlot(scRNA, reduction = 'umap', group.by = "seurat_clusters", label=T) plotc = (p1|p2)/(p3|p4) ggsave

    3.6K44发布于 2020-09-04
  • 来自专栏生信技能树

    鼻咽癌患者肿瘤部位和外周血的单细胞组成差异

    group.by = "orig.ident", features = feats, pt.size = 0.01, ncol = 2) + NoLegend() library(ggplot2) ggsave (filename="Vlnplot1.pdf",plot=p1) ggsave(filename="Vlnplot1.png",plot=p1) feats <- c("percent_mito", ) p3=FeatureScatter(sce.all, "nCount_RNA", "nFeature_RNA", group.by = "orig.ident", pt.size = 0.5) ggsave features = c("S.Score", "G2M.Score"), group.by = "orig.ident", ncol = 2, pt.size = 0.1) ggsave unique(genes_to_check), assay='RNA' ,group.by = 'seurat_clusters' ) + coord_flip() p ggsave

    1.2K40发布于 2021-04-29
  • 来自专栏单细胞天地

    单细胞分析十八般武艺7:CellChat

    pattern = "outgoing", k = nPatterns) # river plot p = netAnalysis_river(cellchat, pattern = "outgoing") ggsave pattern = "incoming", k = nPatterns) # river plot p = netAnalysis_river(cellchat, pattern = "incoming") ggsave = "functional") # Visualization in 2D-space p = netVisual_embedding(cellchat, type = "functional") ggsave custer_pathway_function.png", p, width = 9, height = 6) p = netVisual_embeddingZoomIn(cellchat, type = "functional") ggsave = "structural") # Visualization in 2D-space p = netVisual_embedding(cellchat, type = "structural") ggsave

    4.8K43发布于 2021-04-29
  • 来自专栏单细胞天地

    单细胞分析十八般武艺6:NicheNet

    p = DotPlot(scRNA, features = nichenet_output$top_ligands, split.by = "aggregate") + RotatedAxis() ggsave ## 查看配体调控靶基因 p = nichenet_output$ligand_target_heatmap ggsave("Heatmap_ligand-target.png", p, width = xlab("anti-LCMV response genes in CD8 T cells") + ylab("Prioritized immmune cell ligands") ggsave ## 查看受体情况 # 查看配体-受体互作 p = nichenet_output$ligand_receptor_heatmap ggsave("Heatmap_ligand-receptor.png the literature and not predicted based on PPI p = nichenet_output$ligand_receptor_heatmap_bonafide ggsave

    11K31发布于 2021-04-29
  • 来自专栏生信技能树

    cytofWorkflow之聚类分群(四)

    p2 <- p2 + theme(legend.position = "none") plot_grid(p1, p2, lgd, nrow = 1, rel_widths = c(5, 5, 2)) ggsave2 umap_vs_tSNE.pdf')) # facet by sample plotDR(sce, "TSNE", color_by = "meta20", facet_by = "sample_id") ggsave2 TSNE_by_samples.pdf')) # facet by condition plotDR(sce, "TSNE", color_by = "meta20", facet_by = "condition") ggsave2 plotDR(sce, "UMAP", color_by = "meta8")) plotAbundances(sce, k = "meta20", by = "sample_id") ggsave2 plotAbundances_barplot.pdf')) plotAbundances(sce, k = "meta20", by = "cluster_id", shape_by = "patient_id") ggsave2

    89210发布于 2020-11-19
  • 来自专栏生信技能树

    单细胞水平看小鼠胰腺导管腺癌进展中的细胞异质性

    p2_tree ggsave(p2_tree, filename = paste0(".. ----------- p1 <- DimPlot(sce.all,group.by = "celltype",label = T,reduction = "tsne",pt.size = 1.5) ggsave ------- p3 <- DimPlot(sce.all,group.by = "celltype",label = T,reduction = "tsne",pt.size = 1.5) p3 ggsave ------- p5 <- DimPlot(sce.all,group.by = "celltype",label = T,reduction = "tsne",pt.size = 1.5) p5 ggsave /picture/Annotation/figure3.Rdata") ps <- p1/p2|p3/p4|p5/p6 ps ggsave(ps,filename = "..

    1.2K10编辑于 2021-12-10
领券