将圆形箱线图中的数据与灰色同心圆对齐

问题描述 投票:0回答:1

我花了一些时间尝试修改以下代码,使每个变量的数据与每个灰色同心圆对齐。 enter image description here 这是我的最后一篇文章(将灰色同心圆添加到圆形箱线图背景),与这个问题相关,但现在我添加了两个变量,它们与我已成功添加到图中的两个额外灰色同心圆不对齐.

这是我的数据:

dput(BAT_sample)
structure(list(sample = c("BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", "BAT", 
"BAT"), process = c("Cell_cycle", "Cell_cycle", "Cell_cycle", 
"Cell_cycle", "Cell_cycle", "Cell_cycle", "Cell_cycle", "Cell_cycle", 
"Cell_cycle", "Cell_cycle", "Cell_cycle", "Cell_cycle", "ECM", 
"ECM", "ECM", "ECM", "ECM", "ECM", "ECM", "ECM", "ECM", "ECM", 
"ECM", "ECM", "ECM", "ECM", "ECM", "Immune", "Immune", "Immune", 
"Immune", "Immune", "Immune", "Immune", "Immune", "Immune", "Immune", 
"Immune", "Immune", "Immune", "Localization", "Localization", 
"Localization", "Localization", "Localization", "Localization", 
"Localization", "Localization", "Localization", "Localization", 
"Localization", "Localization", "Localization", "Localization", 
"Localization", "Localization", "Localization", "Localization", 
"Localization", "Localization", "Localization", "Localization", 
"Localization", "Localization", "Localization", "Localization", 
"Localization", "Localization", "Metabolism", "Metabolism", "Metabolism", 
"Metabolism", "Metabolism", "Metabolism", "Metabolism", "Metabolism", 
"Metabolism", "Metabolism", "Metabolism", "Metabolism", "Signaling", 
"Signaling", "Signaling", "Signaling", "Signaling", "Signaling", 
"Signaling", "Signaling", "Signaling", "Signaling", "Signaling", 
"Signaling", "Transcription", "Transcription", "Transcription", 
"Transcription", "Transcription", "Transcription", "Transcription", 
"Transcription", "Translation", "Translation", "Translation", 
"Translation", "Translation"), pathway = c("REACTOME_M_PHASE", 
"REACTOME_MITOTIC_G1_PHASE_AND_G1_S_TRANSITION", "REACTOME_MITOTIC_G2_G2_M_PHASES", 
"REACTOME_MITOTIC_METAPHASE_AND_ANAPHASE", "REACTOME_MITOTIC_PROMETAPHASE", 
"REACTOME_MITOTIC_PROPHASE", "REACTOME_MITOTIC_SPINDLE_CHECKPOINT", 
"REACTOME_RECOGNITION_OF_DNA_DAMAGE_BY_PCNA_CONTAINING_REPLICATION_COMPLEX", 
"REACTOME_RECRUITMENT_OF_NUMA_TO_MITOTIC_CENTROSOMES", "REACTOME_RESOLUTION_OF_SISTER_CHROMATID_COHESION", 
"REACTOME_S_PHASE", "REACTOME_TP53_REGULATES_TRANSCRIPTION_OF_DNA_REPAIR_GENES", 
"HALLMARK_EPITHELIAL_MESENCHYMAL_TRANSITION", "KEGG_CELL_ADHESION_MOLECULES_CAMS", 
"KEGG_ECM_RECEPTOR_INTERACTION", "KEGG_FOCAL_ADHESION", "REACTOME_ANCHORING_OF_THE_BASAL_BODY_TO_THE_PLASMA_MEMBRANE", 
"REACTOME_CELL_CELL_COMMUNICATION", "REACTOME_COLLAGEN_BIOSYNTHESIS_AND_MODIFYING_ENZYMES", 
"REACTOME_COLLAGEN_CHAIN_TRIMERIZATION", "REACTOME_COLLAGEN_DEGRADATION", 
"REACTOME_COLLAGEN_FORMATION", "REACTOME_DEGRADATION_OF_THE_EXTRACELLULAR_MATRIX", 
"REACTOME_ECM_PROTEOGLYCANS", "REACTOME_EXTRACELLULAR_MATRIX_ORGANIZATION", 
"REACTOME_INTEGRIN_CELL_SURFACE_INTERACTIONS", "REACTOME_NCAM1_INTERACTIONS", 
"HALLMARK_HYPOXIA", "HALLMARK_IL2_STAT5_SIGNALING", "HALLMARK_INTERFERON_ALPHA_RESPONSE", 
"HALLMARK_TGF_BETA_SIGNALING", "KEGG_ADIPOCYTOKINE_SIGNALING_PATHWAY", 
"KEGG_ALZHEIMERS_DISEASE", "KEGG_APOPTOSIS", "KEGG_BLADDER_CANCER", 
"KEGG_CHEMOKINE_SIGNALING_PATHWAY", "KEGG_CHRONIC_MYELOID_LEUKEMIA", 
"KEGG_GLIOMA", "KEGG_HUNTINGTONS_DISEASE", "REACTOME_TOLL_LIKE_RECEPTOR_CASCADES", 
"HALLMARK_PROTEIN_SECRETION", "HALLMARK_UNFOLDED_PROTEIN_RESPONSE", 
"KEGG_ENDOCYTOSIS", "KEGG_LYSOSOME", "KEGG_SNARE_INTERACTIONS_IN_VESICULAR_TRANSPORT", 
"KEGG_UBIQUITIN_MEDIATED_PROTEOLYSIS", "REACTOME_CLATHRIN_MEDIATED_ENDOCYTOSIS", 
"REACTOME_COPI_DEPENDENT_GOLGI_TO_ER_RETROGRADE_TRAFFIC", "REACTOME_COPI_MEDIATED_ANTEROGRADE_TRANSPORT", 
"REACTOME_COPII_MEDIATED_VESICLE_TRANSPORT", "REACTOME_ENDOSOMAL_SORTING_COMPLEX_REQUIRED_FOR_TRANSPORT_ESCRT", 
"REACTOME_ER_TO_GOLGI_ANTEROGRADE_TRANSPORT", "REACTOME_GOLGI_TO_ER_RETROGRADE_TRANSPORT", 
"REACTOME_INTRA_GOLGI_AND_RETROGRADE_GOLGI_TO_ER_TRAFFIC", "REACTOME_INTRA_GOLGI_TRAFFIC", 
"REACTOME_LYSOSOME_VESICLE_BIOGENESIS", "REACTOME_MEMBRANE_TRAFFICKING", 
"REACTOME_POST_TRANSLATIONAL_PROTEIN_MODIFICATION", "REACTOME_PROTEIN_LOCALIZATION", 
"REACTOME_RAB_GEFS_EXCHANGE_GTP_FOR_GDP_ON_RABS", "REACTOME_RAB_GERANYLGERANYLATION", 
"REACTOME_RAB_REGULATION_OF_TRAFFICKING", "REACTOME_TBC_RABGAPS", 
"REACTOME_TRANS_GOLGI_NETWORK_VESICLE_BUDDING", "REACTOME_TRANSPORT_OF_MATURE_TRANSCRIPT_TO_CYTOPLASM", 
"REACTOME_TRANSPORT_TO_THE_GOLGI_AND_SUBSEQUENT_MODIFICATION", 
"REACTOME_VEGFR2_MEDIATED_VASCULAR_PERMEABILITY", "REACTOME_VESICLE_MEDIATED_TRANSPORT", 
"HALLMARK_CHOLESTEROL_HOMEOSTASIS", "HALLMARK_GLYCOLYSIS", "HALLMARK_OXIDATIVE_PHOSPHORYLATION", 
"KEGG_AMINOACYL_TRNA_BIOSYNTHESIS", "KEGG_CITRATE_CYCLE_TCA_CYCLE", 
"KEGG_FATTY_ACID_METABOLISM", "KEGG_GLYCEROPHOSPHOLIPID_METABOLISM", 
"KEGG_OXIDATIVE_PHOSPHORYLATION", "KEGG_PURINE_METABOLISM", "KEGG_PYRIMIDINE_METABOLISM", 
"KEGG_STEROID_BIOSYNTHESIS", "REACTOME_CHOLESTEROL_BIOSYNTHESIS", 
"HALLMARK_KRAS_SIGNALING_UP", "REACTOME_CDC42_GTPASE_CYCLE", 
"REACTOME_INTRACELLULAR_SIGNALING_BY_SECOND_MESSENGERS", "REACTOME_RAC1_GTPASE_CYCLE", 
"REACTOME_RAC2_GTPASE_CYCLE", "REACTOME_RAC3_GTPASE_CYCLE", "REACTOME_RAS_PROCESSING", 
"REACTOME_REGULATION_OF_RAS_BY_GAPS", "REACTOME_RHO_GTPASE_CYCLE", 
"REACTOME_RHO_GTPASE_EFFECTORS", "REACTOME_RHO_GTPASES_ACTIVATE_FORMINS", 
"REACTOME_RHOA_GTPASE_CYCLE", "KEGG_RNA_POLYMERASE", "KEGG_SPLICEOSOME", 
"REACTOME_ACTIVATION_OF_THE_MRNA_UPON_BINDING_OF_THE_CAP_BINDING_COMPLEX_AND_EIFS_AND_SUBSEQUENT_BINDING_TO_43S", 
"REACTOME_FORMATION_OF_RNA_POL_II_ELONGATION_COMPLEX", "REACTOME_FORMATION_OF_TC_NER_PRE_INCISION_COMPLEX", 
"REACTOME_FORMATION_OF_THE_EARLY_ELONGATION_COMPLEX", "REACTOME_GENE_EXPRESSION_TRANSCRIPTION", 
"REACTOME_GENERIC_TRANSCRIPTION_PATHWAY", "KEGG_RIBOSOME", "REACTOME_EUKARYOTIC_TRANSLATION_INITIATION", 
"REACTOME_FORMATION_OF_A_POOL_OF_FREE_40S_SUBUNITS", "REACTOME_MITOCHONDRIAL_TRANSLATION", 
"REACTOME_TRANSLATION"), label = c("BAT_REACTOME_M_PHASE(390)", 
"BAT_REACTOME_MITOTIC_G1_PHASE_AND_G1_S_TRANSITION(130)", "BAT_REACTOME_MITOTIC_G2_G2_M_PHASES(183)", 
"BAT_REACTOME_MITOTIC_METAPHASE_AND_ANAPHASE(225)", "BAT_REACTOME_MITOTIC_PROMETAPHASE(193)", 
"BAT_REACTOME_MITOTIC_PROPHASE(121)", "BAT_REACTOME_MITOTIC_SPINDLE_CHECKPOINT(111)", 
"BAT_REACTOME_RECOGNITION_OF_DNA_DAMAGE_BY_PCNA_CONTAINING_REPLICATION_COMPLEX(30)", 
"BAT_REACTOME_RECRUITMENT_OF_NUMA_TO_MITOTIC_CENTROSOMES(88)", 
"BAT_REACTOME_RESOLUTION_OF_SISTER_CHROMATID_COHESION(122)", 
"BAT_REACTOME_S_PHASE(148)", "BAT_REACTOME_TP53_REGULATES_TRANSCRIPTION_OF_DNA_REPAIR_GENES(43)", 
"BAT_HALLMARK_EPITHELIAL_MESENCHYMAL_TRANSITION(194)", "BAT_KEGG_CELL_ADHESION_MOLECULES_CAMS(127)", 
"BAT_KEGG_ECM_RECEPTOR_INTERACTION(83)", "BAT_KEGG_FOCAL_ADHESION(197)", 
"BAT_REACTOME_ANCHORING_OF_THE_BASAL_BODY_TO_THE_PLASMA_MEMBRANE(95)", 
"BAT_REACTOME_CELL_CELL_COMMUNICATION(88)", "BAT_REACTOME_COLLAGEN_BIOSYNTHESIS_AND_MODIFYING_ENZYMES(65)", 
"BAT_REACTOME_COLLAGEN_CHAIN_TRIMERIZATION(37)", "BAT_REACTOME_COLLAGEN_DEGRADATION(55)", 
"BAT_REACTOME_COLLAGEN_FORMATION(77)", "BAT_REACTOME_DEGRADATION_OF_THE_EXTRACELLULAR_MATRIX(108)", 
"BAT_REACTOME_ECM_PROTEOGLYCANS(47)", "BAT_REACTOME_EXTRACELLULAR_MATRIX_ORGANIZATION(246)", 
"BAT_REACTOME_INTEGRIN_CELL_SURFACE_INTERACTIONS(73)", "BAT_REACTOME_NCAM1_INTERACTIONS(17)", 
"BAT_HALLMARK_HYPOXIA(199)", "BAT_HALLMARK_IL2_STAT5_SIGNALING(199)", 
"BAT_HALLMARK_INTERFERON_ALPHA_RESPONSE(94)", "BAT_HALLMARK_TGF_BETA_SIGNALING(53)", 
"BAT_KEGG_ADIPOCYTOKINE_SIGNALING_PATHWAY(67)", "BAT_KEGG_ALZHEIMERS_DISEASE(161)", 
"BAT_KEGG_APOPTOSIS(82)", "BAT_KEGG_BLADDER_CANCER(41)", "BAT_KEGG_CHEMOKINE_SIGNALING_PATHWAY(175)", 
"BAT_KEGG_CHRONIC_MYELOID_LEUKEMIA(73)", "BAT_KEGG_GLIOMA(64)", 
"BAT_KEGG_HUNTINGTONS_DISEASE(173)", "BAT_REACTOME_TOLL_LIKE_RECEPTOR_CASCADES(146)", 
"BAT_HALLMARK_PROTEIN_SECRETION(94)", "BAT_HALLMARK_UNFOLDED_PROTEIN_RESPONSE(111)", 
"BAT_KEGG_ENDOCYTOSIS(180)", "BAT_KEGG_LYSOSOME(119)", "BAT_KEGG_SNARE_INTERACTIONS_IN_VESICULAR_TRANSPORT(36)", 
"BAT_KEGG_UBIQUITIN_MEDIATED_PROTEOLYSIS(132)", "BAT_REACTOME_CLATHRIN_MEDIATED_ENDOCYTOSIS(141)", 
"BAT_REACTOME_COPI_DEPENDENT_GOLGI_TO_ER_RETROGRADE_TRAFFIC(96)", 
"BAT_REACTOME_COPI_MEDIATED_ANTEROGRADE_TRANSPORT(95)", "BAT_REACTOME_COPII_MEDIATED_VESICLE_TRANSPORT(68)", 
"BAT_REACTOME_ENDOSOMAL_SORTING_COMPLEX_REQUIRED_FOR_TRANSPORT_ESCRT(31)", 
"BAT_REACTOME_ER_TO_GOLGI_ANTEROGRADE_TRANSPORT(148)", "BAT_REACTOME_GOLGI_TO_ER_RETROGRADE_TRANSPORT(129)", 
"BAT_REACTOME_INTRA_GOLGI_AND_RETROGRADE_GOLGI_TO_ER_TRAFFIC(187)", 
"BAT_REACTOME_INTRA_GOLGI_TRAFFIC(37)", "BAT_REACTOME_LYSOSOME_VESICLE_BIOGENESIS(34)", 
"BAT_REACTOME_MEMBRANE_TRAFFICKING(562)", "BAT_REACTOME_POST_TRANSLATIONAL_PROTEIN_MODIFICATION(1310)", 
"BAT_REACTOME_PROTEIN_LOCALIZATION(103)", "BAT_REACTOME_RAB_GEFS_EXCHANGE_GTP_FOR_GDP_ON_RABS(89)", 
"BAT_REACTOME_RAB_GERANYLGERANYLATION(62)", "BAT_REACTOME_RAB_REGULATION_OF_TRAFFICKING(115)", 
"BAT_REACTOME_TBC_RABGAPS(34)", "BAT_REACTOME_TRANS_GOLGI_NETWORK_VESICLE_BUDDING(71)", 
"BAT_REACTOME_TRANSPORT_OF_MATURE_TRANSCRIPT_TO_CYTOPLASM(79)", 
"BAT_REACTOME_TRANSPORT_TO_THE_GOLGI_AND_SUBSEQUENT_MODIFICATION(178)", 
"BAT_REACTOME_VEGFR2_MEDIATED_VASCULAR_PERMEABILITY(29)", "BAT_REACTOME_VESICLE_MEDIATED_TRANSPORT(709)", 
"BAT_HALLMARK_CHOLESTEROL_HOMEOSTASIS(71)", "BAT_HALLMARK_GLYCOLYSIS(200)", 
"BAT_HALLMARK_OXIDATIVE_PHOSPHORYLATION(195)", "BAT_KEGG_AMINOACYL_TRNA_BIOSYNTHESIS(41)", 
"BAT_KEGG_CITRATE_CYCLE_TCA_CYCLE(30)", "BAT_KEGG_FATTY_ACID_METABOLISM(40)", 
"BAT_KEGG_GLYCEROPHOSPHOLIPID_METABOLISM(76)", "BAT_KEGG_OXIDATIVE_PHOSPHORYLATION(128)", 
"BAT_KEGG_PURINE_METABOLISM(157)", "BAT_KEGG_PYRIMIDINE_METABOLISM(96)", 
"BAT_KEGG_STEROID_BIOSYNTHESIS(17)", "BAT_REACTOME_CHOLESTEROL_BIOSYNTHESIS(28)", 
"BAT_HALLMARK_KRAS_SIGNALING_UP(198)", "BAT_REACTOME_CDC42_GTPASE_CYCLE(94)", 
"BAT_REACTOME_INTRACELLULAR_SIGNALING_BY_SECOND_MESSENGERS(260)", 
"BAT_REACTOME_RAC1_GTPASE_CYCLE(172)", "BAT_REACTOME_RAC2_GTPASE_CYCLE(85)", 
"BAT_REACTOME_RAC3_GTPASE_CYCLE(91)", "BAT_REACTOME_RAS_PROCESSING(29)", 
"BAT_REACTOME_REGULATION_OF_RAS_BY_GAPS(67)", "BAT_REACTOME_RHO_GTPASE_CYCLE(421)", 
"BAT_REACTOME_RHO_GTPASE_EFFECTORS(245)", "BAT_REACTOME_RHO_GTPASES_ACTIVATE_FORMINS(135)", 
"BAT_REACTOME_RHOA_GTPASE_CYCLE(141)", "BAT_KEGG_RNA_POLYMERASE(27)", 
"BAT_KEGG_SPLICEOSOME(123)", "BAT_REACTOME_ACTIVATION_OF_THE_MRNA_UPON_BINDING_OF_THE_CAP_BINDING_COMPLEX_AND_EIFS_AND_SUBSEQUENT_BINDING_TO_43S(60)", 
"BAT_REACTOME_FORMATION_OF_RNA_POL_II_ELONGATION_COMPLEX(55)", 
"BAT_REACTOME_FORMATION_OF_TC_NER_PRE_INCISION_COMPLEX(53)", 
"BAT_REACTOME_FORMATION_OF_THE_EARLY_ELONGATION_COMPLEX(32)", 
"BAT_REACTOME_GENE_EXPRESSION_TRANSCRIPTION(1061)", "BAT_REACTOME_GENERIC_TRANSCRIPTION_PATHWAY(842)", 
"BAT_KEGG_RIBOSOME(84)", "BAT_REACTOME_EUKARYOTIC_TRANSLATION_INITIATION(118)", 
"BAT_REACTOME_FORMATION_OF_A_POOL_OF_FREE_40S_SUBUNITS(100)", 
"BAT_REACTOME_MITOCHONDRIAL_TRANSLATION(89)", "BAT_REACTOME_TRANSLATION(227)"
), label2 = c("REACTOME_M_PHASE(390)", "REACTOME_MITOTIC_G1_PHASE_AND_G1_S_TRANSITION(130)", 
"REACTOME_MITOTIC_G2_G2_M_PHASES(183)", "REACTOME_MITOTIC_METAPHASE_AND_ANAPHASE(225)", 
"REACTOME_MITOTIC_PROMETAPHASE(193)", "REACTOME_MITOTIC_PROPHASE(121)", 
"REACTOME_MITOTIC_SPINDLE_CHECKPOINT(111)", "REACTOME_RECOGNITION_OF_DNA_DAMAGE_BY_PCNA_CONTAINING_REPLICATION_COMPLEX(30)", 
"REACTOME_RECRUITMENT_OF_NUMA_TO_MITOTIC_CENTROSOMES(88)", "REACTOME_RESOLUTION_OF_SISTER_CHROMATID_COHESION(122)", 
"REACTOME_S_PHASE(148)", "REACTOME_TP53_REGULATES_TRANSCRIPTION_OF_DNA_REPAIR_GENES(43)", 
"HALLMARK_EPITHELIAL_MESENCHYMAL_TRANSITION(194)", "KEGG_CELL_ADHESION_MOLECULES_CAMS(127)", 
"KEGG_ECM_RECEPTOR_INTERACTION(83)", "KEGG_FOCAL_ADHESION(197)", 
"REACTOME_ANCHORING_OF_THE_BASAL_BODY_TO_THE_PLASMA_MEMBRANE(95)", 
"REACTOME_CELL_CELL_COMMUNICATION(88)", "REACTOME_COLLAGEN_BIOSYNTHESIS_AND_MODIFYING_ENZYMES(65)", 
"REACTOME_COLLAGEN_CHAIN_TRIMERIZATION(37)", "REACTOME_COLLAGEN_DEGRADATION(55)", 
"REACTOME_COLLAGEN_FORMATION(77)", "REACTOME_DEGRADATION_OF_THE_EXTRACELLULAR_MATRIX(108)", 
"REACTOME_ECM_PROTEOGLYCANS(47)", "REACTOME_EXTRACELLULAR_MATRIX_ORGANIZATION(246)", 
"REACTOME_INTEGRIN_CELL_SURFACE_INTERACTIONS(73)", "REACTOME_NCAM1_INTERACTIONS(17)", 
"HALLMARK_HYPOXIA(199)", "HALLMARK_IL2_STAT5_SIGNALING(199)", 
"HALLMARK_INTERFERON_ALPHA_RESPONSE(94)", "HALLMARK_TGF_BETA_SIGNALING(53)", 
"KEGG_ADIPOCYTOKINE_SIGNALING_PATHWAY(67)", "KEGG_ALZHEIMERS_DISEASE(161)", 
"KEGG_APOPTOSIS(82)", "KEGG_BLADDER_CANCER(41)", "KEGG_CHEMOKINE_SIGNALING_PATHWAY(175)", 
"KEGG_CHRONIC_MYELOID_LEUKEMIA(73)", "KEGG_GLIOMA(64)", "KEGG_HUNTINGTONS_DISEASE(173)", 
"REACTOME_TOLL_LIKE_RECEPTOR_CASCADES(146)", "HALLMARK_PROTEIN_SECRETION(94)", 
"HALLMARK_UNFOLDED_PROTEIN_RESPONSE(111)", "KEGG_ENDOCYTOSIS(180)", 
"KEGG_LYSOSOME(119)", "KEGG_SNARE_INTERACTIONS_IN_VESICULAR_TRANSPORT(36)", 
"KEGG_UBIQUITIN_MEDIATED_PROTEOLYSIS(132)", "REACTOME_CLATHRIN_MEDIATED_ENDOCYTOSIS(141)", 
"REACTOME_COPI_DEPENDENT_GOLGI_TO_ER_RETROGRADE_TRAFFIC(96)", 
"REACTOME_COPI_MEDIATED_ANTEROGRADE_TRANSPORT(95)", "REACTOME_COPII_MEDIATED_VESICLE_TRANSPORT(68)", 
"REACTOME_ENDOSOMAL_SORTING_COMPLEX_REQUIRED_FOR_TRANSPORT_ESCRT(31)", 
"REACTOME_ER_TO_GOLGI_ANTEROGRADE_TRANSPORT(148)", "REACTOME_GOLGI_TO_ER_RETROGRADE_TRANSPORT(129)", 
"REACTOME_INTRA_GOLGI_AND_RETROGRADE_GOLGI_TO_ER_TRAFFIC(187)", 
"REACTOME_INTRA_GOLGI_TRAFFIC(37)", "REACTOME_LYSOSOME_VESICLE_BIOGENESIS(34)", 
"REACTOME_MEMBRANE_TRAFFICKING(562)", "REACTOME_POST_TRANSLATIONAL_PROTEIN_MODIFICATION(1310)", 
"REACTOME_PROTEIN_LOCALIZATION(103)", "REACTOME_RAB_GEFS_EXCHANGE_GTP_FOR_GDP_ON_RABS(89)", 
"REACTOME_RAB_GERANYLGERANYLATION(62)", "REACTOME_RAB_REGULATION_OF_TRAFFICKING(115)", 
"REACTOME_TBC_RABGAPS(34)", "REACTOME_TRANS_GOLGI_NETWORK_VESICLE_BUDDING(71)", 
"REACTOME_TRANSPORT_OF_MATURE_TRANSCRIPT_TO_CYTOPLASM(79)", "REACTOME_TRANSPORT_TO_THE_GOLGI_AND_SUBSEQUENT_MODIFICATION(178)", 
"REACTOME_VEGFR2_MEDIATED_VASCULAR_PERMEABILITY(29)", "REACTOME_VESICLE_MEDIATED_TRANSPORT(709)", 
"HALLMARK_CHOLESTEROL_HOMEOSTASIS(71)", "HALLMARK_GLYCOLYSIS(200)", 
"HALLMARK_OXIDATIVE_PHOSPHORYLATION(195)", "KEGG_AMINOACYL_TRNA_BIOSYNTHESIS(41)", 
"KEGG_CITRATE_CYCLE_TCA_CYCLE(30)", "KEGG_FATTY_ACID_METABOLISM(40)", 
"KEGG_GLYCEROPHOSPHOLIPID_METABOLISM(76)", "KEGG_OXIDATIVE_PHOSPHORYLATION(128)", 
"KEGG_PURINE_METABOLISM(157)", "KEGG_PYRIMIDINE_METABOLISM(96)", 
"KEGG_STEROID_BIOSYNTHESIS(17)", "REACTOME_CHOLESTEROL_BIOSYNTHESIS(28)", 
"HALLMARK_KRAS_SIGNALING_UP(198)", "REACTOME_CDC42_GTPASE_CYCLE(94)", 
"REACTOME_INTRACELLULAR_SIGNALING_BY_SECOND_MESSENGERS(260)", 
"REACTOME_RAC1_GTPASE_CYCLE(172)", "REACTOME_RAC2_GTPASE_CYCLE(85)", 
"REACTOME_RAC3_GTPASE_CYCLE(91)", "REACTOME_RAS_PROCESSING(29)", 
"REACTOME_REGULATION_OF_RAS_BY_GAPS(67)", "REACTOME_RHO_GTPASE_CYCLE(421)", 
"REACTOME_RHO_GTPASE_EFFECTORS(245)", "REACTOME_RHO_GTPASES_ACTIVATE_FORMINS(135)", 
"REACTOME_RHOA_GTPASE_CYCLE(141)", "KEGG_RNA_POLYMERASE(27)", 
"KEGG_SPLICEOSOME(123)", "REACTOME_ACTIVATION_OF_THE_MRNA_UPON_BINDING_OF_THE_CAP_BINDING_COMPLEX_AND_EIFS_AND_SUBSEQUENT_BINDING_TO_43S(60)", 
"REACTOME_FORMATION_OF_RNA_POL_II_ELONGATION_COMPLEX(55)", "REACTOME_FORMATION_OF_TC_NER_PRE_INCISION_COMPLEX(53)", 
"REACTOME_FORMATION_OF_THE_EARLY_ELONGATION_COMPLEX(32)", "REACTOME_GENE_EXPRESSION_TRANSCRIPTION(1061)", 
"REACTOME_GENERIC_TRANSCRIPTION_PATHWAY(842)", "KEGG_RIBOSOME(84)", 
"REACTOME_EUKARYOTIC_TRANSLATION_INITIATION(118)", "REACTOME_FORMATION_OF_A_POOL_OF_FREE_40S_SUBUNITS(100)", 
"REACTOME_MITOCHONDRIAL_TRANSLATION(89)", "REACTOME_TRANSLATION(227)"
), ct = c(23.46994037, 0.444647699, 0.48059366, 23.69739708, 
22.70996891, 23.14546877, 22.5125215, 24, 0.082823932, 21.14628873, 
23.89962439, 3.101102259, 19.73857433, 1.345266962, 22.65473537, 
22.67911727, 0.141658812, 23.55959968, 20.98039379, 21.37456775, 
22.9452684, 21.75195704, 22.28943169, 21.3138143, 21.47333358, 
22.99755994, 23.77524494, 23.79003339, 0.815225739, 0.851942805, 
1.015518753, 5.676010891, 23.70933719, 2.122858012, 0.364197049, 
0.841799576, 1.503949722, 23.5401555, 0.859226588, 0.431283406, 
23.76634611, 23.61289283, 23.79740647, 1.57442503, 1.160093029, 
0.705766171, 0.759801971, 22.63694137, 0.609374246, 0.5677071, 
2.064455224, 0.718389348, 23.54391253, 23.54309661, 0.446556825, 
3.690339167, 0.684838669, 0.007978021, 3.827062937, 0.292247265, 
23.46627545, 0.8439002, 2.082217104, 2.63916836, 1.345782895, 
1.238365008, 0.422770904, 0.642185135, 21.88912394, 20.85779058, 
0.870736865, 23.42856467, 23.12505283, 5.896631702, 5.222270959, 
1.401493428, 3.012183217, 1.429243788, 20.04868878, 18.72709574, 
22.49595319, 23.0188008, 1.738478694, 23.50344452, 0.662628194, 
0.485381794, 2.567074301, 2.930818844, 0.459018625, 23.61766479, 
22.76335766, 23.95562557, 2.172868272, 1.555338843, 1.014142532, 
3.140403508, 1.920081876, 3.125254729, 1.378153453, 1.313997739, 
1.232344673, 1.061227107, 1.016804369, 2.021870852, 1.159067286
)), class = "data.frame", row.names = c(NA, -105L))

这是我当前的代码:

BAT %>%
  mutate(ct = ifelse(ct > 12, ct - 24, ct)) %>%
  ggplot(aes(as.numeric(factor(process)), ct, fill = process)) +  # Set up the plot aesthetics
  geom_vline(xintercept = c(-0.75, 1.00, 2.75, 4.25, 6.00, 7.75, 9.25, 11), linewidth = 5, color = 'gray92') +  # grey vertical lines at each process step
  stat_boxplot(geom = 'errorbar', width = 10, aes(color = process)) +  # Error bars at the boxplot boundaries
  geom_boxplot(width = 10, linewidth = 0, outlier.colour = NA) +  # Boxplot without outline and no outliers
  stat_boxplot(geom = 'errorbar', width = 10, aes(ymax = after_stat(middle), ymin = after_stat(middle))) +  # Error bars at median level, width is black median line
  geom_hline(yintercept = c(-12, -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10), linetype = 5.5, alpha = 0.2) + # Horizontal dashed lines and transparency level of the lines
  annotate('rect', xmax = -2, xmin = -Inf, ymin = -Inf, ymax = Inf, fill = 'white') +  # White background rectangle for centering text
  annotate('text', x = -8, y = 0, label = 'in vitro', fontface = 3, size = 10) +  # Text annotation
  coord_polar(theta = 'y', start = pi) +  # Polar coordinate system for a circular plot
  theme_void() +  # Remove axis labels, ticks, and background
  scale_x_continuous(limits = c(-9, 12)) +  # X-axis limits
  scale_y_continuous(limits = c(-12, 12), breaks = -12:11, labels = ~sprintf('%02d:00', ifelse(.x < 0, .x + 24,.x))) +  # Convert 'ct' to 24-hour time format
  theme(axis.text.x = element_text(), legend.position = 'top') + # Customize x-axis labels and Place legend at the top
  scale_color_manual(values = c('#f67a74', '#ed9a64', '#99cb60', '#59de38', '#33d691', '#33ccd6', 
                                '#a3acf0', '#df90f3', '#f16cd9')) +  # Custom color palette for border color
  scale_fill_manual(values = c('#f67a74', '#ed9a64', '#99cb60', '#59de38', '#33d691', '#33ccd6', 
                               '#a3acf0', '#df90f3', '#f16cd9'))  # Custom color palette for fill color
r boxplot
1个回答
0
投票

您的 x 轴值似乎比实际需要的更复杂。如果您使用

group
变量,您的箱线图将全部位于整数值:

BAT %>%
  mutate(ct = ifelse(ct > 12, ct - 24, ct)) %>%
  ggplot(aes(as.numeric(factor(process)), ct, fill = process,
             group = process)) + 
  geom_vline(xintercept = 1:8,
             linewidth = 5, color = 'gray92') +  
  stat_boxplot(geom = 'errorbar', width = 0.8, aes(color = process)) +  
  geom_boxplot(width = 0.8, linewidth = 0, outlier.colour = NA) + 
  stat_boxplot(geom = 'errorbar', width = 0.8, 
               aes(ymax = after_stat(middle), ymin = after_stat(middle))) +  
  geom_hline(yintercept = c(-12, -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10), 
             linetype = 5.5, alpha = 0.2) + 
  annotate('rect', xmax = -2, xmin = -Inf, ymin = -Inf, ymax = Inf, 
           fill = 'white') + 
  annotate('text', x = -8, y = 0, label = 'in vitro', fontface = 3, size = 10) +
  coord_polar(theta = 'y', start = pi) + 
  theme_void() + 
  scale_x_continuous(limits = c(-5, 12)) + 
  scale_y_continuous(limits = c(-12, 12), 
                     breaks = -12:11, 
                     labels = ~sprintf('%02d:00', ifelse(.x < 0, .x + 24,.x))) +  
  theme(axis.text.x = element_text(), legend.position = 'top') + 
  scale_color_manual(values = c('#f67a74', '#ed9a64', '#99cb60',
                                '#59de38', '#33d691', '#33ccd6', 
                                '#a3acf0', '#df90f3', '#f16cd9')) + 
  scale_fill_manual(values = c('#f67a74', '#ed9a64', '#99cb60', 
                               '#59de38', '#33d691', '#33ccd6', 
                               '#a3acf0', '#df90f3', '#f16cd9')) 

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.