From ddcf8898d86f231847cdd04c0cd77030e489ed0c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Apr 2026 04:08:48 +0000 Subject: [PATCH 1/4] Initial plan From f9a543475eaea69dc0213d8283d1e5b3231acd6f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Apr 2026 04:12:54 +0000 Subject: [PATCH 2/4] fix: add citation to SKILL.md, stop generating individual skill MD files Agent-Logs-Url: https://github.com/openbiox/Bizard/sessions/b4b46f82-3faf-4030-9671-ce9e7e026783 Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com> --- .github/scripts/generate_skills.py | 7 ++ .github/workflows/generate-skills.yml | 2 +- .gitignore | 3 + SKILL.md | 2 + skills/Animation/Animation_skill.md | 82 --------------- skills/Animation/Interactivity_skill.md | 60 ----------- skills/Clinics/KaplanMeierPlot_skill.md | 82 --------------- skills/Clinics/LollipopPlot_skill.md | 86 ---------------- skills/Clinics/MetaForestPlot_skill.md | 87 ---------------- skills/Clinics/MosaicPlot_skill.md | 86 ---------------- skills/Clinics/Nomogram_skill.md | 57 ----------- skills/Clinics/RegressionTable_skill.md | 57 ----------- skills/Composition/CircularPacking_skill.md | 96 ------------------ skills/Composition/Dendrogram_skill.md | 83 ---------------- skills/Composition/Donut_skill.md | 57 ----------- skills/Composition/GroupedBarplot_skill.md | 90 ----------------- skills/Composition/PartPieChart_skill.md | 71 ------------- skills/Composition/PieChart_skill.md | 47 --------- skills/Composition/Treemap_skill.md | 65 ------------ skills/Composition/Waffle_skill.md | 58 ----------- skills/Correlation/Biplot_skill.md | 50 ---------- skills/Correlation/Bubble_skill.md | 61 ------------ skills/Correlation/ComplexHeatmap_skill.md | 59 ----------- skills/Correlation/ConnectedScatter_skill.md | 72 -------------- skills/Correlation/Correlogram_skill.md | 45 --------- skills/Correlation/Density2D_skill.md | 65 ------------ skills/Correlation/Heatmap_skill.md | 99 ------------------- skills/Correlation/PCAplot_skill.md | 53 ---------- skills/Correlation/Scatter_skill.md | 69 ------------- skills/Correlation/TernaryPlot_skill.md | 48 --------- skills/Correlation/UMAPplot_skill.md | 68 ------------- skills/DataOverTime/AreaChart_skill.md | 85 ---------------- skills/DataOverTime/CalendHighlight_skill.md | 77 --------------- skills/DataOverTime/LineChart_skill.md | 87 ---------------- skills/DataOverTime/StackedArea_skill.md | 79 --------------- skills/DataOverTime/Streamgraph_skill.md | 57 ----------- skills/DataOverTime/Timeseries_skill.md | 66 ------------- skills/Distribution/Beeswarm_skill.md | 74 -------------- skills/Distribution/BoxPlot_skill.md | 65 ------------ skills/Distribution/BreakPlot_skill.md | 78 --------------- skills/Distribution/Density_skill.md | 90 ----------------- skills/Distribution/Histogram_skill.md | 85 ---------------- .../Distribution/RadialColumnChart_skill.md | 70 ------------- skills/Distribution/Ridgeline_skill.md | 61 ------------ skills/Distribution/ViolinPlot_skill.md | 76 -------------- skills/Hiplot/001-area_skill.md | 68 ------------- skills/Hiplot/002-barcode-plot_skill.md | 61 ------------ skills/Hiplot/003-barplot-3d_skill.md | 80 --------------- .../Hiplot/004-barplot-color-group_skill.md | 79 --------------- skills/Hiplot/005-barplot-errorbar_skill.md | 83 ---------------- skills/Hiplot/006-barplot-errorbar2_skill.md | 75 -------------- skills/Hiplot/008-barplot-gradient_skill.md | 74 -------------- .../Hiplot/009-barplot-line-multiple_skill.md | 76 -------------- skills/Hiplot/010-barplot_skill.md | 70 ------------- skills/Hiplot/011-beanplot_skill.md | 61 ------------ skills/Hiplot/012-beeswarm_skill.md | 69 ------------- skills/Hiplot/013-big-corrplot_skill.md | 67 ------------- skills/Hiplot/014-bivariate_skill.md | 61 ------------ skills/Hiplot/015-boxplot_skill.md | 69 ------------- skills/Hiplot/016-bubble_skill.md | 73 -------------- skills/Hiplot/017-bumpchart_skill.md | 64 ------------ skills/Hiplot/018-calibration-curve_skill.md | 64 ------------ skills/Hiplot/019-chi-square-fisher_skill.md | 82 --------------- skills/Hiplot/020-chord_skill.md | 71 ------------- skills/Hiplot/021-circle-packing_skill.md | 71 ------------- skills/Hiplot/023-circular-barplot_skill.md | 84 ---------------- skills/Hiplot/024-circular-pie-chart_skill.md | 80 --------------- skills/Hiplot/025-complex-heatmap_skill.md | 85 ---------------- .../Hiplot/026-connected-scatterplot_skill.md | 83 ---------------- skills/Hiplot/027-contour-matrix_skill.md | 86 ---------------- skills/Hiplot/028-contour-xy_skill.md | 73 -------------- skills/Hiplot/029-cor-heatmap-simple_skill.md | 72 -------------- skills/Hiplot/030-cor-heatmap_skill.md | 81 --------------- skills/Hiplot/033-corrplot_skill.md | 82 --------------- skills/Hiplot/034-custom-heat-map_skill.md | 71 ------------- .../Hiplot/035-custom-icon-scatter_skill.md | 62 ------------ skills/Hiplot/036-d3-wordcloud_skill.md | 59 ----------- skills/Hiplot/037-dendrogram_skill.md | 63 ------------ .../Hiplot/038-density-hist-mirror_skill.md | 82 --------------- skills/Hiplot/039-density-histogram_skill.md | 77 --------------- skills/Hiplot/040-density_skill.md | 69 ------------- skills/Hiplot/041-deviation-plot_skill.md | 76 -------------- skills/Hiplot/042-diffusion-map_skill.md | 85 ---------------- skills/Hiplot/043-diverging-scale_skill.md | 56 ----------- skills/Hiplot/044-diy-gsea_skill.md | 63 ------------ skills/Hiplot/045-donut_skill.md | 68 ------------- skills/Hiplot/046-dotchart_skill.md | 64 ------------ skills/Hiplot/047-dual-y-axis_skill.md | 64 ------------ skills/Hiplot/048-dumbbell_skill.md | 64 ------------ skills/Hiplot/049-easy-pairs_skill.md | 61 ------------ skills/Hiplot/050-easy-som_skill.md | 79 --------------- skills/Hiplot/051-eulerr_skill.md | 61 ------------ skills/Hiplot/052-extended-scatter_skill.md | 58 ----------- skills/Hiplot/053-ezcox_skill.md | 52 ---------- skills/Hiplot/054-fan_skill.md | 50 ---------- skills/Hiplot/055-fishplot_skill.md | 51 ---------- skills/Hiplot/056-flowerplot_skill.md | 57 ----------- .../Hiplot/057-funnel-plot-metafor_skill.md | 54 ---------- skills/Hiplot/058-funnel-plot_skill.md | 51 ---------- skills/Hiplot/059-gantt_skill.md | 76 -------------- skills/Hiplot/060-gene-density_skill.md | 83 ---------------- skills/Hiplot/061-gene-rank_skill.md | 82 --------------- skills/Hiplot/062-gene-trend_skill.md | 80 --------------- skills/Hiplot/063-ggbarstats_skill.md | 66 ------------- skills/Hiplot/064-ggbetweenstats_skill.md | 73 -------------- skills/Hiplot/065-ggdag_skill.md | 50 ---------- skills/Hiplot/066-ggdist_skill.md | 78 --------------- skills/Hiplot/067-gghistostats_skill.md | 63 ------------ skills/Hiplot/068-ggpie_skill.md | 66 ------------- skills/Hiplot/069-ggpiestats-group_skill.md | 71 ------------- skills/Hiplot/071-ggpiestats_skill.md | 56 ----------- skills/Hiplot/072-ggpubr-boxplot_skill.md | 70 ------------- skills/Hiplot/073-ggscatterstats_skill.md | 48 --------- skills/Hiplot/074-ggseqlogo_skill.md | 58 ----------- skills/Hiplot/075-ggwithinstats_skill.md | 74 -------------- skills/Hiplot/076-ggwordcloud_skill.md | 62 ------------ skills/Hiplot/077-gobar_skill.md | 56 ----------- skills/Hiplot/078-gobubble_skill.md | 60 ----------- skills/Hiplot/079-gocircle_skill.md | 60 ----------- skills/Hiplot/080-grdotplot_skill.md | 48 --------- skills/Hiplot/081-group-bubble_skill.md | 55 ----------- skills/Hiplot/082-group-comparison_skill.md | 78 --------------- skills/Hiplot/083-group-dumbbell_skill.md | 56 ----------- skills/Hiplot/084-group-line_skill.md | 53 ---------- skills/Hiplot/085-half-violin_skill.md | 87 ---------------- skills/Hiplot/086-heatmap_skill.md | 79 --------------- skills/Hiplot/087-hic-heatmap_skill.md | 81 --------------- skills/Hiplot/088-histogram_skill.md | 68 ------------- .../Hiplot/089-interval-area-chart_skill.md | 70 ------------- skills/Hiplot/090-interval-bar-chart_skill.md | 58 ----------- skills/Hiplot/091-likert_skill.md | 56 ----------- skills/Hiplot/092-line-color-dot_skill.md | 73 -------------- skills/Hiplot/093-line-errorbar_skill.md | 63 ------------ skills/Hiplot/094-line-regression_skill.md | 83 ---------------- skills/Hiplot/095-line_skill.md | 71 ------------- skills/Hiplot/096-map-africa_skill.md | 85 ---------------- skills/Hiplot/097-map-americas_skill.md | 85 ---------------- skills/Hiplot/098-map-china-city_skill.md | 85 ---------------- skills/Hiplot/099-map-china-county_skill.md | 85 ---------------- skills/Hiplot/100-map-china_skill.md | 65 ------------ skills/Hiplot/101-map-china2_skill.md | 85 ---------------- skills/Hiplot/102-map-europe_skill.md | 85 ---------------- skills/Hiplot/103-map-france-town_skill.md | 85 ---------------- skills/Hiplot/104-map-france_skill.md | 85 ---------------- skills/Hiplot/106-map-germany-town_skill.md | 85 ---------------- skills/Hiplot/107-map-germany_skill.md | 85 ---------------- skills/Hiplot/108-map-north-america_skill.md | 85 ---------------- skills/Hiplot/109-map-oceania-antarc_skill.md | 85 ---------------- skills/Hiplot/111-map-south-america_skill.md | 85 ---------------- skills/Hiplot/112-map-uk-city_skill.md | 85 ---------------- skills/Hiplot/113-map-uk_skill.md | 85 ---------------- skills/Hiplot/114-map-usa-county_skill.md | 85 ---------------- skills/Hiplot/115-map-usa_skill.md | 86 ---------------- skills/Hiplot/116-map-world_skill.md | 70 ------------- skills/Hiplot/117-map-world2_skill.md | 85 ---------------- skills/Hiplot/118-matrix-bubble_skill.md | 71 ------------- skills/Hiplot/119-meta-bin_skill.md | 52 ---------- skills/Hiplot/120-meta-cont_skill.md | 53 ---------- skills/Hiplot/121-metawho_skill.md | 53 ---------- skills/Hiplot/122-moon-charts_skill.md | 71 ------------- skills/Hiplot/123-mosaic_skill.md | 55 ----------- .../Hiplot/125-multiple-histograms_skill.md | 54 ---------- skills/Hiplot/127-network-igraph_skill.md | 82 --------------- skills/Hiplot/129-neural-network_skill.md | 50 ---------- skills/Hiplot/130-nomogram-logistic_skill.md | 68 ------------- skills/Hiplot/131-nomogram_skill.md | 81 --------------- .../Hiplot/132-parallel-coordinate_skill.md | 71 ------------- skills/Hiplot/133-pareto-chart_skill.md | 65 ------------ skills/Hiplot/134-parliament_skill.md | 59 ----------- skills/Hiplot/135-pca2_skill.md | 74 -------------- skills/Hiplot/136-pcatools_skill.md | 81 --------------- skills/Hiplot/137-perspective_skill.md | 63 ------------ skills/Hiplot/138-pie-3d_skill.md | 55 ----------- skills/Hiplot/139-pie-group_skill.md | 72 -------------- skills/Hiplot/140-pie-matrix_skill.md | 85 ---------------- skills/Hiplot/141-pie_skill.md | 84 ---------------- skills/Hiplot/142-point-sd_skill.md | 74 -------------- skills/Hiplot/143-pseudo-enhanced-ma_skill.md | 70 ------------- skills/Hiplot/144-pyramid-chart_skill.md | 56 ----------- skills/Hiplot/145-pyramid-chart2_skill.md | 67 ------------- skills/Hiplot/146-pyramid-stack_skill.md | 78 --------------- skills/Hiplot/147-pyramid-stack2_skill.md | 64 ------------ skills/Hiplot/148-qqplot_skill.md | 65 ------------ skills/Hiplot/149-r-code-flow_skill.md | 48 --------- skills/Hiplot/150-radar_skill.md | 81 --------------- skills/Hiplot/151-rcs-cox_skill.md | 83 ---------------- skills/Hiplot/152-rcs-lrm_skill.md | 83 ---------------- skills/Hiplot/153-ribbon_skill.md | 76 -------------- skills/Hiplot/154-ridge_skill.md | 77 --------------- skills/Hiplot/155-risk-plot_skill.md | 85 ---------------- skills/Hiplot/156-roc_skill.md | 76 -------------- skills/Hiplot/157-rose-chart_skill.md | 65 ------------ skills/Hiplot/158-sankey_skill.md | 85 ---------------- skills/Hiplot/159-scatter-3d_skill.md | 70 ------------- skills/Hiplot/160-scatter-gradient_skill.md | 70 ------------- skills/Hiplot/161-scatter_skill.md | 64 ------------ skills/Hiplot/162-scatter2_skill.md | 73 -------------- skills/Hiplot/163-scatterpie_skill.md | 61 ------------ .../Hiplot/164-simple-funnel-diagram_skill.md | 51 ---------- skills/Hiplot/165-slopegraph_skill.md | 59 ----------- skills/Hiplot/166-stack-violin_skill.md | 81 --------------- .../167-stacked-percentage-bar-chart_skill.md | 72 -------------- skills/Hiplot/168-streamgraph_skill.md | 51 ---------- skills/Hiplot/169-survival_skill.md | 66 ------------- skills/Hiplot/170-taylor-diagram_skill.md | 53 ---------- skills/Hiplot/171-time-roc_skill.md | 86 ---------------- skills/Hiplot/172-treeheatr_skill.md | 78 --------------- skills/Hiplot/173-treemap_skill.md | 50 ---------- skills/Hiplot/174-tricolor-histogram_skill.md | 58 ----------- skills/Hiplot/175-tsne_skill.md | 82 --------------- skills/Hiplot/176-umap_skill.md | 81 --------------- skills/Hiplot/177-upset-plot_skill.md | 82 --------------- skills/Hiplot/178-venn_skill.md | 79 --------------- skills/Hiplot/179-venn2_skill.md | 53 ---------- skills/Hiplot/180-violin-group_skill.md | 70 ------------- skills/Hiplot/181-violin_skill.md | 73 -------------- skills/Hiplot/182-visdat_skill.md | 74 -------------- skills/Hiplot/183-volcano_skill.md | 80 --------------- skills/Hiplot/184-waffle_skill.md | 61 ------------ skills/Hiplot/185-waterfalls-plot_skill.md | 56 ----------- skills/Hiplot/186-waterfalls_skill.md | 62 ------------ skills/Hiplot/187-pca_skill.md | 86 ---------------- skills/Julia/Heatmap_skill.md | 53 ---------- skills/Julia/ScatterPlot_skill.md | 61 ------------ skills/Julia/ViolinPlot_skill.md | 55 ----------- skills/Misc/About_skill.md | 24 ----- skills/Misc/GraphGallery_skill.md | 37 ------- skills/Misc/Skills_skill.md | 24 ----- skills/Omics/CellChatCirclePlot_skill.md | 85 ---------------- skills/Omics/ChromosomePlot_skill.md | 40 -------- skills/Omics/CollinearityPlot_skill.md | 37 ------- skills/Omics/GeneStructurePlot_skill.md | 47 --------- skills/Omics/GwasSnpPlot_skill.md | 54 ---------- skills/Omics/KeggPathwayPlot_skill.md | 48 --------- skills/Omics/ManhattanPlot_skill.md | 42 -------- skills/Omics/MotifPlot_skill.md | 55 ----------- skills/Omics/MultiSeqsAlignment_skill.md | 53 ---------- skills/Omics/MultiVolcanoPlot_skill.md | 53 ---------- skills/Omics/NetworkPlot_skill.md | 48 --------- skills/Omics/PopulationMapPlot_skill.md | 66 ------------- skills/Omics/SankeyBubblePlot_skill.md | 86 ---------------- skills/Omics/SyntenyBlocksPlot_skill.md | 38 ------- skills/Omics/TextEnrichmentBarPlot_skill.md | 87 ---------------- skills/Omics/VolcanoPlot_skill.md | 83 ---------------- skills/Proportion/ArcDiagram_skill.md | 87 ---------------- skills/Proportion/ChordDiagram_skill.md | 89 ----------------- skills/Proportion/DicePlot_skill.md | 82 --------------- skills/Proportion/EdgeBundling_skill.md | 24 ----- skills/Proportion/Network_skill.md | 59 ----------- skills/Proportion/Sankey_skill.md | 67 ------------- skills/Python/Heatmap_skill.md | 61 ------------ skills/Python/ScatterPlot_skill.md | 65 ------------ skills/Python/ViolinPlot_skill.md | 64 ------------ skills/Python/VolcanoPlot_skill.md | 71 ------------- skills/Ranking/BarPlot_skill.md | 82 --------------- skills/Ranking/CircularBarplot_skill.md | 61 ------------ skills/Ranking/Lollipop_skill.md | 84 ---------------- skills/Ranking/Parallel_skill.md | 70 ------------- skills/Ranking/Radar_skill.md | 54 ---------- skills/Ranking/Table_skill.md | 52 ---------- skills/Ranking/UpsetPlot_skill.md | 48 --------- skills/Ranking/VennPlot_skill.md | 45 --------- skills/Ranking/Wordcloud_skill.md | 67 ------------- 263 files changed, 13 insertions(+), 17744 deletions(-) delete mode 100644 skills/Animation/Animation_skill.md delete mode 100644 skills/Animation/Interactivity_skill.md delete mode 100644 skills/Clinics/KaplanMeierPlot_skill.md delete mode 100644 skills/Clinics/LollipopPlot_skill.md delete mode 100644 skills/Clinics/MetaForestPlot_skill.md delete mode 100644 skills/Clinics/MosaicPlot_skill.md delete mode 100644 skills/Clinics/Nomogram_skill.md delete mode 100644 skills/Clinics/RegressionTable_skill.md delete mode 100644 skills/Composition/CircularPacking_skill.md delete mode 100644 skills/Composition/Dendrogram_skill.md delete mode 100644 skills/Composition/Donut_skill.md delete mode 100644 skills/Composition/GroupedBarplot_skill.md delete mode 100644 skills/Composition/PartPieChart_skill.md delete mode 100644 skills/Composition/PieChart_skill.md delete mode 100644 skills/Composition/Treemap_skill.md delete mode 100644 skills/Composition/Waffle_skill.md delete mode 100644 skills/Correlation/Biplot_skill.md delete mode 100644 skills/Correlation/Bubble_skill.md delete mode 100644 skills/Correlation/ComplexHeatmap_skill.md delete mode 100644 skills/Correlation/ConnectedScatter_skill.md delete mode 100644 skills/Correlation/Correlogram_skill.md delete mode 100644 skills/Correlation/Density2D_skill.md delete mode 100644 skills/Correlation/Heatmap_skill.md delete mode 100644 skills/Correlation/PCAplot_skill.md delete mode 100644 skills/Correlation/Scatter_skill.md delete mode 100644 skills/Correlation/TernaryPlot_skill.md delete mode 100644 skills/Correlation/UMAPplot_skill.md delete mode 100644 skills/DataOverTime/AreaChart_skill.md delete mode 100644 skills/DataOverTime/CalendHighlight_skill.md delete mode 100644 skills/DataOverTime/LineChart_skill.md delete mode 100644 skills/DataOverTime/StackedArea_skill.md delete mode 100644 skills/DataOverTime/Streamgraph_skill.md delete mode 100644 skills/DataOverTime/Timeseries_skill.md delete mode 100644 skills/Distribution/Beeswarm_skill.md delete mode 100644 skills/Distribution/BoxPlot_skill.md delete mode 100644 skills/Distribution/BreakPlot_skill.md delete mode 100644 skills/Distribution/Density_skill.md delete mode 100644 skills/Distribution/Histogram_skill.md delete mode 100644 skills/Distribution/RadialColumnChart_skill.md delete mode 100644 skills/Distribution/Ridgeline_skill.md delete mode 100644 skills/Distribution/ViolinPlot_skill.md delete mode 100644 skills/Hiplot/001-area_skill.md delete mode 100644 skills/Hiplot/002-barcode-plot_skill.md delete mode 100644 skills/Hiplot/003-barplot-3d_skill.md delete mode 100644 skills/Hiplot/004-barplot-color-group_skill.md delete mode 100644 skills/Hiplot/005-barplot-errorbar_skill.md delete mode 100644 skills/Hiplot/006-barplot-errorbar2_skill.md delete mode 100644 skills/Hiplot/008-barplot-gradient_skill.md delete mode 100644 skills/Hiplot/009-barplot-line-multiple_skill.md delete mode 100644 skills/Hiplot/010-barplot_skill.md delete mode 100644 skills/Hiplot/011-beanplot_skill.md delete mode 100644 skills/Hiplot/012-beeswarm_skill.md delete mode 100644 skills/Hiplot/013-big-corrplot_skill.md delete mode 100644 skills/Hiplot/014-bivariate_skill.md delete mode 100644 skills/Hiplot/015-boxplot_skill.md delete mode 100644 skills/Hiplot/016-bubble_skill.md delete mode 100644 skills/Hiplot/017-bumpchart_skill.md delete mode 100644 skills/Hiplot/018-calibration-curve_skill.md delete mode 100644 skills/Hiplot/019-chi-square-fisher_skill.md delete mode 100644 skills/Hiplot/020-chord_skill.md delete mode 100644 skills/Hiplot/021-circle-packing_skill.md delete mode 100644 skills/Hiplot/023-circular-barplot_skill.md delete mode 100644 skills/Hiplot/024-circular-pie-chart_skill.md delete mode 100644 skills/Hiplot/025-complex-heatmap_skill.md delete mode 100644 skills/Hiplot/026-connected-scatterplot_skill.md delete mode 100644 skills/Hiplot/027-contour-matrix_skill.md delete mode 100644 skills/Hiplot/028-contour-xy_skill.md delete mode 100644 skills/Hiplot/029-cor-heatmap-simple_skill.md delete mode 100644 skills/Hiplot/030-cor-heatmap_skill.md delete mode 100644 skills/Hiplot/033-corrplot_skill.md delete mode 100644 skills/Hiplot/034-custom-heat-map_skill.md delete mode 100644 skills/Hiplot/035-custom-icon-scatter_skill.md delete mode 100644 skills/Hiplot/036-d3-wordcloud_skill.md delete mode 100644 skills/Hiplot/037-dendrogram_skill.md delete mode 100644 skills/Hiplot/038-density-hist-mirror_skill.md delete mode 100644 skills/Hiplot/039-density-histogram_skill.md delete mode 100644 skills/Hiplot/040-density_skill.md delete mode 100644 skills/Hiplot/041-deviation-plot_skill.md delete mode 100644 skills/Hiplot/042-diffusion-map_skill.md delete mode 100644 skills/Hiplot/043-diverging-scale_skill.md delete mode 100644 skills/Hiplot/044-diy-gsea_skill.md delete mode 100644 skills/Hiplot/045-donut_skill.md delete mode 100644 skills/Hiplot/046-dotchart_skill.md delete mode 100644 skills/Hiplot/047-dual-y-axis_skill.md delete mode 100644 skills/Hiplot/048-dumbbell_skill.md delete mode 100644 skills/Hiplot/049-easy-pairs_skill.md delete mode 100644 skills/Hiplot/050-easy-som_skill.md delete mode 100644 skills/Hiplot/051-eulerr_skill.md delete mode 100644 skills/Hiplot/052-extended-scatter_skill.md delete mode 100644 skills/Hiplot/053-ezcox_skill.md delete mode 100644 skills/Hiplot/054-fan_skill.md delete mode 100644 skills/Hiplot/055-fishplot_skill.md delete mode 100644 skills/Hiplot/056-flowerplot_skill.md delete mode 100644 skills/Hiplot/057-funnel-plot-metafor_skill.md delete mode 100644 skills/Hiplot/058-funnel-plot_skill.md delete mode 100644 skills/Hiplot/059-gantt_skill.md delete mode 100644 skills/Hiplot/060-gene-density_skill.md delete mode 100644 skills/Hiplot/061-gene-rank_skill.md delete mode 100644 skills/Hiplot/062-gene-trend_skill.md delete mode 100644 skills/Hiplot/063-ggbarstats_skill.md delete mode 100644 skills/Hiplot/064-ggbetweenstats_skill.md delete mode 100644 skills/Hiplot/065-ggdag_skill.md delete mode 100644 skills/Hiplot/066-ggdist_skill.md delete mode 100644 skills/Hiplot/067-gghistostats_skill.md delete mode 100644 skills/Hiplot/068-ggpie_skill.md delete mode 100644 skills/Hiplot/069-ggpiestats-group_skill.md delete mode 100644 skills/Hiplot/071-ggpiestats_skill.md delete mode 100644 skills/Hiplot/072-ggpubr-boxplot_skill.md delete mode 100644 skills/Hiplot/073-ggscatterstats_skill.md delete mode 100644 skills/Hiplot/074-ggseqlogo_skill.md delete mode 100644 skills/Hiplot/075-ggwithinstats_skill.md delete mode 100644 skills/Hiplot/076-ggwordcloud_skill.md delete mode 100644 skills/Hiplot/077-gobar_skill.md delete mode 100644 skills/Hiplot/078-gobubble_skill.md delete mode 100644 skills/Hiplot/079-gocircle_skill.md delete mode 100644 skills/Hiplot/080-grdotplot_skill.md delete mode 100644 skills/Hiplot/081-group-bubble_skill.md delete mode 100644 skills/Hiplot/082-group-comparison_skill.md delete mode 100644 skills/Hiplot/083-group-dumbbell_skill.md delete mode 100644 skills/Hiplot/084-group-line_skill.md delete mode 100644 skills/Hiplot/085-half-violin_skill.md delete mode 100644 skills/Hiplot/086-heatmap_skill.md delete mode 100644 skills/Hiplot/087-hic-heatmap_skill.md delete mode 100644 skills/Hiplot/088-histogram_skill.md delete mode 100644 skills/Hiplot/089-interval-area-chart_skill.md delete mode 100644 skills/Hiplot/090-interval-bar-chart_skill.md delete mode 100644 skills/Hiplot/091-likert_skill.md delete mode 100644 skills/Hiplot/092-line-color-dot_skill.md delete mode 100644 skills/Hiplot/093-line-errorbar_skill.md delete mode 100644 skills/Hiplot/094-line-regression_skill.md delete mode 100644 skills/Hiplot/095-line_skill.md delete mode 100644 skills/Hiplot/096-map-africa_skill.md delete mode 100644 skills/Hiplot/097-map-americas_skill.md delete mode 100644 skills/Hiplot/098-map-china-city_skill.md delete mode 100644 skills/Hiplot/099-map-china-county_skill.md delete mode 100644 skills/Hiplot/100-map-china_skill.md delete mode 100644 skills/Hiplot/101-map-china2_skill.md delete mode 100644 skills/Hiplot/102-map-europe_skill.md delete mode 100644 skills/Hiplot/103-map-france-town_skill.md delete mode 100644 skills/Hiplot/104-map-france_skill.md delete mode 100644 skills/Hiplot/106-map-germany-town_skill.md delete mode 100644 skills/Hiplot/107-map-germany_skill.md delete mode 100644 skills/Hiplot/108-map-north-america_skill.md delete mode 100644 skills/Hiplot/109-map-oceania-antarc_skill.md delete mode 100644 skills/Hiplot/111-map-south-america_skill.md delete mode 100644 skills/Hiplot/112-map-uk-city_skill.md delete mode 100644 skills/Hiplot/113-map-uk_skill.md delete mode 100644 skills/Hiplot/114-map-usa-county_skill.md delete mode 100644 skills/Hiplot/115-map-usa_skill.md delete mode 100644 skills/Hiplot/116-map-world_skill.md delete mode 100644 skills/Hiplot/117-map-world2_skill.md delete mode 100644 skills/Hiplot/118-matrix-bubble_skill.md delete mode 100644 skills/Hiplot/119-meta-bin_skill.md delete mode 100644 skills/Hiplot/120-meta-cont_skill.md delete mode 100644 skills/Hiplot/121-metawho_skill.md delete mode 100644 skills/Hiplot/122-moon-charts_skill.md delete mode 100644 skills/Hiplot/123-mosaic_skill.md delete mode 100644 skills/Hiplot/125-multiple-histograms_skill.md delete mode 100644 skills/Hiplot/127-network-igraph_skill.md delete mode 100644 skills/Hiplot/129-neural-network_skill.md delete mode 100644 skills/Hiplot/130-nomogram-logistic_skill.md delete mode 100644 skills/Hiplot/131-nomogram_skill.md delete mode 100644 skills/Hiplot/132-parallel-coordinate_skill.md delete mode 100644 skills/Hiplot/133-pareto-chart_skill.md delete mode 100644 skills/Hiplot/134-parliament_skill.md delete mode 100644 skills/Hiplot/135-pca2_skill.md delete mode 100644 skills/Hiplot/136-pcatools_skill.md delete mode 100644 skills/Hiplot/137-perspective_skill.md delete mode 100644 skills/Hiplot/138-pie-3d_skill.md delete mode 100644 skills/Hiplot/139-pie-group_skill.md delete mode 100644 skills/Hiplot/140-pie-matrix_skill.md delete mode 100644 skills/Hiplot/141-pie_skill.md delete mode 100644 skills/Hiplot/142-point-sd_skill.md delete mode 100644 skills/Hiplot/143-pseudo-enhanced-ma_skill.md delete mode 100644 skills/Hiplot/144-pyramid-chart_skill.md delete mode 100644 skills/Hiplot/145-pyramid-chart2_skill.md delete mode 100644 skills/Hiplot/146-pyramid-stack_skill.md delete mode 100644 skills/Hiplot/147-pyramid-stack2_skill.md delete mode 100644 skills/Hiplot/148-qqplot_skill.md delete mode 100644 skills/Hiplot/149-r-code-flow_skill.md delete mode 100644 skills/Hiplot/150-radar_skill.md delete mode 100644 skills/Hiplot/151-rcs-cox_skill.md delete mode 100644 skills/Hiplot/152-rcs-lrm_skill.md delete mode 100644 skills/Hiplot/153-ribbon_skill.md delete mode 100644 skills/Hiplot/154-ridge_skill.md delete mode 100644 skills/Hiplot/155-risk-plot_skill.md delete mode 100644 skills/Hiplot/156-roc_skill.md delete mode 100644 skills/Hiplot/157-rose-chart_skill.md delete mode 100644 skills/Hiplot/158-sankey_skill.md delete mode 100644 skills/Hiplot/159-scatter-3d_skill.md delete mode 100644 skills/Hiplot/160-scatter-gradient_skill.md delete mode 100644 skills/Hiplot/161-scatter_skill.md delete mode 100644 skills/Hiplot/162-scatter2_skill.md delete mode 100644 skills/Hiplot/163-scatterpie_skill.md delete mode 100644 skills/Hiplot/164-simple-funnel-diagram_skill.md delete mode 100644 skills/Hiplot/165-slopegraph_skill.md delete mode 100644 skills/Hiplot/166-stack-violin_skill.md delete mode 100644 skills/Hiplot/167-stacked-percentage-bar-chart_skill.md delete mode 100644 skills/Hiplot/168-streamgraph_skill.md delete mode 100644 skills/Hiplot/169-survival_skill.md delete mode 100644 skills/Hiplot/170-taylor-diagram_skill.md delete mode 100644 skills/Hiplot/171-time-roc_skill.md delete mode 100644 skills/Hiplot/172-treeheatr_skill.md delete mode 100644 skills/Hiplot/173-treemap_skill.md delete mode 100644 skills/Hiplot/174-tricolor-histogram_skill.md delete mode 100644 skills/Hiplot/175-tsne_skill.md delete mode 100644 skills/Hiplot/176-umap_skill.md delete mode 100644 skills/Hiplot/177-upset-plot_skill.md delete mode 100644 skills/Hiplot/178-venn_skill.md delete mode 100644 skills/Hiplot/179-venn2_skill.md delete mode 100644 skills/Hiplot/180-violin-group_skill.md delete mode 100644 skills/Hiplot/181-violin_skill.md delete mode 100644 skills/Hiplot/182-visdat_skill.md delete mode 100644 skills/Hiplot/183-volcano_skill.md delete mode 100644 skills/Hiplot/184-waffle_skill.md delete mode 100644 skills/Hiplot/185-waterfalls-plot_skill.md delete mode 100644 skills/Hiplot/186-waterfalls_skill.md delete mode 100644 skills/Hiplot/187-pca_skill.md delete mode 100644 skills/Julia/Heatmap_skill.md delete mode 100644 skills/Julia/ScatterPlot_skill.md delete mode 100644 skills/Julia/ViolinPlot_skill.md delete mode 100644 skills/Misc/About_skill.md delete mode 100644 skills/Misc/GraphGallery_skill.md delete mode 100644 skills/Misc/Skills_skill.md delete mode 100644 skills/Omics/CellChatCirclePlot_skill.md delete mode 100644 skills/Omics/ChromosomePlot_skill.md delete mode 100644 skills/Omics/CollinearityPlot_skill.md delete mode 100644 skills/Omics/GeneStructurePlot_skill.md delete mode 100644 skills/Omics/GwasSnpPlot_skill.md delete mode 100644 skills/Omics/KeggPathwayPlot_skill.md delete mode 100644 skills/Omics/ManhattanPlot_skill.md delete mode 100644 skills/Omics/MotifPlot_skill.md delete mode 100644 skills/Omics/MultiSeqsAlignment_skill.md delete mode 100644 skills/Omics/MultiVolcanoPlot_skill.md delete mode 100644 skills/Omics/NetworkPlot_skill.md delete mode 100644 skills/Omics/PopulationMapPlot_skill.md delete mode 100644 skills/Omics/SankeyBubblePlot_skill.md delete mode 100644 skills/Omics/SyntenyBlocksPlot_skill.md delete mode 100644 skills/Omics/TextEnrichmentBarPlot_skill.md delete mode 100644 skills/Omics/VolcanoPlot_skill.md delete mode 100644 skills/Proportion/ArcDiagram_skill.md delete mode 100644 skills/Proportion/ChordDiagram_skill.md delete mode 100644 skills/Proportion/DicePlot_skill.md delete mode 100644 skills/Proportion/EdgeBundling_skill.md delete mode 100644 skills/Proportion/Network_skill.md delete mode 100644 skills/Proportion/Sankey_skill.md delete mode 100644 skills/Python/Heatmap_skill.md delete mode 100644 skills/Python/ScatterPlot_skill.md delete mode 100644 skills/Python/ViolinPlot_skill.md delete mode 100644 skills/Python/VolcanoPlot_skill.md delete mode 100644 skills/Ranking/BarPlot_skill.md delete mode 100644 skills/Ranking/CircularBarplot_skill.md delete mode 100644 skills/Ranking/Lollipop_skill.md delete mode 100644 skills/Ranking/Parallel_skill.md delete mode 100644 skills/Ranking/Radar_skill.md delete mode 100644 skills/Ranking/Table_skill.md delete mode 100644 skills/Ranking/UpsetPlot_skill.md delete mode 100644 skills/Ranking/VennPlot_skill.md delete mode 100644 skills/Ranking/Wordcloud_skill.md diff --git a/.github/scripts/generate_skills.py b/.github/scripts/generate_skills.py index 8105c25523..ab65d36b5c 100644 --- a/.github/scripts/generate_skills.py +++ b/.github/scripts/generate_skills.py @@ -984,6 +984,13 @@ def generate_unified_skill(index_path: Path, gallery_csv: Path, ) L.append(" website: https://openbiox.github.io/Bizard/") L.append(" repository: https://github.com/openbiox/Bizard") + L.append(" citation: >") + L.append( + " - Li, K., Zheng, H., Huang, K., Chai, Y., Peng, Y., Wang, C., " + "... & Wang, S. (2026). Bizard: A Community\u2010Driven Platform for " + "Accelerating and Enhancing Biomedical Data Visualization. iMetaMed, " + "e70038. " + ) L.append("---") L.append("") # ── Title & role ──────────────────────────────────────────────── diff --git a/.github/workflows/generate-skills.yml b/.github/workflows/generate-skills.yml index fc1808aac7..48bcd51bae 100644 --- a/.github/workflows/generate-skills.yml +++ b/.github/workflows/generate-skills.yml @@ -87,7 +87,7 @@ jobs: AI_Model_Name: ${{ secrets.AI_Model_Name }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} run: | - ARGS="--output skills/ --base-url https://openbiox.github.io/Bizard/ --format both --verbose" + ARGS="--output skills/ --base-url https://openbiox.github.io/Bizard/ --format json --verbose" # Check if offline mode is requested if [ "${{ inputs.offline }}" = "true" ]; then diff --git a/.gitignore b/.gitignore index 25cd3736b2..4929cc3c49 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ __pycache__ # Julia generated files Julia/Manifest.toml + +# Individual per-tutorial skill markdown files (unified into SKILL.md) +skills/**/*_skill.md diff --git a/SKILL.md b/SKILL.md index 8f4bc26a61..d6f3979726 100644 --- a/SKILL.md +++ b/SKILL.md @@ -19,6 +19,8 @@ metadata: skill-author: Bizard Collaboration Group, Luo Lab, and Wang Lab website: https://openbiox.github.io/Bizard/ repository: https://github.com/openbiox/Bizard + citation: > + - Li, K., Zheng, H., Huang, K., Chai, Y., Peng, Y., Wang, C., ... & Wang, S. (2026). Bizard: A Community‐Driven Platform for Accelerating and Enhancing Biomedical Data Visualization. iMetaMed, e70038. --- # Bizard — Biomedical Visualization Atlas AI Skill diff --git a/skills/Animation/Animation_skill.md b/skills/Animation/Animation_skill.md deleted file mode 100644 index 6920eee0ff..0000000000 --- a/skills/Animation/Animation_skill.md +++ /dev/null @@ -1,82 +0,0 @@ -# Skill: Animation (R) - -## Category -Animation - -## When to Use -Create a Animation visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- Cairo -- babynames -- dplyr -- gapminder -- gganimate -- ggplot2 -- gifski -- hrbrthemes -- tidyr -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(Cairo) -library(babynames) -library(dplyr) -library(gapminder) -library(gganimate) -library(ggplot2) - -# Prepare data -# data_gapminder -data_gapminder <- gapminder - -# data_babynames -data_babynames <- babynames - -# data_covi19 -data_covi19 <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_covi19.csv") -data_covi19$date <- c(6:12) -data_covi19 <- gather(data_covi19, key = "area", value = "cases", 2:7) - -# data_covi19_bar -data_covi19_bar_10 <- filter(data_covi19, date == 10) -data_covi19_bar_10$frame <- rep("a",6) - -data_covi19_bar_12 <- filter(data_covi19, date == 12) -data_covi19_bar_12$frame <- rep("b",6) - -data_covi19_bar <- rbind(data_covi19_bar_10,data_covi19_bar_12) - -# Create visualization -# Scattered bubble animation---- -p <- ggplot(data_gapminder, aes(gdpPercap, lifeExp, size = pop, color = continent)) + - geom_point() + - scale_x_log10() + - theme_bw() + - # Drawing animation - labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') + - transition_time(year) + - ease_aes('linear') - -animate(p, renderer = gifski_renderer()) -``` - -## Key Parameters -- `size`: Maps `pop` to the size aesthetic -- `color`: Maps `continent` to the color aesthetic -- `colour`: Maps `country` to the colour aesthetic -- `x`: Maps `group` to the x aesthetic -- `y`: Maps `values` to the y aesthetic -- `fill`: Maps `group` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `stat`: Statistical transformation to use - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group - -## Full Tutorial -https://openbiox.github.io/Bizard/Animation/Animation.html diff --git a/skills/Animation/Interactivity_skill.md b/skills/Animation/Interactivity_skill.md deleted file mode 100644 index e7761ebd1b..0000000000 --- a/skills/Animation/Interactivity_skill.md +++ /dev/null @@ -1,60 +0,0 @@ -# Skill: Interactivity (R) - -## Category -Animation - -## When to Use -Interactive charts allow users to perform actions: zoom, hover the mouse over markers for tooltips, select variables to display, and so on. R provides a set of packages called HTML widgets: these allow you to build interactive data visualizations directly from R. - -## Required R Packages -- chorddiag -- d3heatmap -- dygraphs -- gapminder -- ggiraph -- htmlwidgets -- patchwork -- plotly -- streamgraph -- tidyverse -- webshot -- xts - -## Minimal Reproducible Code -```r -# Load packages -library(chorddiag) -library(d3heatmap) -library(dygraphs) -library(gapminder) -library(ggiraph) -library(htmlwidgets) - -# Prepare data -head(gapminder) - -# Create visualization -plot1 <- gapminder %>% - filter(year==1977) %>% - ggplot(aes(gdpPercap, lifeExp, size = pop, color=continent))+ - geom_point() + - theme_bw() -ggplotly(plot1) -``` - -## Key Parameters -- `size`: Maps `pop` to the size aesthetic -- `color`: Maps `continent` to the color aesthetic -- `x`: Maps `Sample` to the x aesthetic -- `y`: Maps `Composite` to the y aesthetic -- `fill`: Maps `Standardized_Level` to the fill aesthetic -- `width`: Controls element width -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Use `coord_flip()` for horizontal orientation when labels are long -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Animation/Interactivity.html diff --git a/skills/Clinics/KaplanMeierPlot_skill.md b/skills/Clinics/KaplanMeierPlot_skill.md deleted file mode 100644 index 2964b0a5ae..0000000000 --- a/skills/Clinics/KaplanMeierPlot_skill.md +++ /dev/null @@ -1,82 +0,0 @@ -# Skill: Kaplan Meier Plot (R) - -## Category -Clinics - -## When to Use -Create a Kaplan Meier Plot visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- dplyr -- ggplot2 -- patchwork -- survival -- survminer -- tidyr -- zoo - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggplot2) -library(patchwork) -library(survival) -library(survminer) -library(tidyr) - -# Prepare data -# Using the built-in lung dataset (from the survival package) -data("lung") -# Data preprocessing -surv_data <- lung %>% - mutate( - status = ifelse(status == 2, 1, 0), # Transition state code (1=event) - sex = factor(sex, labels = c("Male", "Female")), - group = sample(c("Treatment", "Placebo"), n(), replace = TRUE) - ) - -# View data structure -glimpse(surv_data) - -# Survival time distribution -summary(surv_data$time) - -# Fitting survival curves -fit <- survfit(Surv(time, status) ~ group, data = surv_data) - -# Extract curve data -surv_curve <- surv_summary(fit) - - -# Calculate the log-rank test P value -diff <- survdiff(Surv(time, status) ~ group, data = surv_data) -p_value <- signif(1 - pchisq(diff$chisq, length(diff$n)-1), 3) - -# Create visualization -# Basic survival curve -p1 <- ggplot(surv_curve, aes(x = time, y = surv, color = strata)) + - geom_step(linewidth = 1) + - labs(x = "Time (Months)", y = "Survival Probability") + - scale_y_continuous(labels = scales::percent) -p1 -``` - -## Key Parameters -- `x`: Maps `time` to the x aesthetic -- `y`: Maps `surv` to the y aesthetic -- `color`: Maps `group` to the color aesthetic -- `fill`: Maps `group` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- The tutorial includes a '2. More advanced plot' section with advanced styling options -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable - -## Full Tutorial -https://openbiox.github.io/Bizard/Clinics/KaplanMeierPlot.html diff --git a/skills/Clinics/LollipopPlot_skill.md b/skills/Clinics/LollipopPlot_skill.md deleted file mode 100644 index 0caa1f7b1e..0000000000 --- a/skills/Clinics/LollipopPlot_skill.md +++ /dev/null @@ -1,86 +0,0 @@ -# Skill: Lollipop Plot (R) - -## Category -Clinics - -## When to Use -Create a Lollipop Plot visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- dplyr -- ggplot2 -- ggpubr -- patchwork - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggplot2) -library(ggpubr) -library(patchwork) - -# Prepare data -# Loading data -data <- read.csv('https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/lollipop_1.csv', row.names = 1) # Correlation analysis data reading -# View the dataset -head(data) - -# Create visualization -# Basic Lollipop Plot -# Convert correlation coefficients and p-values to categorical variables -data$pvalue_group <- cut(data$pvalue, - breaks = c(0, 0.2, 0.4, 0.6,0.8, 1), - labels = c("< 0.2","< 0.4","< 0.6","< 0.8","<1"), - right=FALSE)# right=FALSE表示表示区间为左闭右开 -data$cor_group_size <- cut(abs(data$cor),# 绝对值 - breaks = c(0, 0.1, 0.2, 0.3, 0.4, 0.5), - labels = c("0.1","0.2","0.3","0.4","0.5"), - right=FALSE) -# Order -data = data[order(data$cor),] -data$cell = factor(data$cell, levels = data$cell) - -p = ggplot(data, - aes(x = cor, y = cell, color = pvalue_group)) + - scale_color_manual(name="pvalue", - values = c("#146432", - "#4DB748", - #"#FAA519", # Since there is no data in this interval, comment it out. - "#FABECD" #, - #"#FAD700" #Since there is no data in this interval, comment it out. - ))+ # Color selection of candies in lollipops - geom_segment(aes(x = 0, y = cell, xend = cor, yend = cell), - color = 'black', # Drawing of the stick in a lollipop - linewidth = 0.5) + - geom_point(aes(size = cor_group_size))+ # Drawing of candy in lollipop - labs(title = "COL17A1", # Image title - size = "abs(cor)") + # legend name - guides(color = "none")+ # Hide redundant legends - theme_bw()+ - theme(plot.title=element_text(size=8, # title size - hjust=0.5 ), # title position - legend.position = "bottom", # legend position - text = element_text(family = "serif"), # Set the font to Times New Roman - panel.grid = element_line(linetype = "dotted",color='grey')) -p -``` - -## Key Parameters -- `x`: Maps `0` to the x aesthetic -- `y`: Maps `cell` to the y aesthetic -- `color`: Maps `pvalue_group` to the color aesthetic -- `size`: Maps `cor_group_size` to the size aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- The tutorial includes a '3. Beautify Plot' section with advanced styling options -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable - -## Full Tutorial -https://openbiox.github.io/Bizard/Clinics/LollipopPlot.html diff --git a/skills/Clinics/MetaForestPlot_skill.md b/skills/Clinics/MetaForestPlot_skill.md deleted file mode 100644 index 5e55e21d1b..0000000000 --- a/skills/Clinics/MetaForestPlot_skill.md +++ /dev/null @@ -1,87 +0,0 @@ -# Skill: Meta-Analysis Forest Plot (R) - -## Category -Clinics - -## When to Use -Create a Meta-Analysis Forest Plot visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- dplyr -- forestplot -- ggplot2 -- grid -- meta -- metafor -- tidyr - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(forestplot) -library(ggplot2) -library(grid) -library(meta) -library(metafor) - -# Prepare data -# Generate simulated data -set.seed(2023) -n_studies <- 15 -meta_data <- tibble( - `Study Name` = paste("Study", LETTERS[1:n_studies]), - `Odds Ratio` = exp(rnorm(n_studies, mean = 0.2, sd = 0.4)), - `Lower 95% CI` = exp(rnorm(n_studies, mean = 0.1, sd = 0.35)), - `Upper 95% CI` = exp(rnorm(n_studies, mean = 0.3, sd = 0.45)), - `Weight (%)` = runif(n_studies, 0.5, 3), - `Treatment Group` = sample(c("DrugA", "DrugB"), n_studies, replace = TRUE) -) %>% - mutate( - across(c(`Odds Ratio`, `Lower 95% CI`, `Upper 95% CI`), ~round(., 2)), - `Weight (%)` = round(`Weight (%)`/sum(`Weight (%)`)*100, 1), - `Study Name` = factor(`Study Name`, levels = rev(`Study Name`)) - ) - -# View the final merged dataset -head(meta_data) - -# Create visualization -# Basic forest plot -p <- - ggplot(meta_data, aes(x = `Odds Ratio`, y = `Study Name`)) + - geom_vline(xintercept = 1, linetype = "dashed", color = "grey50") + - geom_errorbarh(aes(xmin = `Lower 95% CI`, xmax = `Upper 95% CI`), - height = 0.15, color = "#2c7fb8", linewidth = 0.8) + - geom_point(aes(size = `Weight (%)`), shape = 18, color = "#d95f00") + - scale_x_continuous(trans = "log", - breaks = c(0.25, 0.5, 1, 2, 4), - limits = c(0.2, 5)) + - labs(x = "Odds Ratio (95% CI)", - y = "", - title = "Meta-Analysis Forest Plot", - subtitle = "Random Effects Model") + - theme_minimal(base_size = 12) + - theme( - panel.grid.major.y = element_blank(), - panel.grid.minor.x = element_blank(), - plot.title = element_text(face = "bold", hjust = 0.5), - plot.subtitle = element_text(hjust = 0.5, color = "grey50"), -# ... (see full tutorial for more) -``` - -## Key Parameters -- `y`: Maps `Study_Name` to the y aesthetic -- `x`: Maps `log_OR` to the x aesthetic -- `size`: Maps `Sample_Size` to the size aesthetic -- `fill`: Maps `Effect_Type` to the fill aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable - -## Full Tutorial -https://openbiox.github.io/Bizard/Clinics/MetaForestPlot.html diff --git a/skills/Clinics/MosaicPlot_skill.md b/skills/Clinics/MosaicPlot_skill.md deleted file mode 100644 index e1e88a2da8..0000000000 --- a/skills/Clinics/MosaicPlot_skill.md +++ /dev/null @@ -1,86 +0,0 @@ -# Skill: Mosaic Plot (R) - -## Category -Clinics - -## When to Use -Create a Mosaic Plot visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- dplyr -- ggplot2 -- plyr -- reshape2 -- tidyr -- vcd -- wesanderson - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggplot2) -library(plyr) -library(reshape2) -library(tidyr) -library(vcd) - -# Prepare data -# Generate simulated data -df <- data.frame(segment = c("Patient1", "Patient2", "Patient3","Patient4"), - "Macrophage" = c(2400 ,1200, 600 ,250), - "Epithelial" = c(1000 ,900, 600, 250), - "T cells" = c(400, 600 ,400, 250), - "B cells" = c(200, 300 ,400, 250)) - -melt_df<-melt(df,id="segment") -# Convert numbers to percentages -segpct<-rowSums(df[,2:ncol(df)]) -for (i in 1:nrow(df)){ - for (j in 2:ncol(df)){ - df[i,j]<-df[i,j]/segpct[i]*100 - } -} - -segpct<-segpct/sum(segpct)*100 -df$xmax <- cumsum(segpct) -df$xmin <- (df$xmax - segpct) - -dfm <- melt(df, id = c("segment", "xmin", "xmax"),value.name="percentage") -colnames(dfm)[ncol(dfm)]<-"percentage" - -# The ddply() function uses a custom statistical function to group and calculate data.frame -dfm1 <- ddply(dfm, .(segment), transform, ymax = cumsum(percentage)) -dfm1 <- ddply(dfm1, .(segment), transform,ymin = ymax - percentage) -dfm1$xtext <- with(dfm1, xmin + (xmax - xmin)/2) -dfm1$ytext <- with(dfm1, ymin + (ymax - ymin)/2) - -# join() function, connects two tables data.frame -dfm2<-join(melt_df, dfm1, by = c("segment", "variable"), type = "left", match = "all") - -# View the final merged dataset -head(dfm2) - -# Create visualization -# Basic Plot -p <- ggplot() + - geom_rect(aes(ymin = ymin, ymax = ymax, xmin = xmin, xmax = xmax, fill = variable),dfm2,colour = "black") + - geom_text(aes(x = xtext, y = ytext, label = value),dfm2 ,size = 4)+ - geom_text(aes(x = xtext, y = 103, label = paste(segment)),dfm2 ,size = 4)+ -# ... (see full tutorial for more) -``` - -## Key Parameters -- `fill`: Maps `variable` to the fill aesthetic -- `x`: Maps `116` to the x aesthetic -- `y`: Maps `seq` to the y aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- The tutorial includes a '2. Advanced Plot' section with advanced styling options -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable - -## Full Tutorial -https://openbiox.github.io/Bizard/Clinics/MosaicPlot.html diff --git a/skills/Clinics/Nomogram_skill.md b/skills/Clinics/Nomogram_skill.md deleted file mode 100644 index 1ec32c6e35..0000000000 --- a/skills/Clinics/Nomogram_skill.md +++ /dev/null @@ -1,57 +0,0 @@ -# Skill: Nomogram (R) - -## Category -Clinics - -## When to Use -Simply put, a nomogram graphically displays the results of logistic regression or Cox regression. It uses the regression coefficient of each independent variable to develop a scoring criteria, assigning a score to each independent variable value. A total score is then calculated for each patient, and a conversion function is used to convert this score into the probability of a specific outcome for that patient. - -## Required R Packages -- readr -- regplot -- rms -- survival - -## Minimal Reproducible Code -```r -# Load packages -library(readr) -library(regplot) -library(rms) -library(survival) - -# Prepare data -## Loading data -clinical <- readr::read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-LIHC.clinical.tsv") -LIHC <- cbind(clinical$sample,clinical[,c('gender.demographic', - 'vital_status.demographic', - 'days_to_death.demographic', - 'age_at_index.demographic', - 'ajcc_pathologic_stage.diagnoses')]) -colnames(LIHC) <- c('bcr_patient_barcode','gender','status','time','age','stage') -table(LIHC$status) -LIHC <- LIHC[LIHC$status != 'Not Reported',] -LIHC$status <- as.numeric(ifelse(LIHC$status=='Dead','2','1') ) # Death is 2 in nomogram - -# Create visualization -# Basic Nomogram -dd=datadist(LIHC) -options(datadist="dd") -## Build a logist model and draw a nomogram -f1 <- lrm(status ~ age + gender + stage , data = LIHC) -nom <- nomogram(f1, fun=plogis, lp=F, funlabel="Risk") -plot(nom) -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- The tutorial includes a '2. Beautify Nomogram' section with advanced styling options -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable - -## Full Tutorial -https://openbiox.github.io/Bizard/Clinics/Nomogram.html diff --git a/skills/Clinics/RegressionTable_skill.md b/skills/Clinics/RegressionTable_skill.md deleted file mode 100644 index 5765ed082e..0000000000 --- a/skills/Clinics/RegressionTable_skill.md +++ /dev/null @@ -1,57 +0,0 @@ -# Skill: Regression Analysis Table (R) - -## Category -Clinics - -## When to Use -The regression analysis table is used to display the results of the regression model. It provides statistical information about the variables in the model and helps explain the relationship between the variables. - -## Required R Packages -- broom.helpers -- datawizard -- dplyr -- gtsummary -- survival - -## Minimal Reproducible Code -```r -# Load packages -library(broom.helpers) -library(datawizard) -library(dplyr) -library(gtsummary) -library(survival) - -# Prepare data -df <- pbc %>% - filter(status != 1) %>% - mutate(status = ifelse(status == 2, 1, 0)) %>% - select(2:13) %>% - na.omit() %>% - # Divide `albumin` into 3 groups - mutate(albumin3cat = categorize(albumin, split = "quantile", n_groups = 3)) - -head(df[,1:6]) - -# Create visualization -# Basic regression analysis table -t1 <- coxph(Surv(time, status) ~ albumin + sex + age, - data = df -) %>% - tbl_regression() - -t1 -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Clinics/RegressionTable.html diff --git a/skills/Composition/CircularPacking_skill.md b/skills/Composition/CircularPacking_skill.md deleted file mode 100644 index 372eb07d08..0000000000 --- a/skills/Composition/CircularPacking_skill.md +++ /dev/null @@ -1,96 +0,0 @@ -# Skill: Circular Packing Chart (R) - -## Category -Composition - -## When to Use -Circular Packing can be viewed as a special type of classification tree diagram, which is particularly suitable for displaying classification data with hierarchical relationships. - -## Required R Packages -- circlepackeR -- cowplot -- data.tree -- dplyr -- flare -- ggiraph -- ggplot2 -- ggraph -- htmlwidgets -- igraph -- packcircles -- tidyr -- tidyverse -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(circlepackeR) -library(cowplot) -library(data.tree) -library(dplyr) -library(flare) -library(ggiraph) - -# Prepare data -#GO BP -data_BP <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_BP.csv") - -#flare -data_edges <- flare$edges -data_vertices <- flare$vertices - -#KEGG -data_KEGG <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_KEGG.csv") - -#KEGG_type -data_KEGG_type <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_KEGG_type.csv") -data_KEGG_type$pvalue_log <- -log10(data_KEGG_type$pvalue) -summary(data_KEGG_type) -data_KEGG_type1 <- data_KEGG_type %>% - dplyr::select(type, subtype, PW, pvalue_log, NES) %>% - arrange(type, subtype) - -# Create visualization -## color -data_BP1 <- data_BP -data_BP1$pvalue_log <- -log10(data_BP1$pvalue) -packing_BP <- circleProgressiveLayout(data_BP1$pvalue_log, sizetype='area' ) - - -# Merging plotting data -data_BUBBLE_BP <- cbind(data_BP1, packing_BP) - -# Generate the coordinates of each vertex of the circle, where npoint is the number of vertices. -dat.gg_BP <- circleLayoutVertices(packing_BP, npoints=50) - -# plot -p <- ggplot() + - geom_polygon(data = dat.gg_BP, - aes(x, y, group = id, fill=as.factor(id)), - colour = "black", alpha = 0.6) + - scale_fill_manual(values = magma(nrow(data_BUBBLE_BP))) + # change color - geom_text(data = data_BUBBLE_BP, - aes(x, y, size=pvalue_log, label = str_wrap(BP,width = 10)), - show.legend = FALSE) + - scale_size_continuous(range = c(0.5,1.5)) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `group`: Maps `id` to the group aesthetic -- `fill`: Maps `NES` to the fill aesthetic -- `size`: Maps `pvalue_log` to the size aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Ensure proportions sum to 100% and consider using a colorblind-friendly palette - -## Full Tutorial -https://openbiox.github.io/Bizard/Composition/CircularPacking.html diff --git a/skills/Composition/Dendrogram_skill.md b/skills/Composition/Dendrogram_skill.md deleted file mode 100644 index 29b43c3b5f..0000000000 --- a/skills/Composition/Dendrogram_skill.md +++ /dev/null @@ -1,83 +0,0 @@ -# Skill: Dendrogram (R) - -## Category -Composition - -## When to Use -A dendrogram is a graphical representation of hierarchical relationships between objects. It is widely used in cluster analysis, especially hierarchical clustering, to visualize the similarity or distance between data points. - -## Required R Packages -- collapsibleTree -- dendextend -- ggraph -- igraph -- tidyverse - -## Minimal Reproducible Code -```r -# Load packages -library(collapsibleTree) -library(dendextend) -library(ggraph) -library(igraph) -library(tidyverse) - -# Prepare data -# warpbreaks -data("warpbreaks") -warpbreaks <- warpbreaks %>% - mutate(breaks = as.character(breaks)) - -# Convert nested dataframe data to side list data and then draw a tree diagram. -edges_level1_2 <- warpbreaks %>% - select(wool, tension) %>% - distinct() %>% - rename(from = wool, to = tension) - -edges_level2_3 <- warpbreaks %>% - select(tension, breaks) %>% - distinct() %>% - rename(from = tension, to = breaks) - -edge_list <- bind_rows(edges_level1_2, edges_level2_3) # merge -edge_list_unique <- edge_list[edge_list$from != "B",] -edge_list_unique$to <- make.unique(edge_list_unique$to) - - -# Create a graph object -mygraph_unique <- graph_from_data_frame(edge_list_unique) - -# Hierarchical grouping -V(mygraph_unique)$group <- case_when( - V(mygraph_unique)$name %in% unique(warpbreaks$wool) ~ "Group 1", # root node wool - str_detect(V(mygraph_unique)$name, "^[LMH]") ~ "Group 2", # First layer of tension - str_detect(V(mygraph_unique)$name, "^[0-9]") ~ "Group 3", # Second layer breaks - TRUE ~ "Group 4" # Additional correction layer -) -V(mygraph_unique)$color <- case_when( - V(mygraph_unique)$group == "Group 1" ~ "red", - V(mygraph_unique)$group == "Group 2" ~ "yellow", - V(mygraph_unique)$group == "Group 3" ~ "green", - V(mygraph_unique)$group == "Group 4" ~ "blue" -) - -# mtcars -mtcars %>% - select(mpg, cyl, disp) %>% - dist() %>% -# ... (see full tutorial for more) -``` - -## Key Parameters -- `color`: Maps `color` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Ensure proportions sum to 100% and consider using a colorblind-friendly palette -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Composition/Dendrogram.html diff --git a/skills/Composition/Donut_skill.md b/skills/Composition/Donut_skill.md deleted file mode 100644 index 577d0e29fb..0000000000 --- a/skills/Composition/Donut_skill.md +++ /dev/null @@ -1,57 +0,0 @@ -# Skill: Donut Chart (R) - -## Category -Composition - -## When to Use -A donut chart is a circular plot divided into sectors, each sector representing a part of the whole. It is very similar to a pie chart and can be constructed in ggplot2 and basic R. - -## Required R Packages -- ggplot2 - -## Minimal Reproducible Code -```r -# Load packages -library(ggplot2) - -# Prepare data -# 1.TCGA database (clinical data on lung cancer in 2020) -TCGA_cli_df <- readr::read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/raponi2006_public_raponi2006_public_clinicalMatrix.gz") - -# 2.R built-in data - mtcars -head(mtcars) - -# Create visualization -# Data Preparation -counts <- table(TCGA_cli_df$T) -counts <- as.data.frame(counts) -names(counts)[names(counts) == "Var1"] <- "T" -# Calculate percentage -counts$fraction = counts$Freq / sum(counts$Freq) -# Calculate the cumulative percentage (the value at the top of each rectangle). -counts$ymax = cumsum(counts$fraction) -# Calculate the bottom of each rectangle to determine the starting position -counts$ymin = c(0, head(counts$ymax, n=-1)) -# Plot -p <- ggplot(counts, aes(ymax=ymax, ymin=ymin, xmax=4, xmin=3, fill=T)) + - geom_rect() + - coord_polar(theta="y") + - xlim(c(2, 4)) - -p -``` - -## Key Parameters -- `fill`: Maps `cyl` to the fill aesthetic -- `y`: Maps `labelPosition` to the y aesthetic -- `color`: Maps `cyl` to the color aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Ensure proportions sum to 100% and consider using a colorblind-friendly palette - -## Full Tutorial -https://openbiox.github.io/Bizard/Composition/Donut.html diff --git a/skills/Composition/GroupedBarplot_skill.md b/skills/Composition/GroupedBarplot_skill.md deleted file mode 100644 index 93b7d9f3a5..0000000000 --- a/skills/Composition/GroupedBarplot_skill.md +++ /dev/null @@ -1,90 +0,0 @@ -# Skill: Grouped and Stacked Barplot (R) - -## Category -Composition - -## When to Use -Grouped bar charts, or clustered bar charts, extend the functionality of univariate or single-category bar charts to multivariate bar charts. In these charts, bars are grouped according to their categories, and colors represent distinguishing factors for other categorical variables. The bars are positioned to cater to a group or primary group, with colors representing secondary categories. Grouped bar charts are particularly suitable for displaying the distribution of multiple groups of categ... - -## Required R Packages -- RColorBrewer -- dplyr -- ggplot2 -- hrbrthemes -- streamgraph -- tibble -- tidyr -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(dplyr) -library(ggplot2) -library(hrbrthemes) -library(streamgraph) -library(tibble) - -# Prepare data -# iris -iris_means <- iris %>% - group_by(Species) %>% - summarise( - mean_sepal_length = mean(Sepal.Length), - mean_sepal_width = mean(Sepal.Width), - mean_petal_length = mean(Petal.Length), - mean_petal_width = mean(Petal.Width) - ) # Calculate the mean of the four columns for each species. - -iris_means_long <- iris_means %>% - pivot_longer( - cols = starts_with("mean"), - names_to = "Measurement", - values_to = "Value" - ) - -iris_means_df <- as.data.frame(iris_means) %>% - column_to_rownames(var = "Species") -iris_matrix <- as.matrix(iris_means_df) -iris_percentage <- apply(iris_matrix, 2, function(x) { x * 100 / sum(x, na.rm = TRUE) }) - -# TCGA-CHOL.methylation450 -TCGA_methylation <- readr::read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-CHOL.methylation450_.tsv") - -methylation_subset <- TCGA_methylation[c(5:9),c(4:13)] -methylation_subset <- as.data.frame(methylation_subset) -rownames(methylation_subset) <- c("cg236", "cg289", "cg292", "cg321", "cg363") -colnames(methylation_subset) <- substr(colnames(methylation_subset), 9, 12) - -methylation_long <- methylation_subset %>% - rownames_to_column(var = "Composite") %>% - pivot_longer(cols = -Composite, names_to = "sample", values_to = "value") - -methylation_long$sample <- as.numeric(factor(methylation_long$sample, levels = unique(methylation_long$sample))) # Convert the sample column to ordered values. - -# TCGA-STAD.star_counts -TCGA_star <- readr::read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-STAD.star_counts.tsv") - -selected_rows <- TCGA_star[TCGA_star$Ensembl_ID %in% c("ENSG00000141510.18", - "ENSG00000141736.14", -# ... (see full tutorial for more) -``` - -## Key Parameters -- `fill`: Maps `Measurement` to the fill aesthetic -- `y`: Maps `Mean_Value` to the y aesthetic -- `x`: Maps `Gene` to the x aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- Ensure proportions sum to 100% and consider using a colorblind-friendly palette - -## Full Tutorial -https://openbiox.github.io/Bizard/Composition/GroupedBarplot.html diff --git a/skills/Composition/PartPieChart_skill.md b/skills/Composition/PartPieChart_skill.md deleted file mode 100644 index fbc82447de..0000000000 --- a/skills/Composition/PartPieChart_skill.md +++ /dev/null @@ -1,71 +0,0 @@ -# Skill: Part highlights the pie chart (R) - -## Category -Composition - -## When to Use -Create a Part highlights the pie chart visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- dplyr -- ggforce -- ggplot2 -- ggpubr -- patchwork -- plotrix - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggforce) -library(ggplot2) -library(ggpubr) -library(patchwork) -library(plotrix) - -# Prepare data -# Generate simulated data -count.data <- data.frame( - class = c("1st", "2nd", "3rd", "Crew"), - n = c(325, 285, 706, 885), - prop = c(14.8, 12.9, 32.1, 40.2) -) -# Add label position -count.data <- count.data %>% - arrange(desc(class)) %>% - mutate(lab.ypos = cumsum(prop) - 0.5*prop) -# View the final merged dataset -head(count.data) - -# Create visualization -# Basic pie chart -mycols <- c("#0073C2FF", "#EFC000FF", "#868686FF", "#CD534CFF") -p <- - ggplot(count.data, aes(x = "", y = prop, fill = class)) + - geom_bar(width = 1, stat = "identity", color = "white") + - coord_polar("y", start = 0)+ - geom_text(aes(y = lab.ypos, label = prop), color = "white")+ - scale_fill_manual(values = mycols) + - theme_void() - -p -``` - -## Key Parameters -- `y`: Maps `lab` to the y aesthetic -- `fill`: Maps `gene` to the fill aesthetic -- `x`: Maps `2` to the x aesthetic -- `color`: Maps `gene` to the color aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- The tutorial includes a '2. Advanced Plot' section with advanced styling options -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Ensure proportions sum to 100% and consider using a colorblind-friendly palette - -## Full Tutorial -https://openbiox.github.io/Bizard/Composition/PartPieChart.html diff --git a/skills/Composition/PieChart_skill.md b/skills/Composition/PieChart_skill.md deleted file mode 100644 index c687830b02..0000000000 --- a/skills/Composition/PieChart_skill.md +++ /dev/null @@ -1,47 +0,0 @@ -# Skill: Pie Chart (R) - -## Category -Composition - -## When to Use -A pie chart is a basic chart in statistics, using sectors of different sizes to represent the magnitude of each item. A pie chart provides a visual understanding of the proportion of each data point within the overall data. - -## Required R Packages -- ggplot2 - -## Minimal Reproducible Code -```r -# Load packages -library(ggplot2) - -# Prepare data -# Data writing: one column for grouping, one column for values. -data <- data.frame( - group = c("I", "II", "III", "IV", "NA"), - value = c(402, 955, 1252, 3343, 3567) -) - -head(data) - -# Create visualization -# Basic drawing - bar chart -p <- ggplot(data, aes(x = "", y = value, fill = group)) + - geom_col() # First, draw a bar chart, then transform it into a pie chart using coord_polar(). - -p -``` - -## Key Parameters -- `y`: Maps `value` to the y aesthetic -- `fill`: Maps `group` to the fill aesthetic -- `x`: Maps `rep_len` to the x aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Ensure proportions sum to 100% and consider using a colorblind-friendly palette - -## Full Tutorial -https://openbiox.github.io/Bizard/Composition/PieChart.html diff --git a/skills/Composition/Treemap_skill.md b/skills/Composition/Treemap_skill.md deleted file mode 100644 index 8f1202ac99..0000000000 --- a/skills/Composition/Treemap_skill.md +++ /dev/null @@ -1,65 +0,0 @@ -# Skill: Treemap (R) - -## Category -Composition - -## When to Use -A treemap, also known as a rectangular tree structure diagram, is composed of multiple nested rectangles of varying areas. The sum of the areas of all rectangles represents the overall data. The area of each smaller rectangle represents the proportion of each sub-item; the larger the rectangle's area, the larger the proportion of that sub-item within the whole. - -## Required R Packages -- DOSE -- palmerpenguins -- tidyverse -- treemap - -## Minimal Reproducible Code -```r -# Load packages -library(DOSE) -library(palmerpenguins) -library(tidyverse) -library(treemap) - -# Prepare data -data_USArrests <- rownames_to_column(USArrests[1:8,], "State") - -data_swiss <- swiss - -data_countsub <- aggregate(penguins, by=list(penguins$species, penguins$sex),length) -data_countsub <- data_countsub[ ,1:3] -colnames(data_countsub) <- c("species", "sex", "count") - -data_BP <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_BP.csv") -data_BP <- data_BP[order(abs(data_BP$NES), decreasing = T),] -data_BP <- data_BP[1:13,] - -data_KEGG_type <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_KEGG.csv") -data_KEGG_type$pvalue_log <- -log10(data_KEGG_type$pvalue) - -# Create visualization -treemap(data_USArrests, # data - index = "State", # Categorical variables - vSize = "Murder", # Categorical variable corresponding data values - vColor="State", # The corresponding columns of color depth, here the data size is used as the corresponding - type = "index", # Color mapping method, including "index", "value", "comp", "dens", "depth", "categorical", "color", and "manual". - title = 'Murder', # title - border.col = "grey", # Border color - border.lwds = 4, # Border line width - fontsize.labels = 12, # Label size - fontcolor.labels = 'red', # Label color - align.labels = list(c("center", "center")), # Tag location - fontface.labels = 2) # Tag fonts: 1, 2, 3, 4 represent normal, bold, italic, and bold italic fonts, respectively. -``` - -## Key Parameters -- `width`: Controls element width -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Ensure proportions sum to 100% and consider using a colorblind-friendly palette -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Composition/Treemap.html diff --git a/skills/Composition/Waffle_skill.md b/skills/Composition/Waffle_skill.md deleted file mode 100644 index 68befe9b92..0000000000 --- a/skills/Composition/Waffle_skill.md +++ /dev/null @@ -1,58 +0,0 @@ -# Skill: Waffle Chart (R) - -## Category -Composition - -## When to Use -A waffle chart visually represents categorical data using a grid of small squares that resemble waffles. Each category is assigned a unique color, and the number of squares assigned to each category corresponds to its proportion in the total data count. - -## Required R Packages -- dplyr -- ggplot2 -- waffle - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggplot2) -library(waffle) - -# Prepare data -# 1.TCGA database (clinical data on lung cancer in 2020) -TCGA_cli_df <- readr::read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/raponi2006_public_raponi2006_public_clinicalMatrix.gz") -# Data Preparation -counts <- table(TCGA_cli_df$T) -counts <- as.data.frame(counts) -names(counts)[names(counts) == "Var1"] <- "T" - -# 2.R built-in data - mtcars -counts1 <- table(mtcars$cyl) -counts1 <- as.data.frame(counts1) -names(counts1)[names(counts1) == "Var1"] <- "cyl" - -# 3.Self-created dataset -data <- data.frame( - group = c("First group", "First group", "First group", "First group", - "First group", "First group", "Second group", "Second group", - "Second group", "Second group", "Third group", "Third group"), - subgroup = c("A", "B", "C", "D", "E", "F", "A", "B", "C", "D", "A", "B"), - value = c(10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120) -) - -# Create visualization -waffle(counts) -``` - -## Key Parameters -- `fill`: Maps `subgroup` to the fill aesthetic -- `theme`: Plot theme; tutorial uses `theme_void()` -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- Ensure proportions sum to 100% and consider using a colorblind-friendly palette - -## Full Tutorial -https://openbiox.github.io/Bizard/Composition/Waffle.html diff --git a/skills/Correlation/Biplot_skill.md b/skills/Correlation/Biplot_skill.md deleted file mode 100644 index 61c4c2a880..0000000000 --- a/skills/Correlation/Biplot_skill.md +++ /dev/null @@ -1,50 +0,0 @@ -# Skill: Biplot (R) - -## Category -Correlation - -## When to Use -Create a Biplot visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- dplyr -- ggbiplot - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggbiplot) - -# Prepare data -data("iris") -head(iris) - -# Create visualization -iris.gg <- - ggbiplot(iris.pca, obs.scale = 1, var.scale = 1, - groups = iris$Species, point.size=2, - varname.size = 3, - varname.color = "black", - varname.adjust = 1.2, - ellipse = TRUE, - circle = TRUE) + - labs(fill = "Species", color = "Species") + - theme_minimal(base_size = 14) + - theme(legend.direction = 'horizontal', legend.position = 'top') - -iris.gg -``` - -## Key Parameters -- `x`: Maps `xvar` to the x aesthetic -- `y`: Maps `yvar` to the y aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Always check and report the correlation coefficient and p-value alongside visual patterns - -## Full Tutorial -https://openbiox.github.io/Bizard/Correlation/Biplot.html diff --git a/skills/Correlation/Bubble_skill.md b/skills/Correlation/Bubble_skill.md deleted file mode 100644 index ef3ab4de31..0000000000 --- a/skills/Correlation/Bubble_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Bubble Plot (R) - -## Category -Correlation - -## When to Use -A bubble plot is a scatter plot in which a third numeric variable is mapped to the size of the circles. This article shows several ways to build bubble charts using R. - -## Required R Packages -- dplyr -- gapminder -- ggplot2 -- hrbrthemes -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(gapminder) -library(ggplot2) -library(hrbrthemes) -library(viridis) - -# Prepare data -# R built-in data - iris -head(iris) - -# TCGA database (using clinical data on lung cancer in 2020) -TCGA_clinic <- readr::read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/raponi2006_public_raponi2006_public_clinicalMatrix.gz") -TCGA_clinic$T <- as.factor(TCGA_clinic$T) - -# gapminder package -data <- gapminder %>% - filter(year=="2007") %>% - dplyr::select(-year) - -# Create visualization -# Taking iris data as an example -p <- ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, size = Species)) + - geom_point(alpha=0.4) - -p -``` - -## Key Parameters -- `x`: Maps `Sepal` to the x aesthetic -- `y`: Maps `Sepal` to the y aesthetic -- `size`: Maps `Species` to the size aesthetic -- `color`: Maps `Species` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_ipsum()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Always check and report the correlation coefficient and p-value alongside visual patterns - -## Full Tutorial -https://openbiox.github.io/Bizard/Correlation/Bubble.html diff --git a/skills/Correlation/ComplexHeatmap_skill.md b/skills/Correlation/ComplexHeatmap_skill.md deleted file mode 100644 index dae2068e3c..0000000000 --- a/skills/Correlation/ComplexHeatmap_skill.md +++ /dev/null @@ -1,59 +0,0 @@ -# Skill: ComplexHeatmap (R) - -## Category -Correlation - -## When to Use -Create a ComplexHeatmap visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- ComplexHeatmap -- circlize -- dendextend -- gridExtra -- pheatmap -- tidyr - -## Minimal Reproducible Code -```r -# Load packages -library(ComplexHeatmap) -library(circlize) -library(dendextend) -library(gridExtra) -library(pheatmap) -library(tidyr) - -# Prepare data -# data_mat (continuous) -data <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA.BRCA.sampleMap_HumanMethylation27_ch.csv") - -data <- as.data.frame(data) -rownames(data) <- data[,1] -data <- data[,-1] - -data_TCGA <- na.omit(data[1:20,1:20]) - -data_TCGA <- as.matrix(data_TCGA) - -# Discrete -discrete_mat = matrix(sample(1:5, 100, replace = TRUE), 10, 10) - -# Create visualization -# Continuous variables -Heatmap(data_TCGA , name = "Methylation") -``` - -## Key Parameters -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- The tutorial includes a '2. Customization' section with advanced styling options -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Always check and report the correlation coefficient and p-value alongside visual patterns - -## Full Tutorial -https://openbiox.github.io/Bizard/Correlation/ComplexHeatmap.html diff --git a/skills/Correlation/ConnectedScatter_skill.md b/skills/Correlation/ConnectedScatter_skill.md deleted file mode 100644 index 12b41837bc..0000000000 --- a/skills/Correlation/ConnectedScatter_skill.md +++ /dev/null @@ -1,72 +0,0 @@ -# Skill: Connected Scatter (R) - -## Category -Correlation - -## When to Use -Connected scatter is a type of chart that builds upon scatter by adding lines to connect the data points in a certain order. It allows us to discern not only the correlation between independent variable and dependent variable but also the trend in the data points. - -## Required R Packages -- dplyr -- ggplot2 -- stringr - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggplot2) -library(stringr) - -# Prepare data -# 1.Load iris data -data("iris", package = "datasets") -data <- iris - -# 2. Load and filter time series data -# To simplify the plotting process, only the data from December is selected to represent the entire year -data_economics <- economics %>% - select(date, psavert, uempmed) %>% - filter(str_detect(date, "-12-01")) %>% - slice_head(n = 25) %>% - mutate(date = str_extract(date, "^\\d{4}")) %>% #extracts the 4-digit year from the beginning of each date string. - select(date, psavert, uempmed) - -# 3.Load gene expression data (first two rows) -data_counts <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/GSE243555_all_genes_with_counts.txt", sep = "\t", header = TRUE, nrows = 10) - -axis_names <- data_counts[c(1, 2), 1] # Save names - -data_counts <- data_counts %>% - select(-1) %>% # Remove first column - slice(1:2) %>% # remain the first two rows - t() %>% # Transpose - as.data.frame() %>% - setNames(c("V1", "V2")) # Set column names - -head(data_counts) - -# Create visualization -# Basic plotting, only adding `geom_line` -p <- ggplot(data[data$Species == "setosa", ], aes(x = Sepal.Width, y = Sepal.Length)) + - geom_point(shape = 17, size = 1.5, color = "blue") + - geom_line() - -p -``` - -## Key Parameters -- `x`: Maps `Sepal` to the x aesthetic -- `y`: Maps `Sepal` to the y aesthetic -- `color`: Maps `Species` to the color aesthetic -- `shape`: Maps `Species` to the shape aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Always check and report the correlation coefficient and p-value alongside visual patterns -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Correlation/ConnectedScatter.html diff --git a/skills/Correlation/Correlogram_skill.md b/skills/Correlation/Correlogram_skill.md deleted file mode 100644 index 80de7081c6..0000000000 --- a/skills/Correlation/Correlogram_skill.md +++ /dev/null @@ -1,45 +0,0 @@ -# Skill: Correlogram (R) - -## Category -Correlation - -## When to Use -Correlogram or Correlation diagrams are often used to summarize the correlation information of various groups of data in the entire dataset. - -## Required R Packages -- GGally -- corrgram -- corrplot -- ggcorrplot - -## Minimal Reproducible Code -```r -# Load packages -library(GGally) -library(corrgram) -library(corrplot) -library(ggcorrplot) - -# Prepare data -data("flea", package = "GGally") -data_flea <- flea - -data("mtcars", package = "datasets") -data_mtcars <- mtcars - -data("tips", package = "GGally") -data_tips <- tips -``` - -## Key Parameters -- `colour`: Maps `species` to the colour aesthetic -- `alpha`: Maps `0` to the alpha aesthetic -- `stat`: Statistical transformation to use - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Always check and report the correlation coefficient and p-value alongside visual patterns -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Correlation/Correlogram.html diff --git a/skills/Correlation/Density2D_skill.md b/skills/Correlation/Density2D_skill.md deleted file mode 100644 index 4c4ee3d818..0000000000 --- a/skills/Correlation/Density2D_skill.md +++ /dev/null @@ -1,65 +0,0 @@ -# Skill: 2D Density (R) - -## Category -Correlation - -## When to Use -A 2D density plot shows the distribution of a combination of two numerical variables, using color gradients (or contour lines) to indicate the number of observations within an area. This can be used to identify trends in a dataset and analyze relationships between two variables. Scatter plots can be difficult to interpret when displaying large datasets because the points overlap and cannot be individually distinguished. In these cases, a two-dimensional density plot is useful. - -## Required R Packages -- MASS -- RColorBrewer -- ggplot2 -- hexbin -- mvtnorm -- patchwork -- plotly - -## Minimal Reproducible Code -```r -# Load packages -library(MASS) -library(RColorBrewer) -library(ggplot2) -library(hexbin) -library(mvtnorm) -library(patchwork) - -# Prepare data -# mtcars -data_mtcars <- mtcars[, c("mpg", "hp")] - -# TCGA-BRCA.star_counts -tcga_raw <- readr::read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.star_counts.tsv") - -tcga_tp53_mdm2 <- tcga_raw[tcga_raw$Ensembl_ID %in% c("ENSG00000141510.18", "ENSG00000131747.15"), ] -TP53_values <- tcga_tp53_mdm2[1, -1] -MDM2_values <- tcga_tp53_mdm2[2, -1] - -data_tcga <- data.frame(TP53 = as.numeric(TP53_values), - MDM2 = as.numeric(MDM2_values)) - -# Create visualization -# 2D Histogram -p <- ggplot(data_tcga, aes(x = TP53, y = MDM2)) + - geom_bin2d() + - labs(fill = "Gene_expression\n(STAR_counts)") + - theme_bw() - -p -``` - -## Key Parameters -- `x`: Maps `TP53` to the x aesthetic -- `y`: Maps `MDM2` to the y aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Always check and report the correlation coefficient and p-value alongside visual patterns - -## Full Tutorial -https://openbiox.github.io/Bizard/Correlation/Density2D.html diff --git a/skills/Correlation/Heatmap_skill.md b/skills/Correlation/Heatmap_skill.md deleted file mode 100644 index c5e1ccfbee..0000000000 --- a/skills/Correlation/Heatmap_skill.md +++ /dev/null @@ -1,99 +0,0 @@ -# Skill: Heatmap (R) - -## Category -Correlation - -## When to Use -A heatmap is a powerful visualization tool that represents matrix values through color gradients. It is widely used to illustrate gene expression differences across sample groups, variations in compound concentrations, and pairwise sample similarities. More broadly, any tabular dataset can be structured into a heatmap to enhance interpretability. - -## Required R Packages -- ComplexHeatmap -- RColorBrewer -- circlize -- cowplot -- d3heatmap -- dplyr -- ggplot2 -- gridExtra -- heatmaply -- hrbrthemes -- htmlwidgets -- lattice -- pheatmap -- plotly -- readr -- tibble -- tidyr -- tidyverse -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(ComplexHeatmap) -library(RColorBrewer) -library(circlize) -library(cowplot) -library(d3heatmap) -library(dplyr) - -# Prepare data -# load built-in R datasets `mtcars` -data("mtcars", package = "datasets") -mtcars_matrix <- as.matrix(mtcars) - -# Load and process methylation data -raw_methylation_data <- readr::read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-CHOL.methylation450.tsv") - -# Convert to matrix and clean up row/column names -methylation_matrix <- raw_methylation_data[, -1] %>% - as.data.frame() %>% - `rownames<-`(raw_methylation_data$Composite) - -# Tidy to long format -methylation_long <- methylation_matrix %>% - rownames_to_column("Composite") %>% - pivot_longer(cols = -Composite, names_to = "Sample", values_to = "Methylation_Level") %>% - mutate( - Methylation_Level = as.numeric(Methylation_Level), - Composite = gsub("^cg0+", "cg", Composite), - Sample = substr(Sample, 9, 12) - ) - -# Standardize methylation values -methylation_long_standardized <- methylation_long %>% - group_by(Composite) %>% - mutate(Standardized_Level = scale(Methylation_Level)[,1]) %>% - ungroup() - -# Convert back to wide format matrix -standardized_methylation_matrix <- methylation_long_standardized %>% - select(Composite, Sample, Standardized_Level) %>% - pivot_wider(names_from = Sample, values_from = Standardized_Level) %>% - column_to_rownames("Composite") %>% - as.matrix() - - -# Clean up raw methylation matrix (numerical version for raw heatmap) -methylation_matrix_num <- methylation_matrix %>% - mutate(across(everything(), ~ as.numeric(as.character(.)))) %>% - `rownames<-`(gsub("^cg0+", "cg", rownames(.))) %>% - { `colnames<-`(., substr(colnames(.), 9, 12)) } %>% -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `Sample` to the x aesthetic -- `y`: Maps `Composite` to the y aesthetic -- `fill`: Maps `Standardized_Level` to the fill aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_ipsum()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Always check and report the correlation coefficient and p-value alongside visual patterns - -## Full Tutorial -https://openbiox.github.io/Bizard/Correlation/Heatmap.html diff --git a/skills/Correlation/PCAplot_skill.md b/skills/Correlation/PCAplot_skill.md deleted file mode 100644 index 672233c548..0000000000 --- a/skills/Correlation/PCAplot_skill.md +++ /dev/null @@ -1,53 +0,0 @@ -# Skill: PCA Plot (R) - -## Category -Correlation - -## When to Use -Create a PCA Plot visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- FactoMineR -- dplyr -- factoextra -- ggfortify -- ggplot2 - -## Minimal Reproducible Code -```r -# Load packages -library(FactoMineR) -library(dplyr) -library(factoextra) -library(ggfortify) -library(ggplot2) - -# Prepare data -data("iris") -head(iris) - -# Create visualization -fviz_eig(iris.pca, - addlabels = TRUE, - ylim = c(0, 85), - main = "PCA variance explained proportion", - xlab = "PC", - ylab = "Percentage of variance explained") -``` - -## Key Parameters -- `x`: Maps `PC1` to the x aesthetic -- `y`: Maps `PC2` to the y aesthetic -- `color`: Maps `Species` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Always check and report the correlation coefficient and p-value alongside visual patterns - -## Full Tutorial -https://openbiox.github.io/Bizard/Correlation/PCAplot.html diff --git a/skills/Correlation/Scatter_skill.md b/skills/Correlation/Scatter_skill.md deleted file mode 100644 index 68fcbdee4d..0000000000 --- a/skills/Correlation/Scatter_skill.md +++ /dev/null @@ -1,69 +0,0 @@ -# Skill: Scatter Plot (R) - -## Category -Correlation - -## When to Use -A scatter plot is a basic visualization chart used to represent the general trend of the dependent variable changing with the independent variable. - -## Required R Packages -- dplyr -- geomtextpath -- ggExtra -- ggplot2 -- ggpmisc -- ggpubr -- plotly - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(geomtextpath) -library(ggExtra) -library(ggplot2) -library(ggpmisc) -library(ggpubr) - -# Prepare data -# 1.Load iris data -data <- iris - -# 2.Load gene expression data (first two rows) -data_counts <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/GSE243555_all_genes_with_counts.txt", sep = "\t", header = TRUE, nrows = 10) - -axis_names <- data_counts[c(1, 2), 1] # Save names -data_counts <- data_counts %>% - select(-1) %>% # Remove first column - slice(1:2) %>% # remain the first two rows - t() %>% # Transpose - as.data.frame() %>% - setNames(c("V1", "V2")) # Set column names - -head(data_counts) - -# Create visualization -# Basic plotting -p <- ggplot(data, aes(x = Sepal.Width, y = Sepal.Length)) + - geom_point() - -p -``` - -## Key Parameters -- `x`: Maps `Sepal` to the x aesthetic -- `y`: Maps `Sepal` to the y aesthetic -- `color`: Maps `Species` to the color aesthetic -- `shape`: Maps `Species` to the shape aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Always check and report the correlation coefficient and p-value alongside visual patterns -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Correlation/Scatter.html diff --git a/skills/Correlation/TernaryPlot_skill.md b/skills/Correlation/TernaryPlot_skill.md deleted file mode 100644 index 0884a4162b..0000000000 --- a/skills/Correlation/TernaryPlot_skill.md +++ /dev/null @@ -1,48 +0,0 @@ -# Skill: Ternary chart (R) - -## Category -Correlation - -## When to Use -A ternary chart is a type of chart used to display the proportional relationship between three variables. These three variables typically represent a certain component (such as chemical composition, species ratio, nutritional structure, etc.), and their sum is a constant, with the most common being 1 or 100%. A ternary chart uses an equilateral triangle to represent the proportional relationship between these three variables, with each point's position reflecting the relative proportion of th... - -## Required R Packages -- ggtern -- ggthemes - -## Minimal Reproducible Code -```r -# Load packages -library(ggtern) -library(ggthemes) - -# Prepare data -# Load data -data <- read.table("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/Tern_data.txt", header=T, row.names=1, sep="\t", comment.char = "") -# View data -head(data[,1:5]) - -# Create visualization -# Basic Ternary Chart -p1_1 <- ggtern(data=data, aes(x=CK, y=NPK, z=NPKM)) + - geom_mask() + - geom_point(aes(size=size,color=Genus),alpha=0.8) -p1_1 -``` - -## Key Parameters -- `x`: Maps `CK` to the x aesthetic -- `y`: Maps `NPK` to the y aesthetic -- `size`: Maps `size` to the size aesthetic -- `color`: Maps `Genus` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `theme`: Plot theme; tutorial uses `theme_tropical()` - -## Tips -- The tutorial includes a '3. Beautify plots' section with advanced styling options -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Always check and report the correlation coefficient and p-value alongside visual patterns - -## Full Tutorial -https://openbiox.github.io/Bizard/Correlation/TernaryPlot.html diff --git a/skills/Correlation/UMAPplot_skill.md b/skills/Correlation/UMAPplot_skill.md deleted file mode 100644 index b731a58ffe..0000000000 --- a/skills/Correlation/UMAPplot_skill.md +++ /dev/null @@ -1,68 +0,0 @@ -# Skill: UMAP Plot (R) - -## Category -Correlation - -## When to Use -Create a UMAP Plot visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- RColorBrewer -- Seurat -- SeuratData -- dplyr -- ggplot2 -- mlbench -- patchwork -- umap - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(Seurat) -library(SeuratData) -library(dplyr) -library(ggplot2) -library(mlbench) - -# Prepare data -data(BreastCancer) -wdbc_data <- BreastCancer[, -1] # Remove the ID column -wdbc_data <- na.omit(wdbc_data) -features <- wdbc_data[, 1:9] # Using the first 9 features -features <- as.data.frame(lapply(features, function(x) as.numeric(as.character(x)))) -diagnosis <- wdbc_data$Class -head(features) - -# Create visualization -set.seed(123) -wdbc_umap <- umap(features, - n_neighbors = 15, - min_dist = 0.2, - metric = "euclidean") - -ggplot(data.frame(wdbc_umap$layout, Diagnosis = diagnosis), - aes(X1, X2, color = Diagnosis)) + - geom_point(size = 3, alpha = 0.8) + - stat_ellipse(level = 0.9) + - theme_minimal() + - labs(title = "UMAP of Wisconsin Breast Cancer Dataset", - x = "UMAP1", y = "UMAP2", - subtitle = "n_neighbors=15, min_dist=0.2") + - scale_color_manual(values = c("benign" = "#1b9e77", "malignant" = "#d95f02")) -``` - -## Key Parameters -- `color`: Maps `CellType` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Always check and report the correlation coefficient and p-value alongside visual patterns - -## Full Tutorial -https://openbiox.github.io/Bizard/Correlation/UMAPplot.html diff --git a/skills/DataOverTime/AreaChart_skill.md b/skills/DataOverTime/AreaChart_skill.md deleted file mode 100644 index 01eb9fe514..0000000000 --- a/skills/DataOverTime/AreaChart_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Area Chart (R) - -## Category -DataOverTime - -## When to Use -An area chart is a line chart in which the area below the line is filled with color. It is mainly used to display values at continuous intervals or over a time span. - -## Required R Packages -- dygraphs -- ggpattern -- hrbrthemes -- tidyverse -- viridis -- xts - -## Minimal Reproducible Code -```r -# Load packages -library(dygraphs) -library(ggpattern) -library(hrbrthemes) -library(tidyverse) -library(viridis) -library(xts) - -# Prepare data -# TCGA-BRCA.survival.tsv -tcga_brca_survival <- readr::read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.survival.tsv") - -tcga_brca_filtered <- tcga_brca_survival %>% - filter(OS.time <= 2000) %>% - mutate(month = floor(OS.time / 30)) - -monthly_death_counts <- tcga_brca_filtered %>% - filter(OS == 1) %>% - group_by(month) %>% - summarise(deaths = n()) - -# AirPassengers -data("AirPassengers") -air_passenger_data <- as.data.frame(AirPassengers) - -air_passenger_data$Month <- rep(month.name, 12) -air_passenger_data$Year <- rep(1949:1960, each=12) -air_passenger_data$x <- as.numeric(air_passenger_data$x) - -air_passenger_long <- air_passenger_data %>% - gather(key = "Variable", value = "Value", -Year, -Month) - -air_passenger_percentage <- air_passenger_long %>% - group_by(Year) %>% - mutate(Percentage = Value / sum(Value) * 100) # Calculate the percentage for each month - -air_passenger_time_series <- data.frame(datetime = time(AirPassengers), count = as.vector(AirPassengers)) - -air_passenger_time_series$datetime <- as.Date(air_passenger_time_series$datetime) -air_passenger_xts <- xts(x = air_passenger_time_series$count, order.by = air_passenger_time_series$datetime) # Creating an XTS object - -# Create visualization -# Basic area plot -p <- ggplot(monthly_death_counts, aes(x = month, y = deaths)) + - geom_area() + - labs(title = "Cumulative Deaths Over Time", - x = "Months", - y = "Number of Deaths") - -p -``` - -## Key Parameters -- `x`: Maps `Year` to the x aesthetic -- `y`: Maps `Percentage` to the y aesthetic -- `fill`: Maps `Month` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `theme`: Plot theme; tutorial uses `theme_ipsum()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Highlight key time points or events with vertical reference lines or annotations - -## Full Tutorial -https://openbiox.github.io/Bizard/DataOverTime/AreaChart.html diff --git a/skills/DataOverTime/CalendHighlight_skill.md b/skills/DataOverTime/CalendHighlight_skill.md deleted file mode 100644 index ed15b0cd9a..0000000000 --- a/skills/DataOverTime/CalendHighlight_skill.md +++ /dev/null @@ -1,77 +0,0 @@ -# Skill: Calend Highlight (R) - -## Category -DataOverTime - -## When to Use -Date highlighting marks are mainly used to display changes in data within certain specific date ranges in time series data, and can be used for an overview of activity frequencies and marking of special dates. - -## Required R Packages -- calendR - -## Minimal Reproducible Code -```r -# Load packages -library(calendR) - -# Prepare data -# Construct data -set.seed(1) -data <- rnorm(365) - -# View data -head(data) - -# Create visualization -# Chinese Calendar -p <- calendR( - year = 2025, - month = NULL, - from = NULL, - to = NULL, - start = "M", - mbg.col = 2, - # orientation = "portrait", - months.col = "white", - months.pos = 0.5, - monthnames = c( - "一月", - "二月", - "三月", - "四月", - "五月", - "六月", - "七月", - "八月", - "九月", - "十月", - "十一月", - "十二月" - ), - weeknames = c("一", "二", "三", "四", "五", "六", "日"), - special.days = data, - special.col = "#00338888", - gradient = TRUE, - low.col = "#FFFFFF88", - font.family = "sans", - font.style = "plain", - day.size = 2, - # ncol = 2, - lunar = FALSE, - pdf = FALSE -) - -# ... (see full tutorial for more) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Highlight key time points or events with vertical reference lines or annotations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/DataOverTime/CalendHighlight.html diff --git a/skills/DataOverTime/LineChart_skill.md b/skills/DataOverTime/LineChart_skill.md deleted file mode 100644 index 5246cefa40..0000000000 --- a/skills/DataOverTime/LineChart_skill.md +++ /dev/null @@ -1,87 +0,0 @@ -# Skill: Line Chart (R) - -## Category -DataOverTime - -## When to Use -Drawing line segments in various charts is common, and this module will draw all kinds of line segments that may be used. - -## Required R Packages -- dplyr -- gghighlight -- ggplot2 -- ggpmisc -- patchwork -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(gghighlight) -library(ggplot2) -library(ggpmisc) -library(patchwork) -library(viridis) - -# Prepare data -# 1.iris data -data <- iris - -head(data) - -# 2.economics data -# (1) Using economics data directly to draw graphs -# (2) Processing economics data to draw time series graphs -data_economics <- economics[,c(1, 4, 5)] %>% - filter(grepl("-12-01", date)) %>% # Select only December data for plotting - mutate(date = gsub("-.*", "", date)) %>% # Only keep the year - slice(1:25) %>% # Choose the first 25 years - arrange(date) # Sort - -head(data_economics) - -# 3.Automatically generate data (for log transformation of the y-axis). -data_create <- data.frame( - x = seq(11, 100), - y = seq(11, 100) / 2 + rnorm(90) -) - -head(data_create) - -# 4.Glucose level (used to emphasize specific line segments) -data_glucose <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/Dexcom_001.csv", header = T) - -# Glucose value data processing -data_glucose <- data_glucose[,c(2, 8)] %>% - slice(1:102) %>% - setNames(c("V1", "V2")) %>% - filter(!is.na(V2) & V1 != "") %>% # Remove na - mutate(V3 = rep(1:30, times = 3), # Divided into 3 stages - group = rep(c("stage one", "stage two", "stage three"), each = 30)) - -head(data_glucose) - -# Create visualization -# Basic Plotting -p <- ggplot(data, aes(x = Sepal.Length, y = Sepal.Width)) + - geom_line() -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `date` to the x aesthetic -- `y`: Maps `uempmed` to the y aesthetic -- `color`: Maps `group` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Highlight key time points or events with vertical reference lines or annotations - -## Full Tutorial -https://openbiox.github.io/Bizard/DataOverTime/LineChart.html diff --git a/skills/DataOverTime/StackedArea_skill.md b/skills/DataOverTime/StackedArea_skill.md deleted file mode 100644 index 3b8cc802a5..0000000000 --- a/skills/DataOverTime/StackedArea_skill.md +++ /dev/null @@ -1,79 +0,0 @@ -# Skill: Stacked Area Chart (R) - -## Category -DataOverTime - -## When to Use -Stacked area charts are similar to basic area charts, except that each dataset in the chart starts from the previous dataset and is used to show the trend line of how the size of each value changes over time or category, demonstrating the relationship between the part and the whole. - -## Required R Packages -- babynames -- dplyr -- ggplot2 -- hrbrthemes -- plotly -- tidyverse -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(babynames) -library(dplyr) -library(ggplot2) -library(hrbrthemes) -library(plotly) -library(tidyverse) - -# Prepare data -# data_WorldPhones -data_WorldPhones <- as.data.frame(WorldPhones) -data_WorldPhones <- rownames_to_column(data_WorldPhones,"year") -data_WorldPhones <- data_WorldPhones %>% - gather(key = "area",value = "Phones",-"year" ) -data_WorldPhones$year <- as.numeric(data_WorldPhones$year) - -# data_USPersonalExpenditure -data_USPersonalExpenditure <- USPersonalExpenditure -data_USPersonalExpenditure <- as.data.frame(data_USPersonalExpenditure) -data_USPersonalExpenditure <- rownames_to_column(data_USPersonalExpenditure,"type") -data_USPersonalExpenditure <- data_USPersonalExpenditure %>% - gather(key = "year",value = "expense",-"type" ) -data_USPersonalExpenditure$year <- as.numeric(data_USPersonalExpenditure$year) - -# data_baby -data_baby <- babynames %>% - filter(name %in% c("Ashley", "Amanda", "Jessica", "Patricia", "Linda", "Deborah", "Dorothy", "Betty", "Helen")) %>% - filter(sex=="F") - -# data_covi19 -data_covi19 <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_covi19.csv") -data_covi19$date <- c(6:12) -data_covi19 <- gather(data_covi19, key = "area", value = "cases", 2:7) - -# Create visualization -# Basic stacked area diagram---- -options(scipen = 20) # Do not use scientific notation -p <- ggplot(data_WorldPhones, aes(x=year, y=Phones, fill=area)) + - geom_area()+ - scale_y_continuous(limits = c(0, 150000), - breaks = seq(0, 150000,50000)) - -p -``` - -## Key Parameters -- `x`: Maps `year` to the x aesthetic -- `y`: Maps `n` to the y aesthetic -- `fill`: Maps `name` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_ipsum()` - -## Tips -- The tutorial includes a '3. Customization' section with advanced styling options -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Highlight key time points or events with vertical reference lines or annotations - -## Full Tutorial -https://openbiox.github.io/Bizard/DataOverTime/StackedArea.html diff --git a/skills/DataOverTime/Streamgraph_skill.md b/skills/DataOverTime/Streamgraph_skill.md deleted file mode 100644 index 6aeecf24be..0000000000 --- a/skills/DataOverTime/Streamgraph_skill.md +++ /dev/null @@ -1,57 +0,0 @@ -# Skill: Streamgraph (R) - -## Category -DataOverTime - -## When to Use -A Streamgraph is a stacked area diagram. It represents the evolution of numerical variables across multiple groups. Typically, it displays areas around a central axis with rounded edges to create a flowing shape. - -## Required R Packages -- dplyr -- ggplot2 -- ggstream -- htmlwidgets -- streamgraph - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggplot2) -library(ggstream) -library(htmlwidgets) -library(streamgraph) - -# Prepare data -# 1.R's built-in data - ChickWeight -## This dataset contains 50 samples in total. The dataset chick_new_2 below selects 5 representative samples with a Diet value of 1. -chick_new_1 <- subset(ChickWeight,Diet=="1") -chick_new_2 <- chick_new_1[c(1:12,144:155,73:95,156:167),] - -# 2.Data on COVID-19 infections in 2020 (data source: GISAID database) -## The following data was obtained through data processing, where covid_all represents the total number of people infected with COVID-19 in different regions each month. -covid_all <- readr::read_csv( -"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/covid_all.csv") -head(covid_all) -covid_month <- readr::read_csv( -"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/covid_month.csv") -head(covid_month) - -# Create visualization -streamgraph(covid_all, key = "location", - value = "count",date = "time", - height="300px", width="1000px") -``` - -## Key Parameters -- `fill`: Maps `Chick` to the fill aesthetic -- `color`: Maps `Chick` to the color aesthetic -- `width`: Controls element width - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Highlight key time points or events with vertical reference lines or annotations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/DataOverTime/Streamgraph.html diff --git a/skills/DataOverTime/Timeseries_skill.md b/skills/DataOverTime/Timeseries_skill.md deleted file mode 100644 index b8739e3b9c..0000000000 --- a/skills/DataOverTime/Timeseries_skill.md +++ /dev/null @@ -1,66 +0,0 @@ -# Skill: Timeseries (R) - -## Category -DataOverTime - -## When to Use -A time series graph is a statistical chart with time on the horizontal axis and the observed variable on the vertical axis, reflecting the trend of the observed variable over time. - -## Required R Packages -- dplyr -- ggplot2 -- patchwork - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggplot2) -library(patchwork) - -# Prepare data -# 1.economics dataset -data <- economics[1:60, c(1, 4)] - -head(data) - -data_double <- economics[1:60, c(1, 4, 5)] # This data is used for subplot merging and dual y-axis. - -head(data_double) - -# 2.Quantitative dehydration estimation data -data_water <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/dehydration_estimation.csv", header = T) - -axis_name <- colnames(data_water)[c(5, 8)] # Record column names -data_water <- data_water %>% # Select 2 sets of data - slice(c(19:27, 46:54)) %>% - select(c(1, 5, 8)) %>% - setNames(c("V1", "V2", "V3")) %>% # Change column name - mutate(V4 = case_when(V1 == 3 ~ "people1", # Column V4 serves as category labels. - V1 == 6 ~ "people2")) - -head(data_water) - -# Create visualization -# Basic plot -p <- ggplot(data, aes(x = date, y = psavert)) + - geom_line() + - xlab("") - -p -``` - -## Key Parameters -- `x`: Maps `V2` to the x aesthetic -- `y`: Maps `V3` to the y aesthetic -- `group`: Maps `V4` to the group aesthetic -- `color`: Maps `V4` to the color aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Highlight key time points or events with vertical reference lines or annotations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/DataOverTime/Timeseries.html diff --git a/skills/Distribution/Beeswarm_skill.md b/skills/Distribution/Beeswarm_skill.md deleted file mode 100644 index 91c7bad3c8..0000000000 --- a/skills/Distribution/Beeswarm_skill.md +++ /dev/null @@ -1,74 +0,0 @@ -# Skill: Beeswarm Plot (R) - -## Category -Distribution - -## When to Use -A beeswarm plot disperses data points slightly to prevent overlap, making distribution density and trends clearer. It is especially useful for visualizing categorical data in small datasets. This section presents examples using R and the `beeswarm` and `ggbeeswarm` packages. - -## Required R Packages -- beeswarm -- ggbeeswarm -- ggsignif -- plyr -- readr -- tidyverse - -## Minimal Reproducible Code -```r -# Load packages -library(beeswarm) -library(ggbeeswarm) -library(ggsignif) -library(plyr) -library(readr) -library(tidyverse) - -# Prepare data -# Load iris dataset -data("iris") - -# Load the TCGA-LIHC gene expression dataset from a processed CSV file -TCGA_gene_expression <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-LIHC.star_fpkm_processed.csv") - -# Load the TCGA-LIHC clinical info dataset -TCGA_clinic <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA.LIHC.clinicalMatrix.csv") %>% - mutate(T = as.factor(T)) - -#Prepare Statistics data -data_summary <- function(data, varname, groupnames) { - summary_func <- function(x, col) { - c(mean = mean(x[[col]], na.rm = TRUE), - sd = sd(x[[col]], na.rm = TRUE)) - } - data_sum <- ddply(data, groupnames, .fun = summary_func, varname) - - data_sum <- rename_with(data_sum, ~ varname, "mean") - - return(data_sum) -} -iris_sum <- data_summary(iris, varname="Sepal.Length", groupnames="Species") -TCGA_gene_sum <- data_summary(TCGA_gene_expression, varname="gene_expression", groupnames="sample") - -# Create visualization -p1 <- beeswarm(iris$Sepal.Length) -``` - -## Key Parameters -- `y`: Maps `Sepal` to the y aesthetic -- `x`: Maps `Species` to the x aesthetic -- `colour`: Maps `T` to the colour aesthetic -- `fill`: Maps `Species` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- The tutorial includes a '8. Customization of the Beeswarm Plot (`ggbeeswarm` package)' section with advanced styling options -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes - -## Full Tutorial -https://openbiox.github.io/Bizard/Distribution/Beeswarm.html diff --git a/skills/Distribution/BoxPlot_skill.md b/skills/Distribution/BoxPlot_skill.md deleted file mode 100644 index 92b4646e6d..0000000000 --- a/skills/Distribution/BoxPlot_skill.md +++ /dev/null @@ -1,65 +0,0 @@ -# Skill: Box Plot (R) - -## Category -Distribution - -## When to Use -Boxplots visualize the central tendency and dispersion of one or more sets of continuous quantitative data. They incorporate statistical measures that not only compare differences across categories but also reveal dispersion, outliers, and distribution patterns. - -## Required R Packages -- dplyr -- ggExtra -- ggplot2 -- ggpmisc -- ggpubr -- ggtext -- hrbrthemes -- readr -- rstatix -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggExtra) -library(ggplot2) -library(ggpmisc) -library(ggpubr) -library(ggtext) - -# Prepare data -# Load mtcars dataset -data("mtcars") -data_mtcars <- mtcars - -# Load mpg dataset from ggplot2 package -data_mpg <- ggplot2::mpg - -# Load diamonds dataset from ggplot2 package -data_diamonds <- ggplot2::diamonds - -# Load the TCGA-BRCA gene expression dataset from a processed CSV file -data_TCGA <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.htseq_counts_processed.csv") -data_TCGA1 <- data_TCGA[1:5,] %>% - gather(key = "sample",value = "gene_expression",3:1219) -``` - -## Key Parameters -- `x`: Maps `class` to the x aesthetic -- `y`: Maps `hwy` to the y aesthetic -- `fill`: Maps `type` to the fill aesthetic -- `alpha`: Maps `type` to the alpha aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_ipsum()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes - -## Full Tutorial -https://openbiox.github.io/Bizard/Distribution/BoxPlot.html diff --git a/skills/Distribution/BreakPlot_skill.md b/skills/Distribution/BreakPlot_skill.md deleted file mode 100644 index 2b2c778ecb..0000000000 --- a/skills/Distribution/BreakPlot_skill.md +++ /dev/null @@ -1,78 +0,0 @@ -# Skill: Break Plot (R) - -## Category -Distribution - -## When to Use -Create a Break Plot visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- RColorBrewer -- dplyr -- ggbreak -- ggplot2 -- ggpubr -- rstatix - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(dplyr) -library(ggbreak) -library(ggplot2) -library(ggpubr) -library(rstatix) - -# Prepare data -# Data Preparation -df <- ToothGrowth %>% - group_by(supp, dose) %>% - summarise( - mean_len = mean(len), - sd_len = sd(len), - n = n(), - se_len = sd_len/sqrt(n), - .groups = 'drop') - - -# Statistical tests (key repair points) -stat.test <- ToothGrowth %>% - group_by(dose) %>% - t_test(len ~ supp) %>% - add_xy_position(x = "dose", dodge = 0.8) - -head(df) - -# Create visualization -# Basic BarPlot -p1 <- ggplot(df, aes(x=dose, y=mean_len, fill=supp)) + - geom_col(position=position_dodge(0.4), width=0.2) + - geom_errorbar(aes(ymin=mean_len-sd_len, ymax=mean_len+sd_len), - width=0.1, position=position_dodge(0.4)) + - scale_y_continuous(breaks = seq(0, 30, 5)) + - scale_y_cut(breaks=c(15), which=1, scales=1.5) + - labs(x="Dose (mg/day)", y="Tooth Length (mm)") + - theme_classic() - -p1 -``` - -## Key Parameters -- `x`: Maps `dose` to the x aesthetic -- `y`: Maps `len` to the y aesthetic -- `fill`: Maps `supp` to the fill aesthetic -- `color`: Maps `supp` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- The tutorial includes a '4. More advanced charts' section with advanced styling options -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes - -## Full Tutorial -https://openbiox.github.io/Bizard/Distribution/BreakPlot.html diff --git a/skills/Distribution/Density_skill.md b/skills/Distribution/Density_skill.md deleted file mode 100644 index 98ffa978b3..0000000000 --- a/skills/Distribution/Density_skill.md +++ /dev/null @@ -1,90 +0,0 @@ -# Skill: Density Plot (R) - -## Category -Distribution - -## When to Use -A density plot represents the distribution of a numerical variable using kernel density estimation to display the probability density function. It is a smoothed version of a histogram, sharing the same concept but providing a clearer representation of the overall trend and shape of the data. - -## Required R Packages -- cowplot -- dplyr -- geomtextpath -- ggExtra -- ggplot2 -- ggpmisc -- ggpubr -- hrbrthemes -- readr -- tidyr -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(dplyr) -library(geomtextpath) -library(ggExtra) -library(ggplot2) -library(ggpmisc) - -# Prepare data -# Read the TSV data -data <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-LIHC.htseq_counts.csv.gz") - -# Filter and reshape data for the first gene TSPAN6 (Ensembl ID: ENSG00000000003.13) -data1 <- data %>% - filter(Ensembl_ID == "ENSG00000000003.13") %>% - pivot_longer( - cols = -Ensembl_ID, - names_to = "sample", - values_to = "expression" - ) %>% - mutate(var = "var1") # Add a column to differentiate the variables - -# Filter and reshape data for the second gene SCYL3 (Ensembl ID: ENSG00000000457.12) -data2 <- data %>% - filter(Ensembl_ID == "ENSG00000000457.12") %>% - pivot_longer( - cols = -Ensembl_ID, - names_to = "sample", - values_to = "expression" - ) %>% - mutate(var = "var2") # Add a column to differentiate the variables - -# Combine the two datasets -data12 <- bind_rows(data1, data2) - -# View the final combined dataset -head(data12) - -# Create visualization -# Basic Density Plot -p1 <- ggplot(data1, aes(x = expression)) + - geom_density(fill = "#69b3a2", color = "#e9ecef", alpha = 0.8) + - labs(title = "Density Plot of TSPAN6 Expression Levels", - x = "Expression", - y = "Density") + - theme_minimal() -p1 -``` - -## Key Parameters -- `x`: Maps `Petal` to the x aesthetic -- `fill`: Maps `Species` to the fill aesthetic -- `group`: Maps `cut` to the group aesthetic -- `color`: Maps `Species` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes - -## Full Tutorial -https://openbiox.github.io/Bizard/Distribution/Density.html diff --git a/skills/Distribution/Histogram_skill.md b/skills/Distribution/Histogram_skill.md deleted file mode 100644 index cd52c18d0b..0000000000 --- a/skills/Distribution/Histogram_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Histogram (R) - -## Category -Distribution - -## When to Use -A histogram uses rectangular bars to represent the frequency of data within specific intervals, where the total area of the bars corresponds to the total frequency. It is primarily used to visualize the distribution of continuous variables. - -## Required R Packages -- cowplot -- ggExtra -- ggplot2 -- ggpmisc -- ggpubr -- readr -- tidyverse -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(ggExtra) -library(ggplot2) -library(ggpmisc) -library(ggpubr) -library(readr) - -# Prepare data -# Read the TSV data -data <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-LIHC.htseq_counts.csv.gz") - -# Filter and reshape data for the first gene TSPAN6 (Ensembl ID: ENSG00000000003.13) -data1 <- data %>% - filter(Ensembl_ID == "ENSG00000000003.13") %>% - pivot_longer( - cols = -Ensembl_ID, - names_to = "sample", - values_to = "expression" - ) %>% - mutate(var = "var1") # Add a column to differentiate the variables - -# Filter and reshape data for the second gene SCYL3 (Ensembl ID: ENSG00000000457.12) -data2 <- data %>% - filter(Ensembl_ID == "ENSG00000000457.12") %>% - pivot_longer( - cols = -Ensembl_ID, - names_to = "sample", - values_to = "expression" - ) %>% - mutate(var = "var2") # Add a column to differentiate the variables - -# Combine the two datasets -data12 <- bind_rows(data1, data2) - -# View the final combined dataset -head(data12) - -# Create visualization -# Basic Histogram -p1 <- ggplot(data1, aes(x = expression)) + - geom_histogram() + - labs(x = "Gene Expression", y = "Count") - -p1 -``` - -## Key Parameters -- `x`: Maps `value` to the x aesthetic -- `y`: Maps `after_stat` to the y aesthetic -- `fill`: Maps `Species` to the fill aesthetic -- `color`: Maps `Species` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes - -## Full Tutorial -https://openbiox.github.io/Bizard/Distribution/Histogram.html diff --git a/skills/Distribution/RadialColumnChart_skill.md b/skills/Distribution/RadialColumnChart_skill.md deleted file mode 100644 index 8c30cf720b..0000000000 --- a/skills/Distribution/RadialColumnChart_skill.md +++ /dev/null @@ -1,70 +0,0 @@ -# Skill: Radial Column Chart (R) - -## Category -Distribution - -## When to Use -Create a Radial Column Chart visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- dplyr -- ggforce -- ggplot2 -- scales - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggforce) -library(ggplot2) -library(scales) - -# Prepare data -# Data reading and processing code can be displayed freely------ -# Generate simulated clinical data -set.seed(123) -n <- 12 # Sample size - -df <- data.frame( - id = 1:n, - patient = paste0("P-", sprintf("%02d", 1:n)), - value = c(rnorm(6, 80, 15), rnorm(6, 120, 20)), # Control group and treatment group - group = rep(c("Control", "Treatment"), each = 6) -) %>% - mutate( - angle = 90 - 360 * (id - 0.5)/n, - hjust = ifelse(angle < -90, 1, 0), - angle = ifelse(angle < -90, angle + 180, angle) - ) - -# Adding built-in datasets -data("iris") - -# Create visualization -# Basic histogram -p1 <- ggplot(df, aes(x = factor(id), y = value)) + - geom_col(aes(fill = group), width = 0.8, alpha = 0.8) + - coord_radial(inner.radius = 0.3) + - scale_fill_manual(values = c("#1E88E5", "#D81B60")) + - theme_void() + - labs(title = "Comparison of indicators between the treatment group and the control group") -p1 -``` - -## Key Parameters -- `x`: Maps `id` to the x aesthetic -- `fill`: Maps `group` to the fill aesthetic -- `y`: Maps `value` to the y aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- The tutorial includes a '2. More advanced charts' section with advanced styling options -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes - -## Full Tutorial -https://openbiox.github.io/Bizard/Distribution/RadialColumnChart.html diff --git a/skills/Distribution/Ridgeline_skill.md b/skills/Distribution/Ridgeline_skill.md deleted file mode 100644 index 22d2c3cd1b..0000000000 --- a/skills/Distribution/Ridgeline_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Ridgeline Plot (R) - -## Category -Distribution - -## When to Use -A ridgeline plot, also known as a joyplot, visualizes the distribution of multiple numeric variables across different categories. This method is useful for comparing density distributions while preserving an overall view of trends and variations. - -## Required R Packages -- dplyr -- ggplot2 -- ggridges -- hrbrthemes -- readr -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggplot2) -library(ggridges) -library(hrbrthemes) -library(readr) -library(viridis) - -# Prepare data -# Load iris dataset -data("iris") - -# Load Lung Cancer (Raponi 2006) clinical data -TCGA_clinic <- readr::read_tsv("https://ucsc-public-main-xena-hub.s3.us-east-1.amazonaws.com/download/raponi2006_public%2Fraponi2006_public_clinicalMatrix.gz") %>% - mutate(T = as.factor(T)) -head(TCGA_clinic) - -# Create visualization -# Basic Ridgeline plot -p1_1 <- ggplot(iris, aes(x = Sepal.Length, y = Species, fill = Species)) + - geom_density_ridges(alpha = 0.5) + - theme_ridges(font_size = 16, grid = TRUE) + - theme(legend.position = "right") - -p1_1 -``` - -## Key Parameters -- `x`: Maps `OS` to the x aesthetic -- `y`: Maps `T` to the y aesthetic -- `fill`: Maps `T` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_ipsum()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes - -## Full Tutorial -https://openbiox.github.io/Bizard/Distribution/Ridgeline.html diff --git a/skills/Distribution/ViolinPlot_skill.md b/skills/Distribution/ViolinPlot_skill.md deleted file mode 100644 index e3168461fc..0000000000 --- a/skills/Distribution/ViolinPlot_skill.md +++ /dev/null @@ -1,76 +0,0 @@ -# Skill: Violin Plot (R) - -## Category -Distribution - -## When to Use -A violin plot combines elements of a density plot and a box plot to visualize data distribution. It displays key statistical information, including the median, quartiles, minimum, and maximum values. Violin plots are particularly useful for comparing distributions across different groups, offering a more intuitive representation than traditional box plots by revealing the shape of the data distribution. - -## Required R Packages -- dplyr -- forcats -- gghalves -- ggplot2 -- ggpubr -- ggstatsplot -- hrbrthemes -- palmerpenguins -- readr -- tidyr -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(forcats) -library(gghalves) -library(ggplot2) -library(ggpubr) -library(ggstatsplot) - -# Prepare data -# Load the TCGA-BRCA gene expression dataset from a processed CSV file -data_counts <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.htseq_counts_processed.csv") - -# Load built-in R dataset iris -data_wide <- iris[ , 1:4] # Take the data in columns 1-4 of the iris database as an example - -# Load built-in R dataset penguins -data("penguins", package = "palmerpenguins") -data_penguins <- drop_na(penguins) # Remove missing values - -# Manually create a demonstration dataset with grouped values -data <- data.frame( - name=c( rep("A",500), rep("B",500), rep("B",500), rep("C",20), rep('D', 100) ), - value=c( rnorm(500, 10, 5), rnorm(500, 13, 1), rnorm(500, 18, 1), rnorm(20, 25, 4), rnorm(100, 12, 1) ) - ) -sample_size <- data %>% - group_by(name) %>% - summarize(num=n()) # Compute the sample size for each group - -# Create visualization -# Basic Violin Plot -p <- ggplot(data, aes(x=name, y=value, fill=name)) + - geom_violin() - -p -``` - -## Key Parameters -- `x`: Maps `gene_name` to the x aesthetic -- `y`: Maps `gene_expression` to the y aesthetic -- `fill`: Maps `gene_name` to the fill aesthetic -- `color`: Maps `gene_name` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Use `coord_flip()` for horizontal orientation when labels are long -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes - -## Full Tutorial -https://openbiox.github.io/Bizard/Distribution/ViolinPlot.html diff --git a/skills/Hiplot/001-area_skill.md b/skills/Hiplot/001-area_skill.md deleted file mode 100644 index 47820ade3e..0000000000 --- a/skills/Hiplot/001-area_skill.md +++ /dev/null @@ -1,68 +0,0 @@ -# Skill: Area Plot (R) - -## Category -Hiplot - -## When to Use -The area chart displays graphically quantitative data. It is based on the line chart. The area between axis and line are commonly emphasized with colors, textures and hatchings. - -## Required R Packages -- data.table -- ggplot2 -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/area/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Area Plot -p <- ggplot(data, aes(x = xaxis.value, y = yaxis.value, fill = group)) + - geom_area(alpha = 1) + - ylab("yaxis.value") + - xlab("xaxis.value") + - ggtitle("Area Plot") + - scale_fill_manual(values = c("#e04d39","#5bbad6","#1e9f86")) + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `xaxis` to the x aesthetic -- `y`: Maps `yaxis` to the y aesthetic -- `fill`: Maps `group` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/001-area.html diff --git a/skills/Hiplot/002-barcode-plot_skill.md b/skills/Hiplot/002-barcode-plot_skill.md deleted file mode 100644 index f8848e3305..0000000000 --- a/skills/Hiplot/002-barcode-plot_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Barcode Plot (R) - -## Category -Hiplot - -## When to Use -Barcode Plot is Suitable for displaying the distribution of large amounts of data. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/barcode-plot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Barcode Plot -p <- ggplot(data, aes(x = sales, y = region)) + - geom_tile(width = 0.01, height = 0.9, fill = "#606fcc") + # Control the width and height of the Barcode - theme_bw() + - labs(title = "Sales report", x = "Sales", y = "Region") + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `sales` to the x aesthetic -- `y`: Maps `region` to the y aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/002-barcode-plot.html diff --git a/skills/Hiplot/003-barplot-3d_skill.md b/skills/Hiplot/003-barplot-3d_skill.md deleted file mode 100644 index 58511265d6..0000000000 --- a/skills/Hiplot/003-barplot-3d_skill.md +++ /dev/null @@ -1,80 +0,0 @@ -# Skill: 3D Barplot (R) - -## Category -Hiplot - -## When to Use -3D bar charts are used to provide a 3D look and feel for the data. The third dimension is often used for aesthetic reasons, but it does not improve data reading. Still intended to show comparisons between discrete categories. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- plot3D - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(plot3D) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/barplot-3d/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data vector to a matrix -mat <- matrix(rep(1, nrow(data)), nrow = length(unique(data[, 2]))) -rownames(mat) <- unique(data[, 2]) -colnames(mat) <- unique(data[, 3]) -for (i in 1:nrow(mat)) { - for (j in seq_len(ncol(mat))) { - mat[i, j] <- data[, 1][data[, 2] == rownames(mat)[i] & - data[, 3] == colnames(mat)[j]] - } -} - -# View data -mat - -# Create visualization -# 3D Barplot -p <- as.ggplot(function() { - hist3D( - x = 1:nrow(mat), y = seq_len(ncol(mat)), z = mat, - bty = "g", phi = 20, - theta = -55, - xlab = colnames(data)[2], - ylab = colnames(data)[3], zlab = colnames(data)[1], - main = "3D Bar Plot", colkey = F, - border = "black", shade = 0.8, axes = T, - ticktype = "detailed", space = 0.3, d = 2, cex.axis = 0.3, - colvar = as.numeric(as.factor(data[, 2])), alpha = 1, - col = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF") - ) - - # Use text3D to label x axis - text3D( - x = 1:nrow(mat), y = rep(0.5, nrow(mat)), z = rep(3, nrow(mat)), - labels = rownames(mat), - add = TRUE, adj = 0, cex = 0.8 - ) - # Use text3D to label y axis - text3D( - x = rep(1, ncol(mat)), y = seq_len(ncol(mat)), z = rep(0, ncol(mat)), -# ... (see full tutorial for more) -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/003-barplot-3d.html diff --git a/skills/Hiplot/004-barplot-color-group_skill.md b/skills/Hiplot/004-barplot-color-group_skill.md deleted file mode 100644 index ba3d2d9370..0000000000 --- a/skills/Hiplot/004-barplot-color-group_skill.md +++ /dev/null @@ -1,79 +0,0 @@ -# Skill: Barplot Color Group (R) - -## Category -Hiplot - -## When to Use -The color group barplot can be used to display data values in groups, and to label different colors in sequence. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite -- stringr - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) -library(stringr) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/barplot-color-group/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -colnames(data) <- c("term", "count", "type") -data[,"term"] <- str_to_sentence(str_remove(data[,"term"], pattern = "\\w+:\\d+\\W")) -data[,"term"] <- factor(data[,"term"], - levels = data[,"term"][length(data[,"term"]):1]) -data[,"type"] <- factor(data[,"type"], - levels = data[!duplicated(data[,"type"]), "type"]) - -# View data -data - -# Create visualization -# Barplot Color Group -p <- ggplot(data = data, aes(x = term, y = count, fill = type)) + - geom_bar(stat = "identity", width = 0.8) + - theme_bw() + - xlab("Count") + - ylab("Term") + - guides(fill = guide_legend(title="Type")) + - ggtitle("Barplot Color Group") + - coord_flip() + - theme_classic() + - scale_fill_manual(values = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF")) + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `term` to the x aesthetic -- `y`: Maps `count` to the y aesthetic -- `fill`: Maps `type` to the fill aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Use `coord_flip()` for horizontal orientation when labels are long -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/004-barplot-color-group.html diff --git a/skills/Hiplot/005-barplot-errorbar_skill.md b/skills/Hiplot/005-barplot-errorbar_skill.md deleted file mode 100644 index 8f71ccd091..0000000000 --- a/skills/Hiplot/005-barplot-errorbar_skill.md +++ /dev/null @@ -1,83 +0,0 @@ -# Skill: Barplot (errorbar) (R) - -## Category -Hiplot - -## When to Use -Bar plot with error-lines and groups. - -## Required R Packages -- Rmisc -- data.table -- ggplot2 -- ggpubr -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(Rmisc) -library(data.table) -library(ggplot2) -library(ggpubr) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/barplot-errorbar/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data[, 2] <- factor(data[, 2], levels = unique(data[, 2])) -data_sd <- summarySE(data, measurevar = colnames(data)[1], groupvars = colnames(data)[2]) - -# View data -head(data_sd) - -# Create visualization -# Barplot (errorbar) -p <- ggplot(data_sd, aes(x = data_sd[, 1], y = data_sd[, 3], fill = data_sd[, 1])) + - geom_bar(stat = "identity", color = "black", - position = position_dodge(), alpha = 1) + - geom_errorbar(aes(ymin = data_sd[, 3] - sd, ymax = data_sd[, 3] + sd), - width = 0.2, - position = position_dodge(0.9)) + - labs(title = "Barplot (errorbar)", x = colnames(data_sd)[1], - y = colnames(data_sd)[3], fill = colnames(data_sd)[1]) + - geom_jitter(data = data, aes(data[, 2], data[, 1], fill = data[, 2]), size = 2, fill = "black", pch = 19, width = 0.2) + - stat_compare_means(data = data, aes(data[, 2], data[, 1], fill = data[, 2]), - label = "p.format", ref.group = ".all.", vjust = 1, - method = "t.test") + - scale_fill_manual(values = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF")) + - theme_bw() + - ylim(0,100) + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `data_sd` to the x aesthetic -- `y`: Maps `data_sd` to the y aesthetic -- `fill`: Maps `data` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/005-barplot-errorbar.html diff --git a/skills/Hiplot/006-barplot-errorbar2_skill.md b/skills/Hiplot/006-barplot-errorbar2_skill.md deleted file mode 100644 index 967ec86ed3..0000000000 --- a/skills/Hiplot/006-barplot-errorbar2_skill.md +++ /dev/null @@ -1,75 +0,0 @@ -# Skill: Barplot (errorbar2) (R) - -## Category -Hiplot - -## When to Use -Bar plot with error-lines and groups. - -## Required R Packages -- data.table -- ggplot2 -- ggpubr -- grafify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggpubr) -library(grafify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/barplot-errorbar2/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data[, 2] <- factor(data[, 2], levels = unique(data[, 2])) - -# View data -head(data) - -# Create visualization -# Barplot (errorbar2) -p <- plot_scatterbar_sd( - data, ycol = get(colnames(data)[1]), xcol = get(colnames(data)[2]), - b_alpha = 1, ewid = 0.2, jitter = 0.1) + - stat_compare_means(data = data, aes(data[, 2], data[, 1], fill = data[, 2]), - label = "p.format", ref.group = ".all.", vjust = -2, - method = "t.test") + - guides(fill=guide_legend(title=colnames(data)[2])) + - scale_y_continuous(expand = expansion(mult = c(0, 0.2))) + - labs(x="class", y="score") + - scale_fill_manual(values = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF")) + - theme_classic2() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5, vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `fill`: Maps `data` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_classic2()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/006-barplot-errorbar2.html diff --git a/skills/Hiplot/008-barplot-gradient_skill.md b/skills/Hiplot/008-barplot-gradient_skill.md deleted file mode 100644 index 32b96bb040..0000000000 --- a/skills/Hiplot/008-barplot-gradient_skill.md +++ /dev/null @@ -1,74 +0,0 @@ -# Skill: Barplot Gradient (R) - -## Category -Hiplot - -## When to Use -It is similar to the bubble chart, but on the basis of the histogram, a color gradient rectangle is used to simultaneously display the visualization of two variables. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite -- stringr - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) -library(stringr) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/barplot-gradient/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data[, 1] <- str_to_sentence(str_remove(data[, 1], pattern = "\\w+:\\d+\\W")) -topnum <- 7 -data <- data[1:topnum, ] -data[, 1] <- factor(data[, 1], level = rev(unique(data[, 1]))) - -# View data -head(data) - -# Create visualization -# Barplot Gradient -p <- ggplot(data, aes(x = Term, y = Count, fill = -log10(PValue))) + - geom_bar(stat = "identity") + - ggtitle("GO BarPlot") + - scale_fill_continuous(low = "#00438E", high = "#E43535") + - scale_x_discrete(labels = function(x) {str_wrap(x, width = 65)}) + - labs(fill = "-log10 (PValue)", y = "Term", x = "Count") + - coord_flip() + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `Term` to the x aesthetic -- `y`: Maps `Count` to the y aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Use `coord_flip()` for horizontal orientation when labels are long -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/008-barplot-gradient.html diff --git a/skills/Hiplot/009-barplot-line-multiple_skill.md b/skills/Hiplot/009-barplot-line-multiple_skill.md deleted file mode 100644 index cbfe23fbe2..0000000000 --- a/skills/Hiplot/009-barplot-line-multiple_skill.md +++ /dev/null @@ -1,76 +0,0 @@ -# Skill: Multiple Barplot&Line (R) - -## Category -Hiplot - -## When to Use -Displaying multiple bar or line plot in one diagram. - -## Required R Packages -- data.table -- ggplot2 -- ggthemes -- jsonlite -- reshape2 - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggthemes) -library(jsonlite) -library(reshape2) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/barplot-line-multiple/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data_melt <- melt(data, id.vars = colnames(data)[1]) -data_melt[, 1] <- factor(data_melt[, 1], level = unique(data_melt[, 1])) - -# View data -head(data) - -# Create visualization -# Multiple Line -p <- ggplot(data = data_melt, aes(x = age, y = value, group = variable, - colour = variable)) + - geom_line(alpha = 1, size = 1) + - geom_point(aes(shape = variable), alpha = 1, size = 3) + - labs(title = "Line (Multiple)", x = "X Lable", y = "Value") + - scale_color_manual(values = c("#3B4992FF","#EE0000FF","#008B45FF","#631879FF", - "#008280FF","#BB0021FF")) + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `age` to the x aesthetic -- `y`: Maps `value` to the y aesthetic -- `group`: Maps `variable` to the group aesthetic -- `colour`: Maps `variable` to the colour aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/009-barplot-line-multiple.html diff --git a/skills/Hiplot/010-barplot_skill.md b/skills/Hiplot/010-barplot_skill.md deleted file mode 100644 index 7655369bdf..0000000000 --- a/skills/Hiplot/010-barplot_skill.md +++ /dev/null @@ -1,70 +0,0 @@ -# Skill: Barplot (R) - -## Category -Hiplot - -## When to Use -Bar charts are used to display category data with rectangular bars whose height or length is proportional to the value they represent. Bar charts can be drawn vertically or horizontally. The bar chart shows the comparison between the discrete categories. One axis of the chart shows the specific categories to be compared, and the other axis represents the measurements. Some bar charts show bars that can also show the values of multiple measurement variables. - -## Required R Packages -- data.table -- ggplot2 -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/barplot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data[, 2] <- factor(data[, 2], levels = unique(data[, 2])) -data[, 3] <- factor(data[, 3], levels = unique(data[, 3])) - -# View data -head(data) - -# Create visualization -# Barplot -p <- ggplot(data, aes(x = dose, y = value, fill = treat)) + - geom_bar(position = position_dodge(0.9), stat = "identity") + - ggtitle("Bar Plot") + - geom_text(aes(label = value), position = position_dodge(0.9), vjust = 1.5, color = "white", size = 3.5) + - scale_fill_manual(values = c("#e04d39","#5bbad6","#1e9f86","#3c5488ff")) + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `dose` to the x aesthetic -- `y`: Maps `value` to the y aesthetic -- `fill`: Maps `treat` to the fill aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/010-barplot.html diff --git a/skills/Hiplot/011-beanplot_skill.md b/skills/Hiplot/011-beanplot_skill.md deleted file mode 100644 index 86eb42e9b9..0000000000 --- a/skills/Hiplot/011-beanplot_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Beanplot (R) - -## Category -Hiplot - -## When to Use -The beanplot is a method of visualizing the distribution characteristics. - -## Required R Packages -- beanplot -- data.table -- ggplotify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(beanplot) -library(data.table) -library(ggplotify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/beanplot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -GroupOrder <- as.numeric(factor(data[, 2], levels = unique(data[, 2]))) -data[, 2] <- paste0(data[,2], " ", as.numeric(factor(data[, 3]))) -data <- cbind(data, GroupOrder) - -# View data -head(data) - -# Create visualization -# Beanplot -p <- as.ggplot(function() { - beanplot(Y ~ reorder(X, GroupOrder, mean), data = data, ll = 0.04, - main = "Bean Plot", ylab = "Y", xlab = "X", side = "both", - border = NA, horizontal = F, - col = list(c("#2b70c4", "#2b70c4"),c("#e9c216", "#e9c216")), - beanlines = "mean", overallline = "mean", kernel = "gaussian") - - legend("bottomright", fill = c("#2b70c4", "#e9c216"), - legend = levels(factor(data[, 3]))) -}) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/011-beanplot.html diff --git a/skills/Hiplot/012-beeswarm_skill.md b/skills/Hiplot/012-beeswarm_skill.md deleted file mode 100644 index c53d559e24..0000000000 --- a/skills/Hiplot/012-beeswarm_skill.md +++ /dev/null @@ -1,69 +0,0 @@ -# Skill: Beeswarm (R) - -## Category -Hiplot - -## When to Use -The beeswarm is a noninterference scatter plot which is similar to a bee colony. - -## Required R Packages -- data.table -- ggbeeswarm -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggbeeswarm) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/beeswarm/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data[, 1] <- factor(data[, 1], levels = unique(data[, 1])) -colnames(data) <- c("Group", "y") - -# View data -head(data) - -# Create visualization -# Beeswarm -p <- ggplot(data, aes(Group, y, color = Group)) + - geom_beeswarm(alpha = 1, size = 0.8) + - labs(x = NULL, y = "value") + - ggtitle("BeeSwarm Plot") + - scale_color_manual(values = c("#e04d39","#5bbad6","#1e9f86")) + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `color`: Maps `Group` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/012-beeswarm.html diff --git a/skills/Hiplot/013-big-corrplot_skill.md b/skills/Hiplot/013-big-corrplot_skill.md deleted file mode 100644 index bafc8af24a..0000000000 --- a/skills/Hiplot/013-big-corrplot_skill.md +++ /dev/null @@ -1,67 +0,0 @@ -# Skill: Corrplot Big Data (R) - -## Category -Hiplot - -## When to Use -The correlation heat map is a graph that analyzes the correlation between two or more variables. - -## Required R Packages -- ComplexHeatmap -- data.table -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(ComplexHeatmap) -library(data.table) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/big-corrplot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data <- data[!is.na(data[, 1]), ] -idx <- duplicated(data[, 1]) -data[idx, 1] <- paste0(data[idx, 1], "--dup-", cumsum(idx)[idx]) -rownames(data) <- data[, 1] -data <- data[, -1] -str2num_df <- function(x) { - x[] <- lapply(x, function(l) as.numeric(l)) - x -} -tmp <- t(str2num_df(data)) -corr <- round(cor(tmp, use = "na.or.complete", method = "pearson"), 3) - -# View data -head(corr[,1:5]) - -# Create visualization -# Corrplot Big Data -p <- ComplexHeatmap::Heatmap( - corr, col = colorRampPalette(c("#4477AA","#FFFFFF","#BB4444"))(50), - clustering_distance_rows = "euclidean", - clustering_method_rows = "ward.D2", - clustering_distance_columns = "euclidean", - clustering_method_columns = "ward.D2", - show_column_dend = FALSE, show_row_dend = FALSE, - column_names_gp = gpar(fontsize = 8), - row_names_gp = gpar(fontsize = 8) -) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/013-big-corrplot.html diff --git a/skills/Hiplot/014-bivariate_skill.md b/skills/Hiplot/014-bivariate_skill.md deleted file mode 100644 index aa5f47d4e8..0000000000 --- a/skills/Hiplot/014-bivariate_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Bivariate Chart (R) - -## Category -Hiplot - -## When to Use -Display the bivariate. - -## Required R Packages -- GGally -- data.table -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(GGally) -library(data.table) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/bivariate/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Bivariate Chart -p <- ggbivariate(data, outcome = "smoker", - explanatory = c("day","time","gender","tip")) + - ggtitle("Bivariate") + - scale_fill_manual(values = c("#e04d39","#5bbad6")) + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/014-bivariate.html diff --git a/skills/Hiplot/015-boxplot_skill.md b/skills/Hiplot/015-boxplot_skill.md deleted file mode 100644 index eeffc7b166..0000000000 --- a/skills/Hiplot/015-boxplot_skill.md +++ /dev/null @@ -1,69 +0,0 @@ -# Skill: Boxplot (R) - -## Category -Hiplot - -## When to Use -The box plot is a method of visualizing the distribution characteristics of a set of data by means of a quartile graph. - -## Required R Packages -- data.table -- ggpubr -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggpubr) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/boxplot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -groups <- unique(data[, 2]) -my_comparisons <- combn(groups, 2, simplify = FALSE) -my_comparisons <- lapply(my_comparisons, as.character) - -# View data -head(data) - -# Create visualization -# Boxplot -p <- ggboxplot(data, x = "Group1", y = "Value", notch = F, facet.by = "Group2", - add = "point", color = "Group1", xlab = "Group2", ylab = "Value", - palette = c("#e04d39","#5bbad6","#1e9f86"), - title = "Box Plot") + - stat_compare_means(comparisons = my_comparisons, label = "p.format", - method = "t.test") + - scale_y_continuous(expand = expansion(mult = c(0.1, 0.1))) + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/015-boxplot.html diff --git a/skills/Hiplot/016-bubble_skill.md b/skills/Hiplot/016-bubble_skill.md deleted file mode 100644 index d2daec05eb..0000000000 --- a/skills/Hiplot/016-bubble_skill.md +++ /dev/null @@ -1,73 +0,0 @@ -# Skill: Bubble (R) - -## Category -Hiplot - -## When to Use -The bubble chart is a statistical chart that shows the third variable by the size of the bubble on the basis of the scatter chart, so that the three variables can be compared and analyzed simultaneously. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite -- stringr - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) -library(stringr) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/bubble/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data[, 1] <- str_to_sentence(str_remove(data[, 1], pattern = "\\w+:\\d+\\W")) -topnum <- 7 -data <- data[1:topnum, ] -data[, 1] <- factor(data[, 1], level = rev(unique(data[, 1]))) - -# View data -head(data) - -# Create visualization -# Bubble -p <- ggplot(data, aes(Ratio, Term)) + - geom_point(aes(size = Count, colour = -log10(PValue))) + - scale_colour_gradient(low = "#00438E", high = "#E43535") + - labs(colour = "-log10 (PValue)", size = "Count", x = "Ratio", y = "Term", - title = "Bubble Plot") + - scale_x_continuous(limits = c(0, max(data$Ratio) * 1.2)) + - guides(color = guide_colorbar(order = 1), size = guide_legend(order = 2)) + - scale_y_discrete(labels = function(x) {str_wrap(x, width = 65)}) + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `size`: Maps `Count` to the size aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/016-bubble.html diff --git a/skills/Hiplot/017-bumpchart_skill.md b/skills/Hiplot/017-bumpchart_skill.md deleted file mode 100644 index 7f198df410..0000000000 --- a/skills/Hiplot/017-bumpchart_skill.md +++ /dev/null @@ -1,64 +0,0 @@ -# Skill: Bumpchart (R) - -## Category -Hiplot - -## When to Use -Bump chart can be used to display the change of grouped values. - -## Required R Packages -- data.table -- dplyr -- ggbump -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(ggbump) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/bumpchart/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Bumpchart -p <- ggplot(data, aes(x = x, y = y, color = group)) + - geom_bump(size = 1.5) + - geom_point(size = 5) + - geom_text(data = data %>% filter(x == min(x)), - aes(x = x - 0.1, label = group), - size = 5, hjust = 1) + - geom_text(data = data %>% filter(x == max(x)), - aes(x = x + 0.1, label = group), - size = 5, hjust = 0) + - theme_void() + - theme(legend.position = "none") + - scale_color_manual(values = c("#0571B0","#92C5DE","#F4A582","#CA0020")) - -p -``` - -## Key Parameters -- `x`: Maps `x` to the x aesthetic -- `y`: Maps `y` to the y aesthetic -- `color`: Maps `group` to the color aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/017-bumpchart.html diff --git a/skills/Hiplot/018-calibration-curve_skill.md b/skills/Hiplot/018-calibration-curve_skill.md deleted file mode 100644 index 2969495bab..0000000000 --- a/skills/Hiplot/018-calibration-curve_skill.md +++ /dev/null @@ -1,64 +0,0 @@ -# Skill: Calibration Curve (R) - -## Category -Hiplot - -## When to Use -The calibration curve is used to evaluate the consistency / calibration, i.e. the difference between the predicted value and the real value. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- rms -- survival - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(rms) -library(survival) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/calibration-curve/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -res.lrm <- lrm(as.formula(paste( - "status ~ ", - paste(colnames(data)[3:length(colnames(data))], collapse = "+"))), - data = data, x = TRUE, y = TRUE) - -lrm.cal <- calibrate(res.lrm, method = "boot", B = length(rownames(data))) - -# View data -head(data) - -# Create visualization -# Calibration Curve -p <- as.ggplot(function() { - plot(lrm.cal, - xlab = "Nomogram Predicted Survival", - ylab = "Actual Survival", - main = "Calibration Curve" - ) -}) - -p -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/018-calibration-curve.html diff --git a/skills/Hiplot/019-chi-square-fisher_skill.md b/skills/Hiplot/019-chi-square-fisher_skill.md deleted file mode 100644 index c0e0293a0b..0000000000 --- a/skills/Hiplot/019-chi-square-fisher_skill.md +++ /dev/null @@ -1,82 +0,0 @@ -# Skill: Chi-square-fisher Test (R) - -## Category -Hiplot - -## When to Use -Chi-square and Fisher test can be used to test the frequency difference of categorical variables. The tool will automatically select the statistical method of Chi-square and Fisher exact test. - -## Required R Packages -- aplot -- data.table -- ggplot2 -- jsonlite -- visdat - -## Minimal Reproducible Code -```r -# Load packages -library(aplot) -library(data.table) -library(ggplot2) -library(jsonlite) -library(visdat) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/chi-square-fisher/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -rownames(data) <- data[,1] -data <- data[,-1] -cb <- combn(nrow(data), 2) -final <- data.frame() -for (i in 1:ncol(cb)) { - tmp <- data[cb[,i],] - groups <- paste0(rownames(data)[cb[,i]], collapse = " | ") - - res <- tryCatch({ - chisq.test(tmp) - }, warning = function(w) { - tryCatch({fisher.test(tmp)}, error = function(e) { - return(fisher.test(tmp, simulate.p.value = TRUE)) - }) - }) - val_percent <- apply(tmp, 1, function(x) { - sprintf("%s (%s%%)", x, round(x / sum(x), 2) * 100) - }) - val_percent1 <- paste0(colnames(tmp), ":", val_percent[,1]) - val_percent1 <- paste0(val_percent1, collapse = " | ") - val_percent2 <- paste0(colnames(tmp), ":", val_percent[,2]) - val_percent2 <- paste0(val_percent2, collapse = " | ") - tmp <- data.frame( - groups = groups, - val_percent_left = val_percent1, - val_percent_right = val_percent2, - statistic = ifelse(is.null(res$statistic), NA, - as.numeric(res$statistic)), - pvalue = as.numeric(res$p.value), - method = res$method - ) - final <- rbind(final, tmp) -} -final <- as.data.frame(final) -final$pvalue < as.numeric(final$pvalue) -final$statistic < as.numeric(final$statistic) - -# ... (see full tutorial for more) -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/019-chi-square-fisher.html diff --git a/skills/Hiplot/020-chord_skill.md b/skills/Hiplot/020-chord_skill.md deleted file mode 100644 index 8e8c2c8fa8..0000000000 --- a/skills/Hiplot/020-chord_skill.md +++ /dev/null @@ -1,71 +0,0 @@ -# Skill: Chord Plot (R) - -## Category -Hiplot - -## When to Use -The complex interaction is visualized in the form of chord graph. - -## Required R Packages -- circlize -- data.table -- ggplotify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(circlize) -library(data.table) -library(ggplotify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/chord/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -row.names(data) <- data[, 1] -data <- data[, -1] -data <- as.matrix(data) - -# View data -head(data) - -# Create visualization -# Chord Plot -Palette <- c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF","#F39B7FFF", - "#8491B4FF","#91D1C2FF","#DC0000FF","#7E6148FF","#B09C85FF") -grid.col <- c(Palette, Palette, Palette[1:5]) -p <- as.ggplot(function() { - chordDiagram( - data, grid.col = grid.col, grid.border = NULL, transparency = 0.5, - row.col = NULL, column.col = NULL, order = NULL, - directional = 0, # 1, -1, 0, 2 - direction.type = "diffHeight", # diffHeight and arrows - diffHeight = convert_height(2, "mm"), reduce = 1e-5, xmax = NULL, - self.link = 2, symmetric = FALSE, keep.diagonal = FALSE, - preAllocateTracks = NULL, - annotationTrack = c("name", "grid", "axis"), - annotationTrackHeight = convert_height(c(3, 3), "mm"), - link.border = NA, link.lwd = par("lwd"), link.lty = par("lty"), - link.sort = FALSE, link.decreasing = TRUE, link.largest.ontop = FALSE, - link.visible = T, link.rank = NULL, link.overlap = FALSE, - scale = F, group = NULL, big.gap = 10, small.gap = 1 - ) - }) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/020-chord.html diff --git a/skills/Hiplot/021-circle-packing_skill.md b/skills/Hiplot/021-circle-packing_skill.md deleted file mode 100644 index 919e1224f4..0000000000 --- a/skills/Hiplot/021-circle-packing_skill.md +++ /dev/null @@ -1,71 +0,0 @@ -# Skill: Circle Packing (R) - -## Category -Hiplot - -## When to Use -Circle packing is a visualization method used to display the differences in quantity among different categories. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite -- packcircles -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) -library(packcircles) -library(viridis) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/circle-packing/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -packing <- circleProgressiveLayout(data[["v"]], sizetype = "area") -data <- cbind(data, packing) -dat_gg <- circleLayoutVertices(packing, npoints = 50) -colors <- c("#E57164","#F8ECA7","#9389C1","#3F9C78","#769F8D","#E5F9A9","#7CE9A4", - "#CE9FCA","#78F197","#8BB085","#D88880","#A6E4C3","#F7F6B1","#C5E69A", - "#F45FDE","#5CF371","#9259CF","#2B6D9B","#F3C096","#EEADBE") -dat_gg$value <- rep(colors, each = 51) - -# View data -head(data) - -# Create visualization -# Circle Packing -p <- ggplot() + - geom_polygon(data = dat_gg, aes(x, y, group = id, fill = value), colour = "black", alpha = 0.4) + - scale_fill_manual(values = magma(nrow(data))) + - theme_void() + - theme(legend.position = "none") + - coord_equal() + - scale_size_continuous(range = c(2.3, 4.5)) + - geom_text(data = data, aes(x, y, size = v, label = g), vjust = 0) + - geom_text(data = data, aes(x, y, label = v, size = v), vjust = 1.2) - -p -``` - -## Key Parameters -- `group`: Maps `id` to the group aesthetic -- `fill`: Maps `value` to the fill aesthetic -- `size`: Maps `v` to the size aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/021-circle-packing.html diff --git a/skills/Hiplot/023-circular-barplot_skill.md b/skills/Hiplot/023-circular-barplot_skill.md deleted file mode 100644 index e80811676d..0000000000 --- a/skills/Hiplot/023-circular-barplot_skill.md +++ /dev/null @@ -1,84 +0,0 @@ -# Skill: Circular Barplot (R) - -## Category -Hiplot - -## When to Use -Drawing circular barplot - -## Required R Packages -- data.table -- dplyr -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/circular-barplot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data$group <- as.factor(data$group) -empty_bar <- 2 -to_add <- data.frame(matrix(NA, empty_bar*nlevels(data$group), ncol(data))) -colnames(to_add) <- colnames(data) -to_add$group <- rep(levels(data$group), each=empty_bar) -data <- rbind(data, to_add) -data <- data %>% arrange(group) -data$id <- seq(1, nrow(data)) - -label_data <- data -number_of_bar <- nrow(label_data) -angle <- 90 - 360 * (label_data$id-0.5) /number_of_bar -label_data$hjust <- ifelse( angle < -90, 1, 0) -label_data$angle <- ifelse(angle < -90, angle+180, angle) - -base_data <- data %>% - group_by(group) %>% - dplyr::summarize(start=min(id), end=max(id) - empty_bar) %>% - rowwise() %>% - mutate(title=mean(c(start, end))) - -# View data -head(data) - -# Create visualization -# Circular Barplot -p <- ggplot(data, aes(x=as.factor(id), y=value, fill=group)) + - geom_bar(aes(x=as.factor(id), y=value, fill=group), stat="identity", alpha=0.5) + - ylim(-50,max(na.omit(data$value))+30) + - geom_segment(data=base_data, aes(x = start, y = -5, xend = end, yend = -5), colour = "black", alpha=0.8, size=0.8 , inherit.aes = FALSE ) + - geom_text(data=base_data, aes(x = title, y = -12, label=group), colour = "black", alpha=0.8, size=4, fontface="bold", inherit.aes = FALSE) + - geom_text(data=label_data, aes(x=id, y=value+8, label=individual, hjust=hjust), color="black", fontface="bold",alpha=0.6, size=3, angle= label_data$angle, inherit.aes = FALSE ) + - geom_text(data=label_data, aes(x=id, y=value-10, label=value, hjust=hjust), color="black", fontface="bold",alpha=0.6, size=3, angle= label_data$angle, inherit.aes = FALSE ) + - coord_polar() + - scale_fill_manual(values = c("#3b4992ff","#ee0000ff","#008b45ff","#631879ff")) + - theme_minimal() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `id` to the x aesthetic -- `y`: Maps `value` to the y aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/023-circular-barplot.html diff --git a/skills/Hiplot/024-circular-pie-chart_skill.md b/skills/Hiplot/024-circular-pie-chart_skill.md deleted file mode 100644 index c02255f4f7..0000000000 --- a/skills/Hiplot/024-circular-pie-chart_skill.md +++ /dev/null @@ -1,80 +0,0 @@ -# Skill: Circular Pie Chart (R) - -## Category -Hiplot - -## When to Use -Another form of the pie chart. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/circular-pie-chart/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data$draw_percent <- data[["values"]] / sum(data[["values"]]) * 100 -data$draw_class <- 1 -data2 <- data -data2[["values"]] <- 0 -data2$draw_class <- 0 -data <- rbind(data, data2) -filtered_data <- data[data[["values"]] > 0,] - -# View data -head(data) - -# Create visualization -# Circular Pie Chart -p <- ggplot(data, aes(x = draw_class, y = values, fill = labels)) + - geom_bar(position = "stack", stat = "identity", width = 0.7) + - geom_text(data = filtered_data, aes(label = sprintf("%.2f%%", draw_percent)), - position = position_stack(vjust = 0.5), size = 3) + - coord_polar(theta = "y") + - xlab("") + - ylab("Pie Chart") + - scale_fill_manual(values = c("#e64b35ff","#4dbbd5ff","#00a087ff","#3c5488ff","#f39b7fff")) + - theme_minimal() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(color = "black"), - axis.text.y = element_blank(), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank()) - -p -``` - -## Key Parameters -- `x`: Maps `draw_class` to the x aesthetic -- `y`: Maps `values` to the y aesthetic -- `fill`: Maps `labels` to the fill aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/024-circular-pie-chart.html diff --git a/skills/Hiplot/025-complex-heatmap_skill.md b/skills/Hiplot/025-complex-heatmap_skill.md deleted file mode 100644 index 24c6af301b..0000000000 --- a/skills/Hiplot/025-complex-heatmap_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Complex Heatmap (R) - -## Category -Hiplot - -## When to Use -A multi-omics plugins to draw heatmap, meta annotation, and mutations. - -## Required R Packages -- ComplexHeatmap -- circlize -- cowplot -- data.table -- ggplotify -- hiplotlib -- jsonlite -- randomcoloR -- stringr - -## Minimal Reproducible Code -```r -# Load packages -library(ComplexHeatmap) -library(circlize) -library(cowplot) -library(data.table) -library(ggplotify) -library(hiplotlib) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/complex-heatmap/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) -data2 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/complex-heatmap/data.json")$exampleData[[1]]$textarea[[2]]) -data2 <- as.data.frame(data2) - -# convert data structure -keep_vars_ref <- ls() -row.names(data) <- data[, 1] -data <- data[, -1] -axis_raw <- c("KRAS","GBP4") -exp_start_col <- which(colnames(data) == axis_raw[2]) -mut_start_col <- which(colnames(data) == axis_raw[1]) -heat_mat <- as.matrix(t(data[, exp_start_col:ncol(data)])) -mut_mat <- as.matrix(t(data[, mut_start_col:(exp_start_col - 1)])) -mut_mat[is.na(mut_mat)] <- "" - -color_key <- c("#196ABD", "#3399FF", "#3399FF", "#f4f4f4", "#f4f4f4", "#f4f4f4", "#FF3333", "#FF3333", "#C20B01") - -cols <- c() -for (i in 1:nrow(data2)) { - cols[data2[i,1]] <- data2[i,2] -} -col_meta <- list() -col_meta_pre <- list() -items <- c() -for (i in 1:(mut_start_col - 1)) { - ref <- unique(data[, i]) - ref <- ref[!is.na(ref) & ref != ""] - if (any(is.numeric(ref)) & length(ref) > 2) { - col_meta_pre[[colnames(data)[i]]] <- hiplotlib::col_fun_cont(data[,i]) - } else if (length(ref) == 2 & any(is.numeric(ref))) { - col_meta_pre[[colnames(data)[i]]] <- c("#f4f4f4", "#5a5a5a") - items <- c(items, ref) - } else if (length(ref) == 2 & any(is.character(ref))) { - col_meta_pre[[colnames(data)[i]]] <- c("#196ABD", "#C20B01") - items <- c(items, unique(data[, i])) - } else if (length(unique(data[, i])) > 2) { - col_meta_pre[[colnames(data)[i]]] <- distinctColorPalette( - length(unique(data[, i])) - ) -# ... (see full tutorial for more) -``` - -## Key Parameters -- `width`: Controls element width -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/025-complex-heatmap.html diff --git a/skills/Hiplot/026-connected-scatterplot_skill.md b/skills/Hiplot/026-connected-scatterplot_skill.md deleted file mode 100644 index 14997bbae5..0000000000 --- a/skills/Hiplot/026-connected-scatterplot_skill.md +++ /dev/null @@ -1,83 +0,0 @@ -# Skill: Connected Scatterplot (R) - -## Category -Hiplot - -## When to Use -Connected scatterplot - -## Required R Packages -- data.table -- dplyr -- ggplot2 -- ggrepel -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(ggplot2) -library(ggrepel) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/connected-scatterplot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Connected Scatterplot -connected_scatterplot <- function(data, x, y, label, label_ratio, line_color, arrow_size, label_size) { - - draw_data <- data.frame( - x = data[[x]], - y = data[[y]], - label = data[[label]] - ) - - add_label_data <- draw_data %>% sample_frac(label_ratio) - rm(data) - - p <- ggplot(draw_data, aes(x = x, y = y, label = label)) + - geom_point(color = line_color) + - geom_text_repel(data = add_label_data, size = label_size) + - geom_segment( - color = line_color, - aes( - xend = c(tail(x, n = -1), NA), - yend = c(tail(y, n = -1), NA) - ), - arrow = arrow(length = unit(arrow_size, "mm")) - ) - - return(p) -} - -p <- connected_scatterplot( - data = if (exists("data") && is.data.frame(data)) data else "", - x = "Alice", - y = "Anna", - label = "year", - label_ratio = 0.5, - line_color = "#1A237E", -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `x` to the x aesthetic -- `y`: Maps `y` to the y aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/026-connected-scatterplot.html diff --git a/skills/Hiplot/027-contour-matrix_skill.md b/skills/Hiplot/027-contour-matrix_skill.md deleted file mode 100644 index 71b43d4875..0000000000 --- a/skills/Hiplot/027-contour-matrix_skill.md +++ /dev/null @@ -1,86 +0,0 @@ -# Skill: Contour (Matrix) (R) - -## Category -Hiplot - -## When to Use -The contour map (matrix) is a graph that displays three-dimensional data in a two-dimensional form - -## Required R Packages -- cowplot -- data.table -- ggisoband -- ggplot2 -- jsonlite -- reshape2 - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(data.table) -library(ggisoband) -library(ggplot2) -library(jsonlite) -library(reshape2) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/contour-matrix/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data <- as.matrix(data) -colnames(data) <- NULL -data3d <- reshape2::melt(data) -names(data3d) <- c("x", "y", "z") - -# View data -head(data3d) - -# Create visualization -# Contour (Matrix) -complex_general_theme <- - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p1 <- ggplot(data3d, aes(x, y, z = z)) + - geom_isobands( - alpha = 1, - aes(color = stat(zmin)), fill = NA - ) + - scale_color_viridis_c() + - coord_cartesian(expand = FALSE) + - theme_bw() + - complex_general_theme - -p2 <- ggplot(data3d, aes(x, y, z = z)) + - geom_isobands( - alpha = 1, - aes(fill = stat(zmin)), color = NA - ) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `color`: Maps `stat` to the color aesthetic -- `fill`: Maps `stat` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/027-contour-matrix.html diff --git a/skills/Hiplot/028-contour-xy_skill.md b/skills/Hiplot/028-contour-xy_skill.md deleted file mode 100644 index e76301e214..0000000000 --- a/skills/Hiplot/028-contour-xy_skill.md +++ /dev/null @@ -1,73 +0,0 @@ -# Skill: Contour (XY) (R) - -## Category -Hiplot - -## When to Use -Contour plot (XY) is a data processing method that reflects data density through contour line. - -## Required R Packages -- data.table -- ggisoband -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggisoband) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/contour-xy/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -colnames(data) <- c("xvalue", "yvalue") - -# View data -head(data) - -# Create visualization -# Contour (XY) -p <- ggplot(data, aes(xvalue, yvalue)) + - geom_density_bands( - alpha = 1, - aes(fill = stat(density)), color = "gray40", size = 0.2 - ) + - geom_point(alpha = 1, shape = 21, fill = "white") + - scale_fill_viridis_c(guide = "legend") + - ylab("value2") + - xlab("value1") + - ggtitle("Contour-XY Plot") + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `fill`: Maps `stat` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/028-contour-xy.html diff --git a/skills/Hiplot/029-cor-heatmap-simple_skill.md b/skills/Hiplot/029-cor-heatmap-simple_skill.md deleted file mode 100644 index 99be207eae..0000000000 --- a/skills/Hiplot/029-cor-heatmap-simple_skill.md +++ /dev/null @@ -1,72 +0,0 @@ -# Skill: Simplified Correlation Heatmap (R) - -## Category -Hiplot - -## When to Use -Simplified variables correlation heatmap - -## Required R Packages -- data.table -- ggplot2 -- jsonlite -- sigminer - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) -library(sigminer) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/cor-heatmap-simple/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Simplified Correlation Heatmap -p <- show_cor( - data = data, - x_vars = c("mpg","cyl","disp"), - y_vars = c("wt","hp","drat"), - cor_method = "pearson", - vis_method = "square", - lab = T, - test = T, - hc_order = F, - legend.title = "Corr" - ) + - ggtitle("") + - labs(x="", y="") + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/029-cor-heatmap-simple.html diff --git a/skills/Hiplot/030-cor-heatmap_skill.md b/skills/Hiplot/030-cor-heatmap_skill.md deleted file mode 100644 index 5b9330f6eb..0000000000 --- a/skills/Hiplot/030-cor-heatmap_skill.md +++ /dev/null @@ -1,81 +0,0 @@ -# Skill: Correlation Heatmap (R) - -## Category -Hiplot - -## When to Use -The correlation heat map is a graph that analyzes the correlation between two or more variables. - -## Required R Packages -- data.table -- ggcorrplot -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggcorrplot) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/cor-heatmap/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data <- data[!is.na(data[, 1]), ] -idx <- duplicated(data[, 1]) -data[idx, 1] <- paste0(data[idx, 1], "--dup-", cumsum(idx)[idx]) -rownames(data) <- data[, 1] -data <- data[, -1] -str2num_df <- function(x) { - final <- NULL - for (i in seq_len(ncol(x))) { - final <- cbind(final, as.numeric(x[, i])) - } - colnames(final) <- colnames(x) - return(final) -} -tmp <- str2num_df(t(data)) -corr <- round(cor(tmp, use = "na.or.complete", method = "pearson"), 3) -p_mat <- round(cor_pmat(tmp, method = "pearson"), 3) - -# View data -head(data) - -# Create visualization -# Correlation Heatmap -p <- ggcorrplot( - corr, - colors = c("#4477AA", "#FFFFFF", "#BB4444"), - method = "circle", - hc.order = T, - hc.method = "ward.D2", - outline.col = "white", - ggtheme = theme_bw(), - type = "upper", - lab = F, - lab_size = 3, - legend.title = "Correlation" - ) + - ggtitle("Cor Heatmap Plot") + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), -# ... (see full tutorial for more) -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/030-cor-heatmap.html diff --git a/skills/Hiplot/033-corrplot_skill.md b/skills/Hiplot/033-corrplot_skill.md deleted file mode 100644 index e640dfb03c..0000000000 --- a/skills/Hiplot/033-corrplot_skill.md +++ /dev/null @@ -1,82 +0,0 @@ -# Skill: Corrplot (R) - -## Category -Hiplot - -## When to Use -The correlation heat map is a graph that analyzes the correlation between two or more variables. - -## Required R Packages -- corrplot -- data.table -- ggcorrplot -- ggplotify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(corrplot) -library(data.table) -library(ggcorrplot) -library(ggplotify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/corrplot/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data <- data[!is.na(data[, 1]), ] -idx <- duplicated(data[, 1]) -data[idx, 1] <- paste0(data[idx, 1], "--dup-", cumsum(idx)[idx]) -rownames(data) <- data[, 1] -data <- data[, -1] -str2num_df <- function(x) { - final <- NULL - for (i in seq_len(ncol(x))) { - final <- cbind(final, as.numeric(x[, i])) - } - colnames(final) <- colnames(x) - return(final) -} -tmp <- str2num_df(t(data)) -corr <- round(cor(tmp, use = "na.or.complete", method = "pearson"), 3) -p_mat <- round(cor_pmat(tmp, method = "pearson"), 3) - -# View data -head(data) - -# Create visualization -# Corrplot -p <- as.ggplot(function(){ - corrplot( - corr, - method = "circle", - type = "upper", - tl.col = "black", - diag = F, - col = colorRampPalette(c("#4477AA", "#FFFFFF", "#BB4444"))(200), - order = "hclust", - hclust.method = "ward.D2") - }) + - xlab("") + ylab("") + - ggtitle("Cor Heatmap Plot") + - theme_void() + - theme(text = element_text(family = "Arial"), -# ... (see full tutorial for more) -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_void()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/033-corrplot.html diff --git a/skills/Hiplot/034-custom-heat-map_skill.md b/skills/Hiplot/034-custom-heat-map_skill.md deleted file mode 100644 index 9b13fc118f..0000000000 --- a/skills/Hiplot/034-custom-heat-map_skill.md +++ /dev/null @@ -1,71 +0,0 @@ -# Skill: Custom Heatmap (R) - -## Category -Hiplot - -## When to Use -Custom Heatmap, directly plot a heatmap based on the given data. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/custom-heat-map/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -draw_data <- as.matrix(data[, 2:ncol(data)]) -row_num <- nrow(draw_data) -col_num <- ncol(draw_data) -col_labels <- colnames(data) -col_labels <- col_labels[2:ncol(data)] -row_labels <- data$name -rm(data) -df <- expand.grid(row = 1:row_num, col = 1:col_num) -df$value <- c(draw_data) - -# View data -head(df) - -# Create visualization -# Custom Heatmap -p <- ggplot(df, aes(x = col, y = row, fill = value)) + - geom_point(shape = 21, size = 8, aes(fill = value), color = "white") + - scale_fill_gradient(low = "#DDDDDD", high = "#0000F5") + - guides(fill = guide_colorbar(title = "Value")) + - theme( - panel.background = element_rect(fill = "white"), - panel.grid = element_blank(), - axis.text = element_text(size = 10), - axis.ticks = element_blank(), - axis.title = element_blank() - ) + - scale_x_continuous(breaks = 1:col_num, labels = col_labels, position = "top") + - scale_y_reverse(breaks = 1:row_num, labels = row_labels, position = "left") - -p -``` - -## Key Parameters -- `x`: Maps `col` to the x aesthetic -- `y`: Maps `row` to the y aesthetic -- `fill`: Maps `value` to the fill aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/034-custom-heat-map.html diff --git a/skills/Hiplot/035-custom-icon-scatter_skill.md b/skills/Hiplot/035-custom-icon-scatter_skill.md deleted file mode 100644 index 9c0507b8c3..0000000000 --- a/skills/Hiplot/035-custom-icon-scatter_skill.md +++ /dev/null @@ -1,62 +0,0 @@ -# Skill: Custom Icon Scatter (R) - -## Category -Hiplot - -## When to Use -A scatter plot with customizable icons. - -## Required R Packages -- data.table -- echarts4r -- echarts4r.assets -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(echarts4r) -library(echarts4r.assets) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/custom-icon-scatter/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -draw_data <- data.frame( - x = data[["mpg"]], - y = data[["wt"]], - size = data[["qsec"]] - ) -rm(data) - -# View data -head(draw_data) - -# Create visualization -# Custom Icon Scatter -p <- draw_data |> - e_charts(x) |> - e_scatter( - y, - size, - symbol = ea_icons("warning"), - name = "warning" - ) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/035-custom-icon-scatter.html diff --git a/skills/Hiplot/036-d3-wordcloud_skill.md b/skills/Hiplot/036-d3-wordcloud_skill.md deleted file mode 100644 index 42ae8551db..0000000000 --- a/skills/Hiplot/036-d3-wordcloud_skill.md +++ /dev/null @@ -1,59 +0,0 @@ -# Skill: D3 Wordcloud (R) - -## Category -Hiplot - -## When to Use -Display the wordcloud。 - -## Required R Packages -- d3wordcloud -- data.table -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(d3wordcloud) -library(data.table) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/d3-wordcloud/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -row.names(data) <- data[, 1] - -# View data -head(data) - -# Create visualization -# D3 Wordcloud -p <- d3wordcloud( - words = data[, 1], - freqs = data[, 2], - padding = 0, - rotate.min = 0, - rotate.max = 0, - size.scale = "linear", - color.scale = "linear", - spiral = "archimedean", - font = "Arial", - rangesizefont = c(10, 90) -) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/036-d3-wordcloud.html diff --git a/skills/Hiplot/037-dendrogram_skill.md b/skills/Hiplot/037-dendrogram_skill.md deleted file mode 100644 index fdf071faf0..0000000000 --- a/skills/Hiplot/037-dendrogram_skill.md +++ /dev/null @@ -1,63 +0,0 @@ -# Skill: Dendrogram (R) - -## Category -Hiplot - -## When to Use -The dendrogram is a diagram representing a tree. This diagrammatic representation is frequently used in different contexts:In hierarchical clustering, it illustrates the arrangement of the clusters produced by the corresponding analyses. - -## Required R Packages -- ape -- data.table -- ggplotify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(ape) -library(data.table) -library(ggplotify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/dendrogram/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data <- data[, -1] - -# View data -head(data) - -# Create visualization -# Dendrogram -d <- dist(t(data), method = "euclidean") -hc <- hclust(d, method = "complete") -clus <- cutree(hc, 4) - -p <- as.ggplot(function() { - par(mar = c(5, 5, 10, 5), mgp = c(2.5, 1, 0)) - plot(as.phylo(hc), - type = "phylogram", - tip.color = c("#00468bff","#ed0000ff","#42b540ff","#0099b4ff")[clus], - label.offset = 1, - cex = 1, font = 2, use.edge.length = T - ) - title("Dendrogram Plot", line = 1) - }) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/037-dendrogram.html diff --git a/skills/Hiplot/038-density-hist-mirror_skill.md b/skills/Hiplot/038-density-hist-mirror_skill.md deleted file mode 100644 index d801be7bd2..0000000000 --- a/skills/Hiplot/038-density-hist-mirror_skill.md +++ /dev/null @@ -1,82 +0,0 @@ -# Skill: Mirror Density & Histogram (R) - -## Category -Hiplot - -## When to Use -The mirror density & histogram is a graph used to observe the distribution of continuous variables in two side view: top and bottom. - -## Required R Packages -- data.table -- ggplot2 -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/density-hist-mirror/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -sides <- data[1,] -data <- data[-1,] -for (i in 1:ncol(data)) { - data[,i] <- as.numeric(data[,i]) -} - -# View data -head(data) - -# Create visualization -# Mirror Density -p <- ggplot(data, aes(x=x)) -colrs <- c("#e64b35ff","#4dbbd5ff","#00a087ff","#3c5488ff","#f39b7fff","#8491b4ff") -colrs2 <- colnames(data) -for (i in seq_len(length(sides))) { - eval(parse( - text = sprintf("p <- p + geom_density(aes(x = %s, y = %s..density.., color = '%s', fill = '%s'), kernel = '%s')", - colnames(data)[i], ifelse(sides[i] == "top", "", "-"), colnames(data)[i], - colnames(data)[i], "gaussian") - )) - names(colrs)[i] <- colnames(data)[i] - names(colrs2)[i] <- colrs[i] -} -p <- p + - ggtitle("") + - scale_fill_manual(values=colrs, name="Densities") + - scale_color_manual(values=colrs, name="Densities") + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `x` to the x aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/038-density-hist-mirror.html diff --git a/skills/Hiplot/039-density-histogram_skill.md b/skills/Hiplot/039-density-histogram_skill.md deleted file mode 100644 index 679839dfae..0000000000 --- a/skills/Hiplot/039-density-histogram_skill.md +++ /dev/null @@ -1,77 +0,0 @@ -# Skill: Density-Histogram (R) - -## Category -Hiplot - -## When to Use -Use density plots or histograms to show data distribution. - -## Required R Packages -- data.table -- dplyr -- grafify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(grafify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/density-histogram/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -y <- "Doubling_time" -group <- "Student" -data[, group] <- factor(data[, group], levels = unique(data[, group])) -data <- data %>% - mutate(median = median(get(y), na.rm = TRUE), - mean = mean(get(y), na.rm = TRUE)) - -# View data -head(data) - -# Create visualization -# Density Plot -p <- plot_density( - data = data, - ycol = get(y), - group = get(group), - linethick = 0.5, - c_alpha = 0.6) + - ggtitle("Density Plot") + - geom_vline(aes_string(xintercept = "median"), - colour = 'black', linetype = 2, size = 0.5) + - xlab(y) + - ylab("density") + - guides(fill = guide_legend(title = group), color = FALSE) + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "bottom", - legend.direction = "horizontal", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/039-density-histogram.html diff --git a/skills/Hiplot/040-density_skill.md b/skills/Hiplot/040-density_skill.md deleted file mode 100644 index e27757ae56..0000000000 --- a/skills/Hiplot/040-density_skill.md +++ /dev/null @@ -1,69 +0,0 @@ -# Skill: Density (R) - -## Category -Hiplot - -## When to Use -The kernel density map is a graph used to observe the distribution of continuous variables. - -## Required R Packages -- data.table -- ggplot2 -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/density/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data[,2] <- factor(data[,2], levels = unique(data[,2])) - -# View data -head(data) - -# Create visualization -# Density -data["group_add_by_code"] <- "g1" - -p <- ggplot(data, aes_(as.name(colnames(data[1])))) + - geom_density(col = "white", alpha = 0.85, - aes_(fill = as.name(colnames(data[2])))) + - ggtitle("") + - scale_fill_manual(values = c("#e04d39","#5bbad6")) + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/040-density.html diff --git a/skills/Hiplot/041-deviation-plot_skill.md b/skills/Hiplot/041-deviation-plot_skill.md deleted file mode 100644 index 03b1f7b347..0000000000 --- a/skills/Hiplot/041-deviation-plot_skill.md +++ /dev/null @@ -1,76 +0,0 @@ -# Skill: Deviation Plot (R) - -## Category -Hiplot - -## When to Use -Deviation plot provides a visual representation of the differences between data points. - -## Required R Packages -- data.table -- ggpubr -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggpubr) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/deviation-plot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data[["z_score"]] <- (data[["mpg"]] - mean(data[["mpg"]])) / sd(data[["mpg"]]) -data[["Group"]] <- factor(ifelse(data[["z_score"]] < 0, "low", "high"), - levels = c("low", "high") - ) - -# View data -head(data) - -# Create visualization -# Deviation Plot -p <- ggbarplot(data, - x = "name", - y = "z_score", - fill = "Group", - color = "white", - sort.val = "desc", - sort.by.groups = FALSE, - x.text.angle = 90, - xlab = "name", - ylab = "mpg", - rotate = TRUE - ) + - scale_fill_manual(values = c("#e04d39","#5bbad6")) + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/041-deviation-plot.html diff --git a/skills/Hiplot/042-diffusion-map_skill.md b/skills/Hiplot/042-diffusion-map_skill.md deleted file mode 100644 index 98838220b4..0000000000 --- a/skills/Hiplot/042-diffusion-map_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Diffusion Map (R) - -## Category -Hiplot - -## When to Use -Diffusion Map is a nonlinear dimensionality reduction algorithm that can be used to visualize developmental trajectories. - -## Required R Packages -- BiocManager -- data.table -- destiny -- ggplotify -- ggpubr -- jsonlite -- scatterplot3d -- smoother - -## Minimal Reproducible Code -```r -# Load packages -library(BiocManager) -library(data.table) -library(destiny) -library(ggplotify) -library(ggpubr) -library(jsonlite) - -# Prepare data -# Load data -data1 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/diffusion-map/data.json")$exampleData[[1]]$textarea[[1]]) -data1 <- as.data.frame(data1) -data2 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/diffusion-map/data.json")$exampleData[[1]]$textarea[[2]]) -data2 <- as.data.frame(data2) - -# convert data structure -sample.info <- data2 -rownames(data1) <- data1[, 1] -data1 <- as.matrix(data1[, -1]) -## tsne -set.seed(123) -dm_info <- DiffusionMap(t(data1)) -dm_info <- cbind(DC1 = dm_info$DC1, DC2 = dm_info$DC2, DC3 = dm_info$DC3) -dm_data <- data.frame( - sample = colnames(data1), - dm_info -) - -colorBy <- sample.info[match(colnames(data1), sample.info[, 1]), "Group"] -colorBy <- factor(colorBy, level = colorBy[!duplicated(colorBy)]) -dm_data$colorBy = colorBy - -# View data -head(dm_data) - -# Create visualization -# 2D Diffusion Map -p <- ggscatter(data = dm_data, x = "DC1", y = "DC2", color = "colorBy", - size = 2, palette = "lancet", alpha = 1) + - labs(color = "Group") + - ggtitle("Diffusion Map") + - scale_color_manual(values = c("#3B4992FF","#EE0000FF","#008B45FF")) + - theme_classic() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", -# ... (see full tutorial for more) -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_classic()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/042-diffusion-map.html diff --git a/skills/Hiplot/043-diverging-scale_skill.md b/skills/Hiplot/043-diverging-scale_skill.md deleted file mode 100644 index b79e4c196c..0000000000 --- a/skills/Hiplot/043-diverging-scale_skill.md +++ /dev/null @@ -1,56 +0,0 @@ -# Skill: Diverging Scale (R) - -## Category -Hiplot - -## When to Use -The diverging scale is a graph that maps a continuous, quantitative input to a continuous fixed interpolator. - -## Required R Packages -- data.table -- ggcharts -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggcharts) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/diverging-scale/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data <- dplyr::transmute(.data = data, x = model, y = scale(hp)) - -# View data -head(data) - -# Create visualization -# Diverging Scale Barplot -fill_colors <- c("#C20B01", "#196ABD") -fill_colors <- fill_colors[c(any(data[, "y"] > 0), any(data[, "y"] < 0))] -p <- diverging_bar_chart(data = data, x = x, y = y, bar_colors = fill_colors, - text_color = '#000000') + - theme(axis.text.x = element_text(color = "#000000"), - axis.title.x = element_text(colour = "#000000"), - axis.title.y = element_text(colour = "#000000"), - plot.background = element_blank()) + - labs(x = "model", y = "scale(hp)", title = "") - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/043-diverging-scale.html diff --git a/skills/Hiplot/044-diy-gsea_skill.md b/skills/Hiplot/044-diy-gsea_skill.md deleted file mode 100644 index ada83415c3..0000000000 --- a/skills/Hiplot/044-diy-gsea_skill.md +++ /dev/null @@ -1,63 +0,0 @@ -# Skill: DIY GSEA (R) - -## Category -Hiplot - -## When to Use -Create a DIY GSEA using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- clusterProfiler -- data.table -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(clusterProfiler) -library(data.table) -library(jsonlite) - -# Prepare data -# Load data -data1 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/diy-gsea/data.json")$exampleData$textarea[[1]]) -data1 <- as.data.frame(data1) -data2 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/diy-gsea/data.json")$exampleData$textarea[[2]]) -data2 <- as.data.frame(data2) - -# convert data structure -data1[,2] <- as.numeric(data1[,2]) -geneList <- data1[,2] -names(geneList) <- data1[,1] -geneList <- sort(geneList, decreasing = TRUE) -term <- data.frame(term=data2[,1], gene=data2[,2]) - -# View data -head(term) - -# Create visualization -# DIY GSEA -y <- clusterProfiler::GSEA(geneList, TERM2GENE = term, pvalueCutoff = 1) -p <- gseaplot( - y, - y@result$Description[1], - color = "#000000", - by = "runningScore", - color.line = "#4CAF50", - color.vline= "#FA5860", - title = "DIY GSEA Plot", - ) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/044-diy-gsea.html diff --git a/skills/Hiplot/045-donut_skill.md b/skills/Hiplot/045-donut_skill.md deleted file mode 100644 index b822efca4e..0000000000 --- a/skills/Hiplot/045-donut_skill.md +++ /dev/null @@ -1,68 +0,0 @@ -# Skill: Donut (R) - -## Category -Hiplot - -## When to Use -The donut is a variant of the pie chart, with a blank center allowing for additional information about the data as a whole to be included. Doughnut charts are similar to pie charts in that their aim is to illustrate proportions. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/donut/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data$fraction <- data[, 2] / sum(data[, 2]) -data$ymax <- cumsum(data$fraction) -data$ymin <- c(0, head(data$ymax, n = -1)) -data$labelPosition <- (data$ymax + data$ymin) / 2 -data$label <- paste0(data[, 1], "\n", - "(", data[, 2], ", ", sprintf("%2.2f%%", 100 * data[, 2] / sum(data[, 2])), ")", - sep = "" -) - -# View data -head(data) - -# Create visualization -# Donut -p <- ggplot(data, aes_(ymax = as.name("ymax"), ymin = as.name("ymin"), - xmax = 4, xmin = 3, fill = as.name(colnames(data)[1]))) + - geom_rect() + - geom_text(x = 5 + (4 - 5) / 3, - aes(y = labelPosition, label = label), size = 4) + - coord_polar(theta = "y") + - xlim(c(2, 5)) + - scale_fill_manual(values = c("#00468BCC","#ED0000CC","#42B540CC","#0099B4CC")) + - ggtitle("Donut Plot") + - theme_void() + - theme(plot.title = element_text(hjust = 0.5), - legend.position = "none") - -p -``` - -## Key Parameters -- `y`: Maps `labelPosition` to the y aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/045-donut.html diff --git a/skills/Hiplot/046-dotchart_skill.md b/skills/Hiplot/046-dotchart_skill.md deleted file mode 100644 index 7cce3f0622..0000000000 --- a/skills/Hiplot/046-dotchart_skill.md +++ /dev/null @@ -1,64 +0,0 @@ -# Skill: Dotchart (R) - -## Category -Hiplot - -## When to Use -Sliding bead chart is a graph of beads sliding on a column. It is the superposition of bar chart and scatter chart. - -## Required R Packages -- data.table -- ggpubr -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggpubr) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/dotchart/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Dotchart -p <- ggdotchart(data, x = "Name", y = "Value", group = "Group", color = "Group", - rotate = T, sorting = "descending", - y.text.col = F, add = "segments", dot.size = 2) + - xlab("Name") + - ylab("Value") + - ggtitle("DotChart Plot") + - scale_color_manual(values = c("#e04d39","#5bbad6","#1e9f86")) + - theme_classic() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_classic()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/046-dotchart.html diff --git a/skills/Hiplot/047-dual-y-axis_skill.md b/skills/Hiplot/047-dual-y-axis_skill.md deleted file mode 100644 index 78a93b7196..0000000000 --- a/skills/Hiplot/047-dual-y-axis_skill.md +++ /dev/null @@ -1,64 +0,0 @@ -# Skill: Dual Y Axis Chart (R) - -## Category -Hiplot - -## When to Use -The dual Y-axis graph can put two groups of data with larger orders of magnitude in the same graph for display. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/dual-y-axis/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Dual Y Axis Chart -p <- ggplot(data, aes(x = x)) + - geom_line(aes(y = data[, 2]), size = 1, color = "#D72C15") + - geom_line(aes(y = data[, 3] / as.numeric(10)), size = 1, color = "#02657B") + - scale_y_continuous( - name = colnames(data)[2], - sec.axis = sec_axis(~ . * as.numeric(10), name = colnames(data)[3])) + - ggtitle("Dual Y Axis Chart") + xlab("x") + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `x` to the x aesthetic -- `y`: Maps `data` to the y aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/047-dual-y-axis.html diff --git a/skills/Hiplot/048-dumbbell_skill.md b/skills/Hiplot/048-dumbbell_skill.md deleted file mode 100644 index c2f3b3b0dd..0000000000 --- a/skills/Hiplot/048-dumbbell_skill.md +++ /dev/null @@ -1,64 +0,0 @@ -# Skill: Dumbbell Chart (R) - -## Category -Hiplot - -## When to Use -Dumbbell Chart can display the data change. - -## Required R Packages -- data.table -- ggalt -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggalt) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/dumbbell/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Dumbbell Chart -colors <- c("#3B4992FF","#EE0000FF") -p <- ggplot(data, aes(y = reorder(country, y1952), x = y1952, xend = y2007)) + - geom_dumbbell(size = 1, size_x = 3, size_xend = 3, colour = "#AFAFAF", - colour_x = colors[1], colour_xend = colors[2]) + - labs(title = "Dummbbell Chart", x = "Life Expectancy (years)", - y = "country") + - theme_minimal() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `y`: Maps `reorder` to the y aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/048-dumbbell.html diff --git a/skills/Hiplot/049-easy-pairs_skill.md b/skills/Hiplot/049-easy-pairs_skill.md deleted file mode 100644 index 15b26414b3..0000000000 --- a/skills/Hiplot/049-easy-pairs_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Easy Pairs (R) - -## Category -Hiplot - -## When to Use -Display a matrix of plots for viewing correlation relationship and distributions of multiple variables. - -## Required R Packages -- GGally -- data.table -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(GGally) -library(data.table) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/easy-pairs/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Easy Pairs -p <- ggpairs(data, columns = c("total_bill", "time", "tip"), - mapping = aes_string(color = "gender")) + - ggtitle("Easy Pairs") + - scale_fill_manual(values = c("#3B4992FF","#EE0000FF")) + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/049-easy-pairs.html diff --git a/skills/Hiplot/050-easy-som_skill.md b/skills/Hiplot/050-easy-som_skill.md deleted file mode 100644 index e172159450..0000000000 --- a/skills/Hiplot/050-easy-som_skill.md +++ /dev/null @@ -1,79 +0,0 @@ -# Skill: Easy SOM (R) - -## Category -Hiplot - -## When to Use -Establish the SOM model and conduct the visulization. - -## Required R Packages -- data.table -- jsonlite -- kohonen - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(jsonlite) -library(kohonen) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/easy-som/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -target <- data[,1] -target <- factor(target, levels = unique(target)) -data <- data[,-1] -data <- as.data.frame(data) -for (i in 1:ncol(data)) { - data[,i] <- as.numeric(data[,i]) -} -data <- as.matrix(data) -set.seed(7) -kohmap <- xyf(scale(data), target, grid = somgrid(xdim=6, ydim=4, topo="hexagonal"), rlen=100) - -color_key <- c("#A50026","#D73027","#F46D43","#FDAE61","#FEE090","#FFFFBF","#E0F3F8", - "#ABD9E9","#74ADD1","#4575B4","#313695") -colors <- function (n, alpha, rev = FALSE) { - colorRampPalette(color_key)(n) -} - -# View data -head(data[,1:5]) - -# Create visualization -# Easy SOM -p <- function () { - par(mfrow = c(3,2)) - xyfpredictions <- classmat2classvec(getCodes(kohmap, 2)) - plot(kohmap, type="counts", col = as.integer(target), - palette.name = colors, - pchs = as.integer(target), - main = "Counts plot", shape = "straight", border = NA) - - som.hc <- cutree(hclust(object.distances(kohmap, "codes")), 3) - add.cluster.boundaries(kohmap, som.hc) - - plot(kohmap, type="mapping", - labels = as.integer(target), col = colors(3)[as.integer(target)], - palette.name = colors, - shape = "straight", - main = "Mapping plot") - -# ... (see full tutorial for more) -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/050-easy-som.html diff --git a/skills/Hiplot/051-eulerr_skill.md b/skills/Hiplot/051-eulerr_skill.md deleted file mode 100644 index 59f942c9e6..0000000000 --- a/skills/Hiplot/051-eulerr_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Eulerr Plot (R) - -## Category -Hiplot - -## When to Use -Create a Eulerr Plot using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- eulerr -- ggplotify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(eulerr) -library(ggplotify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/eulerr/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -genes <- as.numeric(data[, 2]) -names(genes) <- as.character(data[, 1]) -euler_set <- euler(genes) - -# View data -head(data) - -# Create visualization -# Eulerr Plot -fill <- c("#3B4992FF","#EE0000FF","#008B45FF","#631879FF","#008280FF","#BB0021FF", - "#5F559BFF","#A20056FF") -p <- as.ggplot( - plot(euler_set, - labels = list(col = rep("white", length(genes))), - fills = list(fill = fill), - quantities = list(type = c("percent", "counts"), - col = rep("white", length(genes))), - main = "Eulerr") -) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/051-eulerr.html diff --git a/skills/Hiplot/052-extended-scatter_skill.md b/skills/Hiplot/052-extended-scatter_skill.md deleted file mode 100644 index 89cb9e384e..0000000000 --- a/skills/Hiplot/052-extended-scatter_skill.md +++ /dev/null @@ -1,58 +0,0 @@ -# Skill: Extended Scatter (R) - -## Category -Hiplot - -## When to Use -An extended scatter plot adds marginal plots to the basic scatter plot to provide a more comprehensive view of the data distribution. - -## Required R Packages -- data.table -- ggExtra -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggExtra) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/extended-scatter/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Extended Scatter -p <- ggplot(data, aes(x = wt, y = mpg, color = cyl, size = cyl)) + - geom_point() + - geom_rug(alpha = 0.2, size = 1.5, col = "#4f80b3") + - theme(legend.position = "none") - -p <- ggMarginal( - p, type = "densigram", fill = "#7054cc", color = "#7f0080", - size = 4, bins = 30) - -p -``` - -## Key Parameters -- `x`: Maps `wt` to the x aesthetic -- `y`: Maps `mpg` to the y aesthetic -- `color`: Maps `cyl` to the color aesthetic -- `size`: Maps `cyl` to the size aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/052-extended-scatter.html diff --git a/skills/Hiplot/053-ezcox_skill.md b/skills/Hiplot/053-ezcox_skill.md deleted file mode 100644 index dc6be0d5a1..0000000000 --- a/skills/Hiplot/053-ezcox_skill.md +++ /dev/null @@ -1,52 +0,0 @@ -# Skill: Cox Models Forest (R) - -## Category -Hiplot - -## When to Use -Cox model forest is a visual representation of a COX model that constructs a risk forest map to facilitate variable screening. - -## Required R Packages -- data.table -- ezcox -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ezcox) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ezcox/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Cox Models Forest -p <- show_forest( - data = data, - covariates = c("sex", "ph.ecog"), - controls = "age", - merge_models = F, - drop_controls = F, - add_caption = T -) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/053-ezcox.html diff --git a/skills/Hiplot/054-fan_skill.md b/skills/Hiplot/054-fan_skill.md deleted file mode 100644 index 16129d4df0..0000000000 --- a/skills/Hiplot/054-fan_skill.md +++ /dev/null @@ -1,50 +0,0 @@ -# Skill: Fan Plot (R) - -## Category -Hiplot - -## When to Use -The pie chart is a statistical chart designed to clearly show the percentage of each data group by the size of the pie. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- plotrix - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(plotrix) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/fan/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Fan Plot -p <- as.ggplot(function() { - fan.plot(data[, 2], main = "", labels = as.character(data[, 1]), - col = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF")) - }) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/054-fan.html diff --git a/skills/Hiplot/055-fishplot_skill.md b/skills/Hiplot/055-fishplot_skill.md deleted file mode 100644 index 865c295ed8..0000000000 --- a/skills/Hiplot/055-fishplot_skill.md +++ /dev/null @@ -1,51 +0,0 @@ -# Skill: Fishplot (R) - -## Category -Hiplot - -## When to Use -Clone evolution analysis - -## Required R Packages -- data.table -- fishplot -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(fishplot) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/fishplot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -## Create a fish object -fish = createFishObject(as.matrix(data[,4:7]), parents=data$parents, - timepoints=data$timepoints, - col = c("#888888","#e8130c","#f8150d","#55158f")) -## Calculate the layout of the drawing -fish = layoutClones(fish) -## Draw the plot, using the splining method (recommended), and providing both timepoints to label and a plot title -fishPlot(fish,shape="spline", title.btm="Sample1", title = "Fishplot", - cex.title=1, vlines=c(0,30,75,150), - vlab=c("Day 0","Day 30","Day 75","Day 150")) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/055-fishplot.html diff --git a/skills/Hiplot/056-flowerplot_skill.md b/skills/Hiplot/056-flowerplot_skill.md deleted file mode 100644 index 7407ab4367..0000000000 --- a/skills/Hiplot/056-flowerplot_skill.md +++ /dev/null @@ -1,57 +0,0 @@ -# Skill: Flower plot (R) - -## Category -Hiplot - -## When to Use -Flower plot with multiple sets. - -## Required R Packages -- data.table -- flowerplot -- ggplotify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(flowerplot) -library(ggplotify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/flowerplot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Flower plot -p <- as.ggplot(function(){ - flowerplot( - flower_dat = data, - angle = 90, - a = 0.5, - b = 2, - r = 1, - ellipse_col = "RdBu", - circle_col = "#FFFFFF", - label_text_cex = 1 - )}) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/056-flowerplot.html diff --git a/skills/Hiplot/057-funnel-plot-metafor_skill.md b/skills/Hiplot/057-funnel-plot-metafor_skill.md deleted file mode 100644 index 52d8c7c111..0000000000 --- a/skills/Hiplot/057-funnel-plot-metafor_skill.md +++ /dev/null @@ -1,54 +0,0 @@ -# Skill: Funnel Plot (metafor) (R) - -## Category -Hiplot - -## When to Use -Can be used to show potential bias factors in Meta-analysis. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- metafor - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(metafor) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/funnel-plot-metafor/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data2 <- escalc(ri=ri, ni=ni, data = data, measure="ZCOR") -res <- rma(yi, vi, data = data2) - -# View data -head(data) - -# Create visualization -# Funnel Plot -p <- as.ggplot(function(){ - funnel(x = res, main = "Funnel Plot (metafor)", - level = c(90, 95, 99), shade = c("white","#a90e07","#d23e0b"), refline = 0) - }) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/057-funnel-plot-metafor.html diff --git a/skills/Hiplot/058-funnel-plot_skill.md b/skills/Hiplot/058-funnel-plot_skill.md deleted file mode 100644 index 4653810eb2..0000000000 --- a/skills/Hiplot/058-funnel-plot_skill.md +++ /dev/null @@ -1,51 +0,0 @@ -# Skill: Funnel Plot (R) - -## Category -Hiplot - -## When to Use -Can be used to show potential bias factors in Meta-analysis. - -## Required R Packages -- FunnelPlotR -- data.table -- gridExtra -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(FunnelPlotR) -library(data.table) -library(gridExtra) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/funnel-plot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Funnel Plot -p <- funnel_plot( - data, numerator = los, denominator = prds, group = provnum, data_type = "SR", - limit = 99, label = "outlier", sr_method = "SHMI", trim_by=0.1, - title = "Funnel Plot", x_range = "auto", y_range = "auto" - ) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/058-funnel-plot.html diff --git a/skills/Hiplot/059-gantt_skill.md b/skills/Hiplot/059-gantt_skill.md deleted file mode 100644 index 00479d7426..0000000000 --- a/skills/Hiplot/059-gantt_skill.md +++ /dev/null @@ -1,76 +0,0 @@ -# Skill: Gantt (R) - -## Category -Hiplot - -## When to Use -The Gantt chart is a type of bar chart that illustrates a project schedule. - -## Required R Packages -- data.table -- ggthemes -- jsonlite -- tidyverse - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggthemes) -library(jsonlite) -library(tidyverse) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/gantt/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -usr_ylab <- colnames(data)[1] -if (!is.numeric(data[, 2])) { - data[, 2] <- factor(data[, 2], levels = unique(data[, 2])) -} -data_gather <- gather(data, "state", "date", 3:4) -sample <- levels(data_gather$sample) -data_gather$sample <- factor(data_gather$sample, - levels = rev(unique(data_gather$sample)) -) - -# View data -head(data_gather) - -# Create visualization -# Gantt -p <- ggplot(data_gather, aes(date, sample, color = item)) + - geom_line(size = 10, alpha = 1) + - labs(x = "Time", y = "sample", title = "Gantt Plot") + - theme(axis.ticks = element_blank()) + - scale_color_manual(values = c("#e04d39","#5bbad6","#1e9f86")) + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5, vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `color`: Maps `item` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/059-gantt.html diff --git a/skills/Hiplot/060-gene-density_skill.md b/skills/Hiplot/060-gene-density_skill.md deleted file mode 100644 index d99b614fbb..0000000000 --- a/skills/Hiplot/060-gene-density_skill.md +++ /dev/null @@ -1,83 +0,0 @@ -# Skill: Gene Density (R) - -## Category -Hiplot - -## When to Use -Chrosome data visualization. - -## Required R Packages -- ComplexHeatmap -- RColorBrewer -- circlize -- data.table -- ggplotify -- gtrellis -- jsonlite -- tidyverse - -## Minimal Reproducible Code -```r -# Load packages -library(ComplexHeatmap) -library(RColorBrewer) -library(circlize) -library(data.table) -library(ggplotify) -library(gtrellis) - -# Prepare data -# Load data -data1 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/gene-density/data.json")$exampleData$textarea[[1]]) -data1 <- as.data.frame(data1) -data2 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/gene-density/data.json")$exampleData$textarea[[2]]) -data2 <- as.data.frame(data2) - -# Convert data structure -chrNum <- str_replace(unique(data1$chr), "Chr|chr", "") -data1$chr <- factor(data1$chr, levels = paste0("Chr", chrNum)) -data2$chr <- factor(data2$chr, levels = paste0("Chr", chrNum)) -# Set window to calculate gene density -windows <- 100 * 1000 # default:100kb window size -gene_density <- genomicDensity(data2, window.size = windows) -gene_density$chr <- factor(gene_density$chr, - levels = paste0("Chr", chrNum) -) - -# View data -head(data1) -head(data2) - -# Create visualization -# Set the palettes -palettes <- c("#B2182B","#EF8A62","#FDDBC7","#D1E5F0","#67A9CF","#2166AC") -col_fun <- colorRamp2( - seq(0, max(gene_density[[4]]), length = 6), rev(palettes) - ) -cm <- ColorMapping(col_fun = col_fun) -# Set the Legend -lgd <- color_mapping_legend( - cm, plot = F, title = "density", color_bar = "continuous" - ) -# Plot -p <- as.ggplot(function() { - gtrellis_layout( - data1, n_track = 2, ncol = 1, byrow = FALSE, - track_axis = FALSE, add_name_track = FALSE, - xpadding = c(0.1, 0), gap = unit(1, "mm"), - track_height = unit.c(unit(1, "null"), unit(4, "mm")), - track_ylim = c(0, max(gene_density[[4]]), 0, 1), - border = FALSE, asist_ticks = FALSE, -# ... (see full tutorial for more) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/060-gene-density.html diff --git a/skills/Hiplot/061-gene-rank_skill.md b/skills/Hiplot/061-gene-rank_skill.md deleted file mode 100644 index d2ed54b760..0000000000 --- a/skills/Hiplot/061-gene-rank_skill.md +++ /dev/null @@ -1,82 +0,0 @@ -# Skill: Gene Ranking Dotplot (R) - -## Category -Hiplot - -## When to Use -Gene expression ranking visualization. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- ggrepel -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(ggrepel) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/gene-rank/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -## ordered by log2FoldChange and pvalue -data <- data[order(-data$log2FC, data$pvalue), ] -## add the rank column -data$rank <- 1:nrow(data) -## get the top n up and down gene for labeling -top_n <- 5 -top_n_up <- rownames(head(data, top_n)) -top_n_down <- rownames(tail(data, top_n)) -genes_to_label <- c(top_n_up, top_n_down) -data2 <- data[genes_to_label, ] - -# View data -head(data) - -# Create visualization -# Gene Ranking Dotplot -p <- - ggplot(data, aes(rank, log2FC, color = pvalue, size = abs(log2FC))) + - geom_point() + - scale_color_gradientn(colours = colorRampPalette(brewer.pal(11,'RdYlBu'))(100)) + - geom_hline(yintercept = c(-1, 1), linetype = 2, size = 0.3) + - geom_hline(yintercept = 0, linetype = 1, size = 0.5) + - geom_vline(xintercept = median(data$rank), linetype = 2, size = 0.3) + - geom_text_repel(data = data2, aes(rank, log2FC, label = gene), - size = 3, color = "red") + - xlab("") + ylab("") + - ylim(c(-max(abs(data$log2FC)), max(abs(data$log2FC)))) + - labs(color = "Pvalue", size = "Log2FoldChange") + - theme_bw(base_size = 12) + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), -# ... (see full tutorial for more) -``` - -## Key Parameters -- `color`: Maps `pvalue` to the color aesthetic -- `size`: Maps `abs` to the size aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/061-gene-rank.html diff --git a/skills/Hiplot/062-gene-trend_skill.md b/skills/Hiplot/062-gene-trend_skill.md deleted file mode 100644 index 9829aa2080..0000000000 --- a/skills/Hiplot/062-gene-trend_skill.md +++ /dev/null @@ -1,80 +0,0 @@ -# Skill: Gene Cluster Trend (R) - -## Category -Hiplot - -## When to Use -The gene cluster trend is used to display different gene expression trend with multiple lines showing the similar expression patterns in each cluster. - -## Required R Packages -- Mfuzz -- RColorBrewer -- data.table -- ggplotify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(Mfuzz) -library(RColorBrewer) -library(data.table) -library(ggplotify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/gene-trend/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -## Convert a gene expression matrix to an ExpressionSet object -row.names(data) <- data[,1] -data <- data[,-1] -data <- as.matrix(data) -eset <- new("ExpressionSet", exprs = data) -## Filter genes with more than 25% missing values -eset <- filter.NA(eset, thres=0.25) -## Remove genes with small differences between samples based on standard deviation -eset <- filter.std(eset, min.std=0, visu = F) -## Data Standardization -eset <- standardise(eset) -## Set the number of clusters -c <- 6 -## Evaluate the optimal m value -m <- mestimate(eset) -## Perform mfuzz clustering -cl <- mfuzz(eset, c = c, m = m) - -# View data -head(data) - -# Create visualization -# Gene Cluster Trend -p <- as.ggplot(function(){ - mfuzz.plot2( - eset, - cl, - xlab = "Time", - ylab = "Expression changes", - mfrow = c(2,(c/2+0.5)), - colo = "fancy", - centre = T, - centre.col = "red", - time.labels = colnames(eset), - x11=F) - }) - -# ... (see full tutorial for more) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/062-gene-trend.html diff --git a/skills/Hiplot/063-ggbarstats_skill.md b/skills/Hiplot/063-ggbarstats_skill.md deleted file mode 100644 index bf4216d888..0000000000 --- a/skills/Hiplot/063-ggbarstats_skill.md +++ /dev/null @@ -1,66 +0,0 @@ -# Skill: Barstats (R) - -## Category -Hiplot - -## When to Use -Create a Barstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- cowplot -- data.table -- ggplot2 -- ggstatsplot -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(data.table) -library(ggplot2) -library(ggstatsplot) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ggbarstats/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -axis <- c("relig", "partyid", "race") -data[, axis[1]] <- factor(data[, axis[1]], levels = rev(unique(data[, axis[1]]))) -data[, axis[2]] <- factor(data[, axis[2]], levels = unique(data[, axis[2]])) -data[, axis[3]] <- factor(data[, axis[3]], levels = unique(data[, axis[3]])) - -# View data -head(data) - -# Create visualization -# Barstats -g <- unique(data[,axis[3]]) -plist <- list() -for (i in 1:length(g)) { - fil <- data[,axis[3]] == g[i] - plist[[i]] <- ggbarstats( - data = data[fil,], x = relig, y = partyid, - plotgrid.args = list(ncol = 1), paired = F, k = 2) + - scale_fill_manual(values = c("#00468BFF","#ED0000FF","#42B540FF")) -} -p <- plot_grid(plotlist = plist, ncol = 1) - -p -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/063-ggbarstats.html diff --git a/skills/Hiplot/064-ggbetweenstats_skill.md b/skills/Hiplot/064-ggbetweenstats_skill.md deleted file mode 100644 index ddf3fb90f6..0000000000 --- a/skills/Hiplot/064-ggbetweenstats_skill.md +++ /dev/null @@ -1,73 +0,0 @@ -# Skill: Betweenstats (R) - -## Category -Hiplot - -## When to Use -Create a Betweenstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- cowplot -- data.table -- ggplot2 -- ggstatsplot -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(data.table) -library(ggplot2) -library(ggstatsplot) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ggbetweenstats/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -axis <- c("mpaa", "length", "genre") -data[, axis[1]] <- factor(data[, axis[1]], levels = unique(data[, axis[1]])) -data[, axis[3]] <- factor(data[, axis[3]], levels = unique(data[, axis[3]])) - -# View data -head(data) - -# Create visualization -# Betweenstats -g <- unique(data[,axis[3]]) -plist <- list() -for (i in 1:length(g)) { - fil <- data[,axis[3]] == g[i] - plist[[i]] <- ggbetweenstats( - data = data[fil,], x = mpaa, y = length, - title= paste('', axis[3], g[i], sep = ':'), - p.adjust.method = "holm", - plot.type = "boxviolin", - pairwise.comparisons = T, - pairwise.display = "significant", - effsize.type = "unbiased", - notch = T, - type = "parametric", - plotgrid.args = list(ncol = 2)) + - scale_color_manual(values = c("#00468BFF","#ED0000FF","#42B540FF")) -} -p <- plot_grid(plotlist = plist, ncol = 2) - -p -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/064-ggbetweenstats.html diff --git a/skills/Hiplot/065-ggdag_skill.md b/skills/Hiplot/065-ggdag_skill.md deleted file mode 100644 index c3c632613e..0000000000 --- a/skills/Hiplot/065-ggdag_skill.md +++ /dev/null @@ -1,50 +0,0 @@ -# Skill: Directed Acyclic Graphs (R) - -## Category -Hiplot - -## When to Use -Visualizing directed acyclic graphs. - -## Required R Packages -- ggdag - -## Minimal Reproducible Code -```r -# Load packages -library(ggdag) - -# Prepare data -# Load data -tidy_ggdag <- dagify( - y ~ x + z2 + w2 + w1, - x ~ z1 + w1 + w2, - z1 ~ w1 + v, - z2 ~ w2 + v, - w1 ~ ~w2, # bidirected path - exposure = "x", - outcome = "y") %>% - tidy_dagitty() - -# View data -head(tidy_ggdag) - -# Create visualization -# Directed Acyclic Graphs -p <- ggdag(tidy_ggdag) + - theme_dag() - -p -``` - -## Key Parameters -- `theme`: Plot theme; tutorial uses `theme_dag()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/065-ggdag.html diff --git a/skills/Hiplot/066-ggdist_skill.md b/skills/Hiplot/066-ggdist_skill.md deleted file mode 100644 index 15717d79b4..0000000000 --- a/skills/Hiplot/066-ggdist_skill.md +++ /dev/null @@ -1,78 +0,0 @@ -# Skill: Dist Plot (R) - -## Category -Hiplot - -## When to Use -The dist plot is a visual diagram using a confidence distribution. - -## Required R Packages -- broom -- data.table -- ggdist -- ggplot2 -- jsonlite -- modelr -- tidyr - -## Minimal Reproducible Code -```r -# Load packages -library(broom) -library(data.table) -library(ggdist) -library(ggplot2) -library(jsonlite) -library(modelr) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ggdist/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[, 1] <- factor(data[, 1], levels = rev(unique(data[, 1]))) -data <- tibble(data) -data2 = lm(response ~ condition, data = data) -data3 <- data_grid(data, condition) %>% - augment(data2, newdata = ., se_fit = TRUE) - -# View data -head(data) - -# Create visualization -# Dist Plot -p <- ggplot(data3, aes_(y = as.name(colnames(data[1])))) + - stat_dist_halfeye(aes(dist = "student_t", arg1 = df.residual(data2), - arg2 = .fitted, arg3 = .se.fit), - scale = .5) + - geom_point(aes_(x = as.name(colnames(data[2]))), - data = data, pch = "|", size = 2, - position = position_nudge(y = -.15)) + - ggtitle("ggdist Plot") + - xlab("response") + ylab("condition") + - theme_ggdist() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_ggdist()` - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/066-ggdist.html diff --git a/skills/Hiplot/067-gghistostats_skill.md b/skills/Hiplot/067-gghistostats_skill.md deleted file mode 100644 index 526e6accc8..0000000000 --- a/skills/Hiplot/067-gghistostats_skill.md +++ /dev/null @@ -1,63 +0,0 @@ -# Skill: Histostats (R) - -## Category -Hiplot - -## When to Use -Display data distribution and inference. - -## Required R Packages -- data.table -- ggstatsplot -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggstatsplot) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/gghistostats/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -axis <- c("budget", "genre") -data[, axis[2]] <- factor(data[, axis[2]], levels = unique(data[, axis[2]])) - -# View data -head(data) - -# Create visualization -# Histostats -p <- grouped_gghistostats( - data = data, x = budget, grouping.var = genre, - effsize.type = "unbiased", - type = "parametric", - centrality.k = 2, - plotgrid.args = list(ncol = 2), - centrality.parameter = "solid", - centrality.line.args = list(size = 1, color = "black"), - bar.fill = "#0D47A1", - centrality.label.args = list(color = "#0D47A1", size = 3), - test.value = as.numeric(0), - normal.curve = F, - normal.curve.args = list(size = 1) -) - -p -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/067-gghistostats.html diff --git a/skills/Hiplot/068-ggpie_skill.md b/skills/Hiplot/068-ggpie_skill.md deleted file mode 100644 index 001050cdbc..0000000000 --- a/skills/Hiplot/068-ggpie_skill.md +++ /dev/null @@ -1,66 +0,0 @@ -# Skill: GGPIE (R) - -## Category -Hiplot - -## When to Use -The pie chart is a statistical chart that shows the proportion of each part by dividing a circle into sections. - -## Required R Packages -- cowplot -- data.table -- dplyr -- ggpie -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(data.table) -library(dplyr) -library(ggpie) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ggpie/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -axis <- c("am", "cyl") -data[, axis[1]] <- factor(data[, axis[1]], levels = unique(data[, axis[1]])) -data[, axis[2]] <- factor(data[, axis[2]], levels = unique(data[, axis[2]])) - -# View data -head(data) - -# Create visualization -# GGPIE -plist <- list() -for (j in unique(data[, axis[2]])) { - plist[[j]] <- ggpie( - data = data[data[, axis[2]] == j,], - group_key = axis[1], count_type = "full", - label_type = "horizon", label_size = 8, - label_info = "all", label_pos = "out") + - scale_fill_manual(values = c("#00468BFF","#ED0000FF")) + - ggtitle(j) - } - -plot_grid(plotlist = plist, ncol = 3) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/068-ggpie.html diff --git a/skills/Hiplot/069-ggpiestats-group_skill.md b/skills/Hiplot/069-ggpiestats-group_skill.md deleted file mode 100644 index 7c63d99b8e..0000000000 --- a/skills/Hiplot/069-ggpiestats-group_skill.md +++ /dev/null @@ -1,71 +0,0 @@ -# Skill: Piestats Group (R) - -## Category -Hiplot - -## When to Use -Create a Piestats Group using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- cowplot -- data.table -- ggplot2 -- ggstatsplot -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(data.table) -library(ggplot2) -library(ggstatsplot) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ggpiestats-group/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -axis <- c("genre", "mpaa") -data[, axis[1]] <- factor(data[, axis[1]], levels = unique(data[, axis[1]])) -data[, axis[2]] <- factor(data[, axis[2]], levels = unique(data[, axis[2]])) - -# View data -head(data) - -# Create visualization -# Piestats Group -g <- unique(data[,axis[2]]) -plist <- list() -for (i in 1:length(g)) { - fil <- data[,axis[2]] == g[i] - plist[[i]] <- - ggpiestats( - data = data[fil,], x = genre, - title= paste('', axis[2], g[i], sep = ':'), - plotgrid.args = list(ncol = 3), - label.repel = TRUE, - k = 2 - ) + - scale_fill_manual(values = c("#3B4992FF","#EE0000FF","#008B45FF","#631879FF", - "#008280FF","#BB0021FF","#5F559BFF","#A20056FF", - "#808180FF")) -} - -plot_grid(plotlist = plist, ncol = 3) -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/069-ggpiestats-group.html diff --git a/skills/Hiplot/071-ggpiestats_skill.md b/skills/Hiplot/071-ggpiestats_skill.md deleted file mode 100644 index 7c2604f76c..0000000000 --- a/skills/Hiplot/071-ggpiestats_skill.md +++ /dev/null @@ -1,56 +0,0 @@ -# Skill: Piestats (R) - -## Category -Hiplot - -## When to Use -Create a Piestats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- ggplot2 -- ggstatsplot -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggstatsplot) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ggpiestats/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -axis <- c("am", "cyl") -data[, axis[1]] <- factor(data[, axis[1]], levels = unique(data[, axis[1]])) -data[, axis[2]] <- factor(data[, axis[2]], levels = unique(data[, axis[2]])) - -# View data -head(data) - -# Create visualization -# Piestats -p <- ggpiestats(data = data, x = am, y = cyl, - paired = F) + - scale_fill_manual(values = c("#3B4992FF","#EE0000FF")) - -p -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/071-ggpiestats.html diff --git a/skills/Hiplot/072-ggpubr-boxplot_skill.md b/skills/Hiplot/072-ggpubr-boxplot_skill.md deleted file mode 100644 index ad296eee33..0000000000 --- a/skills/Hiplot/072-ggpubr-boxplot_skill.md +++ /dev/null @@ -1,70 +0,0 @@ -# Skill: GGPubr Boxplot (R) - -## Category -Hiplot - -## When to Use -Feature-rich boxplot (GGPubr interface). - -## Required R Packages -- data.table -- ggpubr -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggpubr) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ggpubr-boxplot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# GGPubr Boxplot -p <- ggboxplot( - data = data, x = "supp", y = "len", facet.by = "dose", - merge = T, - color = "supp", - fill = "white") + - stat_compare_means( - label = "p.signif", - label.x.npc = "center", - method = "wilcox") + - scale_y_continuous(expand = expansion(mult = c(0.2, 0.2))) + - scale_fill_manual(values = c("#e04d39","#5bbad6")) + - ggtitle("Complex Boxplot") + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/072-ggpubr-boxplot.html diff --git a/skills/Hiplot/073-ggscatterstats_skill.md b/skills/Hiplot/073-ggscatterstats_skill.md deleted file mode 100644 index 84ca99ba9c..0000000000 --- a/skills/Hiplot/073-ggscatterstats_skill.md +++ /dev/null @@ -1,48 +0,0 @@ -# Skill: Scatterstats (R) - -## Category -Hiplot - -## When to Use -Create a Scatterstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- ggstatsplot -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggstatsplot) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ggscatterstats/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Scatterstats -p <- ggscatterstats( - data = data, x = rating, y = budget -) - -p -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/073-ggscatterstats.html diff --git a/skills/Hiplot/074-ggseqlogo_skill.md b/skills/Hiplot/074-ggseqlogo_skill.md deleted file mode 100644 index 46d028f0a8..0000000000 --- a/skills/Hiplot/074-ggseqlogo_skill.md +++ /dev/null @@ -1,58 +0,0 @@ -# Skill: Seqlogo (R) - -## Category -Hiplot - -## When to Use -The sequence LOGO is a graphic that describes a sequence pattern of binding sites. - -## Required R Packages -- data.table -- ggplot2 -- ggseqlogo -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggseqlogo) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ggseqlogo/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data <- data[, !sapply(data, function(x) {all(is.na(x))})] -data <- as.list(data) -data <- lapply(data, function(x) {return(x[!is.na(x)])}) - -# View data -str(data[1:5]) - -# Create visualization -# Seqlogo -p <- ggseqlogo( - data, - ncol = 4, - col_scheme = "nucleotide", - seq_type = "dna", - method = "bits") + - theme(plot.title = element_text(hjust = 0.5)) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/074-ggseqlogo.html diff --git a/skills/Hiplot/075-ggwithinstats_skill.md b/skills/Hiplot/075-ggwithinstats_skill.md deleted file mode 100644 index 2df90c3da6..0000000000 --- a/skills/Hiplot/075-ggwithinstats_skill.md +++ /dev/null @@ -1,74 +0,0 @@ -# Skill: Complex-Violin (R) - -## Category -Hiplot - -## When to Use -Create a Complex-Violin using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- cowplot -- data.table -- ggplot2 -- ggstatsplot -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(data.table) -library(ggplot2) -library(ggstatsplot) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ggwithinstats/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -axis <- c("condition", "desire", "region") -data[, axis[1]] <- factor(data[, axis[1]], levels = unique(data[, axis[1]])) -data[, axis[3]] <- factor(data[, axis[3]], levels = unique(data[, axis[3]])) - -# View data -str(data) - -# Create visualization -# Complex-Violin -g <- unique(data[,axis[3]]) -plist <- list() -for (i in 1:length(g)) { - fil <- data[,axis[3]] == g[i] - plist[[i]] <- ggwithinstats( - data = data[fil,], x = condition, y = desire, - title= paste('', axis[3], g[i], sep = ':'), - p.adjust.method = "holm", - plot.type = "boxviolin", - pairwise.comparisons = T, - pairwise.display = "significant", - effsize.type = "unbiased", - notch = T, - type = "parametric", - k = 2, - plotgrid.args = list(ncol = 2) - ) + - scale_color_manual(values = c("#3B4992FF","#EE0000FF")) -} - -plot_grid(plotlist = plist, ncol = 2) -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/075-ggwithinstats.html diff --git a/skills/Hiplot/076-ggwordcloud_skill.md b/skills/Hiplot/076-ggwordcloud_skill.md deleted file mode 100644 index 0078d6287f..0000000000 --- a/skills/Hiplot/076-ggwordcloud_skill.md +++ /dev/null @@ -1,62 +0,0 @@ -# Skill: ggwordcloud (R) - -## Category -Hiplot - -## When to Use -The word cloud is to visualize the "keywords" that appear frequently in the web text by forming a "keyword cloud layer" or "keyword rendering". - -## Required R Packages -- curl -- data.table -- ggwordcloud -- jsonlite -- png - -## Minimal Reproducible Code -```r -# Load packages -library(curl) -library(data.table) -library(ggwordcloud) -library(jsonlite) -library(png) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ggwordcloud/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -inmask <- "https://download.hiplot.cn/api/file/fetch/?path=public/demo/ggwordcloud/hearth.png" - -# Convert data structure -col <- data[, 2] -data <- cbind(data, col) - -# View data -head(data) - -# Create visualization -# ggwordcloud -p <- ggplot(data, aes(label = word, size = freq, color = col)) + - scale_size_area(max_size = 40) + - theme_minimal() + - geom_text_wordcloud_area( - mask = png::readPNG(curl::curl_fetch_memory(inmask)$content), - rm_outside = TRUE) + - scale_color_gradient(low = "#8B0000", high = "#FF0000") - -p -``` - -## Key Parameters -- `size`: Maps `freq` to the size aesthetic -- `color`: Maps `col` to the color aesthetic -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/076-ggwordcloud.html diff --git a/skills/Hiplot/077-gobar_skill.md b/skills/Hiplot/077-gobar_skill.md deleted file mode 100644 index bc5b941055..0000000000 --- a/skills/Hiplot/077-gobar_skill.md +++ /dev/null @@ -1,56 +0,0 @@ -# Skill: GOBar Plot (R) - -## Category -Hiplot - -## When to Use -The gobar plot is used to display Z-score coloured barplot of terms ordered alternatively by z-score or the negative logarithm of the adjusted p-value. - -## Required R Packages -- GOplot -- data.table -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(GOplot) -library(data.table) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/gobar/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -colnames(data) <- c("category","ID","term","count","genes","logFC","adj_pval","zscore") -data <- data[data$category %in% c("BP","CC","MF"),] -data <- data[!is.na(data$adj_pval),] -data$adj_pval <- as.numeric(data$adj_pval) -data$zscore <- as.numeric(data$zscore) - -# View data -head(data) - -# Create visualization -# GOBar Plot -p <- GOBar(data, display = "multiple", order.by.zscore = T, - title = "GO Enrichment Barplot ", - zsc.col = c("#EF8A62","#F7F7F7","#67A9CF")) + - theme(plot.title = element_text(hjust = 0.5), - axis.text.x = element_text(size = 8)) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/077-gobar.html diff --git a/skills/Hiplot/078-gobubble_skill.md b/skills/Hiplot/078-gobubble_skill.md deleted file mode 100644 index 65533f5956..0000000000 --- a/skills/Hiplot/078-gobubble_skill.md +++ /dev/null @@ -1,60 +0,0 @@ -# Skill: GOBubble Plot (R) - -## Category -Hiplot - -## When to Use -The gobubble plot is used to display Z-score coloured bubble plot of terms ordered alternatively by z-score or the negative logarithm of the adjusted p-value. - -## Required R Packages -- GOplot -- data.table -- ggplotify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(GOplot) -library(data.table) -library(ggplotify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/gobubble/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -colnames(data) <- c("category","ID","term","count","genes","logFC","adj_pval","zscore") -data <- data[data$category %in% c("BP","CC","MF"),] -data <- data[!is.na(data$adj_pval),] -data$adj_pval <- as.numeric(data$adj_pval) -data$zscore <- as.numeric(data$zscore) - -# View data -head(data) - -# Create visualization -# GOBubble Plot -p <- function () { - GOBubble(data, display = "single", title = "GO Enrichment Bubbleplot", - colour = c("#FC8D59","#FFFFBF","#99D594"), - labels = 0, ID = T, table.legend = T, table.col = T, bg.col = F) + - theme(plot.title = element_text(hjust = 0.5)) -} -p <- as.ggplot(p) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/078-gobubble.html diff --git a/skills/Hiplot/079-gocircle_skill.md b/skills/Hiplot/079-gocircle_skill.md deleted file mode 100644 index a911161ccd..0000000000 --- a/skills/Hiplot/079-gocircle_skill.md +++ /dev/null @@ -1,60 +0,0 @@ -# Skill: GOCircle Plot (R) - -## Category -Hiplot - -## When to Use -The gocircle plot is used to display the circular plot combines gene expression and gene- annotation enrichment data. A subset of terms is displayed like the GOBar plot in combination with a scatter plot of the gene expression data. The whole plot is drawn on a specific coordinate system to achieve the circular layout. The segments are labeled with the term ID. - -## Required R Packages -- GOplot -- data.table -- ggplotify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(GOplot) -library(data.table) -library(ggplotify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/gocircle/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -colnames(data) <- c("category","ID","term","count","genes","logFC","adj_pval","zscore") -data <- data[!is.na(data$adj_pval),] -data$adj_pval <- as.numeric(data$adj_pval) -data$zscore <- as.numeric(data$zscore) -data$count <- as.numeric(data$count) - -# View data -head(data) - -# Create visualization -# GOCircle Plot -p <- function () { - GOCircle(data, title = "GO Enrichment Circleplot", - nsub = 10, rad1 = 2, rad2 = 3, table.legend = T, label.size = 5, - zsc.col = c("#FC8D59","#FFFFBF","#99D594")) + - theme(plot.title = element_text(hjust = 0.5)) -} -p <- as.ggplot(p) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/079-gocircle.html diff --git a/skills/Hiplot/080-grdotplot_skill.md b/skills/Hiplot/080-grdotplot_skill.md deleted file mode 100644 index dec842c532..0000000000 --- a/skills/Hiplot/080-grdotplot_skill.md +++ /dev/null @@ -1,48 +0,0 @@ -# Skill: Group Rank Dotplot (R) - -## Category -Hiplot - -## When to Use -Values distribution for different groups. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite -- sigminer - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) -library(sigminer) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/grdotplot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Group Rank Dotplot -p <- show_group_distribution(data, gvar = "gvar", dvar = "dvar", - order_by_fun = F) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/080-grdotplot.html diff --git a/skills/Hiplot/081-group-bubble_skill.md b/skills/Hiplot/081-group-bubble_skill.md deleted file mode 100644 index a1fc8f38e0..0000000000 --- a/skills/Hiplot/081-group-bubble_skill.md +++ /dev/null @@ -1,55 +0,0 @@ -# Skill: Group Bubble (R) - -## Category -Hiplot - -## When to Use -Create a Group Bubble using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/group-bubble/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Group Bubble -p <- ggplot(data = data, aes(x = Sepal.Length, y = Sepal.Width, - size = Petal.Width, color = Species)) + - geom_point(alpha = 0.7) + - scale_size(range = c(1, 4)) + - scale_color_manual(values = c("#e04d39","#5bbad6","#1e9f86")) + - theme_bw() - -p -``` - -## Key Parameters -- `x`: Maps `Sepal` to the x aesthetic -- `y`: Maps `Sepal` to the y aesthetic -- `size`: Maps `Petal` to the size aesthetic -- `color`: Maps `Species` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/081-group-bubble.html diff --git a/skills/Hiplot/082-group-comparison_skill.md b/skills/Hiplot/082-group-comparison_skill.md deleted file mode 100644 index d85f4c1af4..0000000000 --- a/skills/Hiplot/082-group-comparison_skill.md +++ /dev/null @@ -1,78 +0,0 @@ -# Skill: Group-comparison Heatmap (R) - -## Category -Hiplot - -## When to Use -Group-comparison Heatmap provides a way to compare multiple variables across multiple (>2) groups and visualize the result with heatmap. - -## Required R Packages -- data.table -- jsonlite -- sigminer - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(jsonlite) -library(sigminer) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/group-comparison/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Define plot functions -unlist_and_covert <- function(x, recursive = FALSE) { - if (!is.null(x)) { - x <- unlist(x, recursive = recursive) - if (!is.null(x)) { - y <- sapply(x, function(x) { - if (identical(x, "NA")) NA else x - }) - names(y) <- names(x) - x <- y - } - } - x -} - -plotentry <- function(data, - grp_vars = NULL, enrich_vars = NULL, cross = TRUE, - co_method = c("t.test", "wilcox.test"), ref_group = NA, - scales = "free", add_text_annotation = TRUE, - fill_by_p_value = TRUE, use_fdr = TRUE, cut_p_value = FALSE, - cluster_row = FALSE) { - ref_group <- unlist_and_covert(ref_group) - if (is.null(ref_group)) ref_group <- NA - rv <- group_enrichment(data, grp_vars, enrich_vars, cross, co_method, ref_group) - if (length(unique(rv$grp_var)) == 1) { - p <- show_group_enrichment(rv, - return_list = TRUE, - scales = scales, add_text_annotation = add_text_annotation, - fill_by_p_value = fill_by_p_value, use_fdr = use_fdr, cut_p_value = cut_p_value, - cluster_row = cluster_row - ) - p <- p[[1]] - } else { - p <- show_group_enrichment(rv, - scales = scales, add_text_annotation = add_text_annotation, - fill_by_p_value = fill_by_p_value, use_fdr = use_fdr, cut_p_value = cut_p_value, -# ... (see full tutorial for more) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/082-group-comparison.html diff --git a/skills/Hiplot/083-group-dumbbell_skill.md b/skills/Hiplot/083-group-dumbbell_skill.md deleted file mode 100644 index 6edb42102e..0000000000 --- a/skills/Hiplot/083-group-dumbbell_skill.md +++ /dev/null @@ -1,56 +0,0 @@ -# Skill: Group Dumbbell (R) - -## Category -Hiplot - -## When to Use -Create a Group Dumbbell using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- ggalt -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggalt) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/group-dumbbell/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data <- data[order(data[["group"]], data[["y1952"]]),] -data[["country"]] <- factor(data[["country"]], levels = data[["country"]]) - -# View data -head(data) - -# Create visualization -# Group Dumbbell -p <- ggplot(data = data, aes(x = y1952, xend = y2007, y = country, color = group)) + - geom_dumbbell(size = 1, size_xend = 2, size_x = 2) + - theme_bw() - -p -``` - -## Key Parameters -- `x`: Maps `y1952` to the x aesthetic -- `y`: Maps `country` to the y aesthetic -- `color`: Maps `group` to the color aesthetic -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/083-group-dumbbell.html diff --git a/skills/Hiplot/084-group-line_skill.md b/skills/Hiplot/084-group-line_skill.md deleted file mode 100644 index ca1ccffb8e..0000000000 --- a/skills/Hiplot/084-group-line_skill.md +++ /dev/null @@ -1,53 +0,0 @@ -# Skill: Group Line (R) - -## Category -Hiplot - -## When to Use -Create a Group Line using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/group-line/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Group Line -p <- ggplot(data, aes(x = x, y = y, group = names, color = groups)) + - geom_line() + - geom_point() + - scale_color_manual(values = c("#e04d39","#5bbad6")) + - theme_bw() - -p -``` - -## Key Parameters -- `x`: Maps `x` to the x aesthetic -- `y`: Maps `y` to the y aesthetic -- `group`: Maps `names` to the group aesthetic -- `color`: Maps `groups` to the color aesthetic -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/084-group-line.html diff --git a/skills/Hiplot/085-half-violin_skill.md b/skills/Hiplot/085-half-violin_skill.md deleted file mode 100644 index 1605cfb528..0000000000 --- a/skills/Hiplot/085-half-violin_skill.md +++ /dev/null @@ -1,87 +0,0 @@ -# Skill: Half Violin (R) - -## Category -Hiplot - -## When to Use -The half violin plot is a statistical graph used to display the distribution and probability density of data by replacing the left part with the data frequency count graph on the basis of keeping the right part of violin graph. - -## Required R Packages -- data.table -- dplyr -- ggplot2 -- ggpubr -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(ggplot2) -library(ggpubr) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/half-violin/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -colnames(data) <- c("Value", "Group") -data[, 2] <- factor(data[, 2], levels = unique(data[, 2])) - -# View data -head(data) - -# Create visualization -# Half Violin -geom_flat_violin <- function( - mapping = NULL, data = NULL, stat = "ydensity", position = "dodge", - trim = TRUE, scale = "area", show.legend = NA, inherit.aes = TRUE, ...) { - ggplot2::layer(data = data, mapping = mapping, stat = stat, - geom = geom_flat_violin_proto, position = position, - show.legend = show.legend, inherit.aes = inherit.aes, - params = list(trim = trim, scale = scale, ...)) -} - -"%||%" <- function(a, b) { - if (!is.null(a)) { - a - } else { - b - } -} - -geom_flat_violin_proto <- - ggproto("geom_flat_violin_proto", Geom, - setup_data = function(data, params) { - data$width <- data$width %||% - params$width %||% (resolution(data$x, FALSE) * 0.9) - - data %>% - dplyr::group_by(.data = ., group) %>% - dplyr::mutate(.data = ., ymin = min(y), ymax = max(y), xmin = x, - xmax = x + width / 2) - }, -# ... (see full tutorial for more) -``` - -## Key Parameters -- `size`: Maps `0` to the size aesthetic -- `alpha`: Maps `NA` to the alpha aesthetic -- `fill`: Maps `Group` to the fill aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/085-half-violin.html diff --git a/skills/Hiplot/086-heatmap_skill.md b/skills/Hiplot/086-heatmap_skill.md deleted file mode 100644 index 13c5c96bdd..0000000000 --- a/skills/Hiplot/086-heatmap_skill.md +++ /dev/null @@ -1,79 +0,0 @@ -# Skill: Heatmap (R) - -## Category -Hiplot - -## When to Use -Heat map is an intuitive and visual method for analyzing the distribution of experimental data, which can be used for quality control of experimental data and visualization display of difference data, as well as clustering of data and samples to observe sample quality. - -## Required R Packages -- ComplexHeatmap -- data.table -- genefilter -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(ComplexHeatmap) -library(data.table) -library(genefilter) -library(jsonlite) - -# Prepare data -# Load data -data_count <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/heatmap/data.json")$exampleData[[1]]$textarea[[1]]) -data_count <- as.data.frame(data_count) -data_sample <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/heatmap/data.json")$exampleData[[1]]$textarea[[2]]) -data_sample <- as.data.frame(data_sample) -data_gene <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/heatmap/data.json")$exampleData[[1]]$textarea[[3]]) -data_gene <- as.data.frame(data_gene) - -# Convert data structure -data_count <- data_count[!is.na(data_count[, 1]), ] -idx <- duplicated(data_count[, 1]) -data_count[idx, 1] <- paste0(data_count[idx, 1], "--dup-", cumsum(idx)[idx]) -for (i in 2:ncol(data_count)) { - data_count[, i] <- as.numeric(data_count[, i]) -} -data <- as.matrix(data_count[, -1]) -rownames(data) <- data_count[, 1] - -## Add annotation information to samples -sample.info <- data_sample[-1] -row.names(sample.info) <- data_sample[, 1] -sample_info_reorder <- as.data.frame(sample.info[match( - colnames(data), rownames(sample.info) - ), ]) -colnames(sample_info_reorder) <- colnames(sample.info) -rownames(sample_info_reorder) <- colnames(data) - -## Add annotation information to genes -gene_info <- data_gene[-1] -rownames(gene_info) <- data_gene[, 1] -gene_info_reorder <- as.data.frame(gene_info[match( - rownames(data), rownames(gene_info) - ), ]) -colnames(gene_info_reorder) <- colnames(gene_info) -rownames(gene_info_reorder) <- rownames(data) - -# View data -head(data) - -# Create visualization -# Heatmap -## Set annotation_col and annotation_row to add annotations to samples and genes respectively -top_var <- 100 -# ... (see full tutorial for more) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/086-heatmap.html diff --git a/skills/Hiplot/087-hic-heatmap_skill.md b/skills/Hiplot/087-hic-heatmap_skill.md deleted file mode 100644 index e6cc6de2c5..0000000000 --- a/skills/Hiplot/087-hic-heatmap_skill.md +++ /dev/null @@ -1,81 +0,0 @@ -# Skill: Hi-C Heatmap (R) - -## Category -Hiplot - -## When to Use -The HiC heatmap is used to display the genome-wide chromatin interaction with heatmap on different chromosomes. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/hic-heatmap/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Hi-C Heatmap -## Calculate the number of bins -bins_num <- max(data$index_bin1) + 1 -## Set the resolution of HiC data -resolution <- 500 -res <- resolution * 1000 -# Set the separation unit to 50Mb -intervals <- 50 -spacing <- intervals * 1000000 -## Count the number of breaks -breaks_num <- (res * bins_num) / spacing -## Set breaks -breaks <- c() -for (i in 0:breaks_num) { - breaks <- c(breaks, i * intervals) -} - -p <- ggplot(data = data, aes(x = index_bin1 * res, y = index_bin2 * res)) + - geom_tile(aes(fill = freq)) + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - limits = c(0, max(data$freq) * 1.2) - ) + - scale_y_reverse() + - scale_x_continuous(breaks = breaks * 1000000, labels = paste0(breaks, "Mb")) + - scale_y_continuous(breaks = breaks * 1000000, labels = paste0(breaks, "Mb")) + - theme(panel.grid = element_blank(), axis.title = element_blank()) + - labs(title = paste0("(resolution: ", res / 1000, "Kb)"), x="", y="") + - theme_bw() + - theme(plot.title = element_text(hjust = 0.5), - legend.position = "right", legend.key.size = unit(0.8, "cm"), - panel.grid = element_blank()) - -p -``` - -## Key Parameters -- `x`: Maps `index_bin1` to the x aesthetic -- `y`: Maps `index_bin2` to the y aesthetic -- `fill`: Maps `freq` to the fill aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/087-hic-heatmap.html diff --git a/skills/Hiplot/088-histogram_skill.md b/skills/Hiplot/088-histogram_skill.md deleted file mode 100644 index 1bb7079df9..0000000000 --- a/skills/Hiplot/088-histogram_skill.md +++ /dev/null @@ -1,68 +0,0 @@ -# Skill: Histogram (R) - -## Category -Hiplot - -## When to Use -Histogram refers to the distribution of continuous variable data by a series of vertical stripes or line segments with different heights. - -## Required R Packages -- data.table -- ggplot2 -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/histogram/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[, 2] <- factor(data[, 2], levels = unique(data[, 2])) - -# View data -head(data) - -# Create visualization -# Histogram -p <- ggplot(data, aes(x=Value, fill=Group2)) + - geom_histogram(alpha = 1, bins = 12, col = "white") + - ggtitle("Histogram Plot") + - scale_fill_manual(values = c("#e04d39","#5bbad6","#1e9f86")) + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `Value` to the x aesthetic -- `fill`: Maps `Group2` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/088-histogram.html diff --git a/skills/Hiplot/089-interval-area-chart_skill.md b/skills/Hiplot/089-interval-area-chart_skill.md deleted file mode 100644 index 0e9e4d68d9..0000000000 --- a/skills/Hiplot/089-interval-area-chart_skill.md +++ /dev/null @@ -1,70 +0,0 @@ -# Skill: Interval Area Chart (R) - -## Category -Hiplot - -## When to Use -Create a Interval Area Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/interval-area-chart/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[["month"]] <- factor(data[["month"]], levels = data[["month"]]) - -# View data -head(data) - -# Create visualization -# Interval Area Chart -p <- ggplot(data, aes(x = month, group = 1)) + - geom_line(aes(y = max_temperature), size = 1.2, color = "#EA3323", - linetype = "solid") + - geom_line(aes(y = min_temperature), size = 1.2, color = "#0000F5", - linetype = "solid") + - geom_line(aes(x = month, y = mean), size = 1.2, color = "#BEBEBE", - linetype = "dashed") + - geom_ribbon(aes(ymin = min_temperature, ymax = max_temperature), - fill = "#F2F2F2", alpha = 0.5) + - geom_text(aes(x = month, y = max_temperature + 1, label = max_temperature), - color = "#EA3323", size = 2.5, vjust = -0.5, hjust = 0) + - geom_text(aes(x = month, y = min_temperature - 1, label = min_temperature), - color = "#0000F5", size = 2.5, vjust = 1.5, hjust = 0) + - geom_text(aes(x = month, y = mean, label = mean), - color = "#BEBEBE", size = 2.5, vjust = 1.5, hjust = 0) + - labs(title = "Temperature", x = "Month", y = "Temperature") + - scale_color_manual(values = c(max = "#EA3323", min = "#0000F5")) + - theme_bw() + - theme(plot.title = element_text(hjust = 0.5)) - -p -``` - -## Key Parameters -- `x`: Maps `month` to the x aesthetic -- `group`: Maps `1` to the group aesthetic -- `y`: Maps `mean` to the y aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/089-interval-area-chart.html diff --git a/skills/Hiplot/090-interval-bar-chart_skill.md b/skills/Hiplot/090-interval-bar-chart_skill.md deleted file mode 100644 index 24fadb87af..0000000000 --- a/skills/Hiplot/090-interval-bar-chart_skill.md +++ /dev/null @@ -1,58 +0,0 @@ -# Skill: Interval Bar Chart (R) - -## Category -Hiplot - -## When to Use -Create a Interval Bar Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/interval-bar-chart/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data$name_num <- match(data[["month"]], unique(data[["month"]])) - -# View data -head(data) - -# Create visualization -# Interval Bar Chart -p <- ggplot(data, aes(x = month, y = max_temperature)) + - geom_rect(aes(xmin = name_num - 0.4, xmax = name_num + 0.4, - ymin = min_temperature, ymax = max_temperature), - fill = "#282726", alpha = 0.7) + - geom_line(aes(x = name_num, y = mean), color = "#006064", size = 0.8) + - labs(x = "Month", y = "Temperature") + - scale_x_discrete() + - theme_bw() - -p -``` - -## Key Parameters -- `x`: Maps `name_num` to the x aesthetic -- `y`: Maps `mean` to the y aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/090-interval-bar-chart.html diff --git a/skills/Hiplot/091-likert_skill.md b/skills/Hiplot/091-likert_skill.md deleted file mode 100644 index f3957f1d2d..0000000000 --- a/skills/Hiplot/091-likert_skill.md +++ /dev/null @@ -1,56 +0,0 @@ -# Skill: Likert Plot (R) - -## Category -Hiplot - -## When to Use -Descriptive statistical analysis of Likert scale data. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- likert - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(likert) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/likert/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -levs <- unique(unlist(data)) -for (i in 1:ncol(data)) { - data[,i] <- factor(data[, i], levels = levs) -} - -# View data -head(data) - -# Create visualization -# Likert Plot -pobj <- likert(data) -colrs <- c("#3B4992FF","#EE0000FF") -p <- as.ggplot(plot(pobj, type = "bar", - low.color = colrs[1], high.color = colrs[2], wrap = 50)) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/091-likert.html diff --git a/skills/Hiplot/092-line-color-dot_skill.md b/skills/Hiplot/092-line-color-dot_skill.md deleted file mode 100644 index 3534ee8117..0000000000 --- a/skills/Hiplot/092-line-color-dot_skill.md +++ /dev/null @@ -1,73 +0,0 @@ -# Skill: Line (Color Dot) (R) - -## Category -Hiplot - -## When to Use -Create a Line (Color Dot) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- grafify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(grafify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/line-color-dot/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -x <- "Time" -y <- "PI" -group <- "Experiment" -facet <- "Genotype" -data[, x] <- factor(data[, x], levels = unique(data[, x])) -data[, group] <- factor(data[, group], levels = unique(data[, group])) -data[, facet] <- factor(data[, facet], levels = unique(data[, facet])) - -# View data -head(data) - -# Create visualization -# Line (Color Dot) -p <- plot_befafter_colours( - data = data, xcol = get(x), ycol = get(y), match = get(group), - symsize = 5, symthick = 1, s_alpha = 1) + - facet_wrap(facet) + - guides(fill = guide_legend(title = group)) + - scale_fill_grafify() + - xlab(x) + ylab(y) + - ggtitle("Two-way repeated measures") + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12, hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/092-line-color-dot.html diff --git a/skills/Hiplot/093-line-errorbar_skill.md b/skills/Hiplot/093-line-errorbar_skill.md deleted file mode 100644 index d8c70e3a9e..0000000000 --- a/skills/Hiplot/093-line-errorbar_skill.md +++ /dev/null @@ -1,63 +0,0 @@ -# Skill: Line (errorbar) (R) - -## Category -Hiplot - -## When to Use -The error line mainly indicates the error range of each data point and shows the potential error or uncertainty relative to each data in the series. - -## Required R Packages -- data.table -- ggpubr -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggpubr) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/line-errorbar/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[, 3] <- factor(data[, 3], levels = unique(data[, 3])) - -# View data -head(data) - -# Create visualization -# Line (errorbar) -p <- ggline( - data, x = "Group1", y = "Value", color = "Group2", - add = "mean_se", title = "Line plot with errorbar", palette = "npg") + - stat_compare_means(aes_(group = as.name("Group2"))) + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12, hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/093-line-errorbar.html diff --git a/skills/Hiplot/094-line-regression_skill.md b/skills/Hiplot/094-line-regression_skill.md deleted file mode 100644 index ca6e1c6e50..0000000000 --- a/skills/Hiplot/094-line-regression_skill.md +++ /dev/null @@ -1,83 +0,0 @@ -# Skill: Line Regression (R) - -## Category -Hiplot - -## When to Use -Linear regression is a regression method for linear modeling of the relationship between independent variables and dependent variables.If there is only one independent variable, it is called simple regression, and if there is more than one independent variable, it is called multiple regression. - -## Required R Packages -- data.table -- ggplot2 -- ggrepel -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggrepel) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/line-regression/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data$group <- factor(data$group, levels = unique(data$group)) - -# View data -head(data) - -# Create visualization -# Line Regression -## Defining the equation -equation <- function(x, add_p = FALSE) { - xs <- summary(x) - lm_coef <- list( - a = as.numeric(round(coef(x)[1], digits = 2)), - b = as.numeric(round(coef(x)[2], digits = 2)), - r2 = round(xs$r.squared, digits = 2), - pval = xs$coef[2, 4] - ) - if (add_p) { - lm_eq <- substitute(italic(y) == a + b %.% italic(x) * "," ~ ~ - italic(R)^2 ~ "=" ~ r2 * "," ~ ~ italic(p) ~ "=" ~ pval, lm_coef) - } else { - lm_eq <- substitute(italic(y) == a + b %.% italic(x) * "," ~ ~ - italic(R)^2 ~ "=" ~ r2, lm_coef) - } - as.expression(lm_eq) -} -## Plot -p <- ggplot(data, aes(x = value1, y = value2, colour = group)) + - geom_point(show.legend = TRUE) + - geom_smooth(method = "lm", se = T, show.legend = F) + - geom_rug(sides = "bl", size = 1, show.legend = F) + - scale_color_manual(values = c("#00468BFF","#ED0000FF")) + - ggtitle("Line Reguression Plot") + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12, hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `value1` to the x aesthetic -- `y`: Maps `value2` to the y aesthetic -- `colour`: Maps `group` to the colour aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/094-line-regression.html diff --git a/skills/Hiplot/095-line_skill.md b/skills/Hiplot/095-line_skill.md deleted file mode 100644 index 8b7088f086..0000000000 --- a/skills/Hiplot/095-line_skill.md +++ /dev/null @@ -1,71 +0,0 @@ -# Skill: Line (R) - -## Category -Hiplot - -## When to Use -The line chart is a statistical chart that USES a linear or logarithmic scale to draw data in a two - or three-dimensional view to show the data set or track the characteristics of the data over time. - -## Required R Packages -- data.table -- ggplot2 -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/line/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[,3] <- factor(data[,3], levels = unique(data[,3])) - -# View data -head(data) - -# Create visualization -# Line -p <- ggplot(data, aes(x = Value1, y = Value2)) + - geom_line(alpha = 1, aes(color = Group, linetype = Group)) + - geom_point(aes(color = Group, shape = Group)) + - ggtitle("Line Regression Plot") + - scale_fill_manual(values = c("#e04d39","#5bbad6")) + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `Value1` to the x aesthetic -- `y`: Maps `Value2` to the y aesthetic -- `color`: Maps `Group` to the color aesthetic -- `shape`: Maps `Group` to the shape aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/095-line.html diff --git a/skills/Hiplot/096-map-africa_skill.md b/skills/Hiplot/096-map-africa_skill.md deleted file mode 100644 index 596b069f9b..0000000000 --- a/skills/Hiplot/096-map-africa_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Africa Map (R) - -## Category -Hiplot - -## When to Use -Create a Africa Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-africa/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-africa/afr.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$ADM0_NAME, data$region)] - -# View data -head(data) - -# Create visualization -# Africa Map -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(9, 985, 139), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + - labs(x = NULL, y = NULL, title = "Africa Map") -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/096-map-africa.html diff --git a/skills/Hiplot/097-map-americas_skill.md b/skills/Hiplot/097-map-americas_skill.md deleted file mode 100644 index 8074e4401d..0000000000 --- a/skills/Hiplot/097-map-americas_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Americas Map (R) - -## Category -Hiplot - -## When to Use -Create a Americas Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-americas/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-americas/amr.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$ENG_NAME, data$region)] - -# View data -head(data) - -# Create visualization -# Americas Map -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/097-map-americas.html diff --git a/skills/Hiplot/098-map-china-city_skill.md b/skills/Hiplot/098-map-china-city_skill.md deleted file mode 100644 index cedbb7a8fb..0000000000 --- a/skills/Hiplot/098-map-china-city_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: China Map (City) (R) - -## Category -Hiplot - -## When to Use -Create a China Map (City) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-china-city/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-china-city/china.city.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$city, data$name)] - -# View data -head(data) - -# Create visualization -# China Map (City) -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/098-map-china-city.html diff --git a/skills/Hiplot/099-map-china-county_skill.md b/skills/Hiplot/099-map-china-county_skill.md deleted file mode 100644 index 898a83b7a8..0000000000 --- a/skills/Hiplot/099-map-china-county_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: China Map (County) (R) - -## Category -Hiplot - -## When to Use -Create a China Map (County) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-china-county/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-china-county/china.county.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$county, data$name)] - -# View data -head(data) - -# Create visualization -# China Map (County) -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/099-map-china-county.html diff --git a/skills/Hiplot/100-map-china_skill.md b/skills/Hiplot/100-map-china_skill.md deleted file mode 100644 index a3abd2d263..0000000000 --- a/skills/Hiplot/100-map-china_skill.md +++ /dev/null @@ -1,65 +0,0 @@ -# Skill: China Map (R) - -## Category -Hiplot - -## When to Use -Create a China Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-china/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-china/china.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$FCNAME, data$name)] - -# View data -head(data) - -# Create visualization -# China Map -p <- ggplot(dt_map, aes(x = long, y = lat, group = group, fill = Value)) + - labs(fill = "Value") + - geom_polygon() + - geom_path() + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - na.value = "grey10", - limits = c(0, max(dt_map$Value) * 1.2)) + - ggtitle("China Map Plot") + - theme_minimal() - -p -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/100-map-china.html diff --git a/skills/Hiplot/101-map-china2_skill.md b/skills/Hiplot/101-map-china2_skill.md deleted file mode 100644 index ee9945ea70..0000000000 --- a/skills/Hiplot/101-map-china2_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: China Map 2 (R) - -## Category -Hiplot - -## When to Use -Create a China Map 2 using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-china2/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-china/china.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$FCNAME, data$name)] - -# View data -head(data) - -# Create visualization -# China Map 2 -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/101-map-china2.html diff --git a/skills/Hiplot/102-map-europe_skill.md b/skills/Hiplot/102-map-europe_skill.md deleted file mode 100644 index c4ef665c23..0000000000 --- a/skills/Hiplot/102-map-europe_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Europe Map (R) - -## Category -Hiplot - -## When to Use -Create a Europe Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-europe/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-europe/eu.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$ENG_NAME, data$region)] - -# View data -head(data) - -# Create visualization -# Europe Map -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/102-map-europe.html diff --git a/skills/Hiplot/103-map-france-town_skill.md b/skills/Hiplot/103-map-france-town_skill.md deleted file mode 100644 index a4eb46009f..0000000000 --- a/skills/Hiplot/103-map-france-town_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: France Map (Town) (R) - -## Category -Hiplot - -## When to Use -Create a France Map (Town) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-france-town/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-france-town/france_town.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$ENG_NAME, data$name)] - -# View data -head(data) - -# Create visualization -# France Map (Town) -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/103-map-france-town.html diff --git a/skills/Hiplot/104-map-france_skill.md b/skills/Hiplot/104-map-france_skill.md deleted file mode 100644 index 63c6e644af..0000000000 --- a/skills/Hiplot/104-map-france_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: France Map (R) - -## Category -Hiplot - -## When to Use -Create a France Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-france/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-france/france.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$ENG_NAME, data$name)] - -# View data -head(data) - -# Create visualization -# France Map -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/104-map-france.html diff --git a/skills/Hiplot/106-map-germany-town_skill.md b/skills/Hiplot/106-map-germany-town_skill.md deleted file mode 100644 index 2ee0ef0373..0000000000 --- a/skills/Hiplot/106-map-germany-town_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Germany Map (Town) (R) - -## Category -Hiplot - -## When to Use -Create a Germany Map (Town) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-germany-town/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-germany-town/germany_town.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$ENG_NAME, data$name)] - -# View data -head(data) - -# Create visualization -# Germany Map (Town) -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/106-map-germany-town.html diff --git a/skills/Hiplot/107-map-germany_skill.md b/skills/Hiplot/107-map-germany_skill.md deleted file mode 100644 index 19f30c417e..0000000000 --- a/skills/Hiplot/107-map-germany_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Germany Map (R) - -## Category -Hiplot - -## When to Use -Create a Germany Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-germany/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-germany/germany.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$ENG_NAME, data$name)] - -# View data -head(data) - -# Create visualization -# Germany Map -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/107-map-germany.html diff --git a/skills/Hiplot/108-map-north-america_skill.md b/skills/Hiplot/108-map-north-america_skill.md deleted file mode 100644 index e33bcc9e07..0000000000 --- a/skills/Hiplot/108-map-north-america_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: North America Map (R) - -## Category -Hiplot - -## When to Use -Create a North America Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-north-america/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-north-america/na.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$ENG_NAME, data$region)] - -# View data -head(data) - -# Create visualization -# North America Map -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/108-map-north-america.html diff --git a/skills/Hiplot/109-map-oceania-antarc_skill.md b/skills/Hiplot/109-map-oceania-antarc_skill.md deleted file mode 100644 index 1f442b5d1f..0000000000 --- a/skills/Hiplot/109-map-oceania-antarc_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Oceania/Antarc Map (R) - -## Category -Hiplot - -## When to Use -Create a Oceania/Antarc Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-oceania-antarc/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-oceania-antarc/oca.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$ENG_NAME, data$region)] - -# View data -head(data) - -# Create visualization -# Oceania/Antarc Map -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/109-map-oceania-antarc.html diff --git a/skills/Hiplot/111-map-south-america_skill.md b/skills/Hiplot/111-map-south-america_skill.md deleted file mode 100644 index e0b6a3071b..0000000000 --- a/skills/Hiplot/111-map-south-america_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: South America Map (R) - -## Category -Hiplot - -## When to Use -Create a South America Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-south-america/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-south-america/sa.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$ENG_NAME, data$region)] - -# View data -head(data) - -# Create visualization -# South America Map -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/111-map-south-america.html diff --git a/skills/Hiplot/112-map-uk-city_skill.md b/skills/Hiplot/112-map-uk-city_skill.md deleted file mode 100644 index 856e2f4107..0000000000 --- a/skills/Hiplot/112-map-uk-city_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: UK Map (City) (R) - -## Category -Hiplot - -## When to Use -Create a UK Map (City) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-uk-city/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-uk-city/uk_city.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$ENG_NAME, data$name)] - -# View data -head(data) - -# Create visualization -# UK Map (City) -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/112-map-uk-city.html diff --git a/skills/Hiplot/113-map-uk_skill.md b/skills/Hiplot/113-map-uk_skill.md deleted file mode 100644 index 0ba6aff851..0000000000 --- a/skills/Hiplot/113-map-uk_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: UK Map (R) - -## Category -Hiplot - -## When to Use -Create a UK Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-uk/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-uk/uk.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$name, data$name)] - -# View data -head(data) - -# Create visualization -# UK Map -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/113-map-uk.html diff --git a/skills/Hiplot/114-map-usa-county_skill.md b/skills/Hiplot/114-map-usa-county_skill.md deleted file mode 100644 index 176a5320e5..0000000000 --- a/skills/Hiplot/114-map-usa-county_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: USA Map (County) (R) - -## Category -Hiplot - -## When to Use -Create a USA Map (County) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-usa-county/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-usa-county/usa.county.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$county, data$name)] - -# View data -head(data) - -# Create visualization -# USA Map (County) -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/114-map-usa-county.html diff --git a/skills/Hiplot/115-map-usa_skill.md b/skills/Hiplot/115-map-usa_skill.md deleted file mode 100644 index c6f33f6793..0000000000 --- a/skills/Hiplot/115-map-usa_skill.md +++ /dev/null @@ -1,86 +0,0 @@ -# Skill: USA Map (States) (R) - -## Category -Hiplot - -## When to Use -Create a USA Map (States) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-usa/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-usa/usa.rds")) - -# Convert data structure -dt_map$Value <- data$value[match(dt_map$state, data$name)] - -# View data -head(data) - -# Create visualization -# USA Map (States) -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(min(data$value), max(data$value), - round((max(data$value)-min(data$value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/115-map-usa.html diff --git a/skills/Hiplot/116-map-world_skill.md b/skills/Hiplot/116-map-world_skill.md deleted file mode 100644 index 2652ae9a72..0000000000 --- a/skills/Hiplot/116-map-world_skill.md +++ /dev/null @@ -1,70 +0,0 @@ -# Skill: World Map (R) - -## Category -Hiplot - -## When to Use -Create a World Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-world/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-world/world.rds")) - -# Convert data structure -dt_map$Value <- data$death_rate[match(dt_map$ENG_NAME, data$region)] - -# View data -head(data) - -# Create visualization -# World Map -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), - color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - na.value = "grey10", - limits = c(0, max(dt_map$Value) * 1.2)) + - ggtitle("World Map Plot") + - theme_minimal() + - theme(plot.title = element_text(hjust = 0.5), - legend.position = "bottom", legend.direction = "horizontal") - -p -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/116-map-world.html diff --git a/skills/Hiplot/117-map-world2_skill.md b/skills/Hiplot/117-map-world2_skill.md deleted file mode 100644 index 0dc6c639ba..0000000000 --- a/skills/Hiplot/117-map-world2_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: World Map 2 (R) - -## Category -Hiplot - -## When to Use -Create a World Map 2 using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- RColorBrewer -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/map-world2/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -dt_map <- readRDS(url("https://download.hiplot.cn/ui/basic/map-world/world.rds")) - -# Convert data structure -dt_map$Value <- data$death_rate[match(dt_map$ENG_NAME, data$region)] - -# View data -head(data) - -# Create visualization -# World Map 2 -p <- ggplot(dt_map) + - geom_polygon(aes(x = long, y = lat, group = group, fill = Value), - alpha = 0.9, size = 0.5) + - geom_path(aes(x = long, y = lat, group = group), color = "black", size = 0.2) + - coord_fixed() + - scale_fill_gradientn( - colours = colorRampPalette(rev(brewer.pal(11,"RdYlBu")))(500), - breaks = seq(round(min(dt_map$Value)), round(max(dt_map$Value)), - round((max(dt_map$Value)-min(dt_map$Value))/7)), - name = "Color Key", - guide = guide_legend( - direction = "vertical", keyheight = unit(1, units = "mm"), - keywidth = unit(8, units = "mm"), - title.position = "top", title.hjust = 0.5, label.hjust = 0.5, - nrow = 1, byrow = T, reverse = F, label.position = "bottom")) + - theme(text = element_text(color = "#3A3F4A"), - axis.text = element_blank(), - axis.ticks = element_blank(), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank(), - legend.position = "top", - legend.text = element_text(size = 4 * 1.5, color = "black"), - legend.title = element_text(size = 5 * 1.5, color = "black"), - plot.title = element_text( - face = "bold", size = 5 * 1.5, hjust = 0.5, - margin = margin(t = 4, b = 5), color = "black"), - plot.background = element_rect(fill = "#FFFFFF", color = "#FFFFFF"), - panel.background = element_rect(fill = "#FFFFFF", color = NA), - legend.background = element_rect(fill = "#FFFFFF", color = NA), - plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), "cm")) + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `long` to the x aesthetic -- `y`: Maps `lat` to the y aesthetic -- `group`: Maps `group` to the group aesthetic -- `fill`: Maps `Value` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/117-map-world2.html diff --git a/skills/Hiplot/118-matrix-bubble_skill.md b/skills/Hiplot/118-matrix-bubble_skill.md deleted file mode 100644 index 5e0abbc718..0000000000 --- a/skills/Hiplot/118-matrix-bubble_skill.md +++ /dev/null @@ -1,71 +0,0 @@ -# Skill: Matrix Bubble (R) - -## Category -Hiplot - -## When to Use -The color matrix bubble is used to visualize the expression matrix data of multiple genes (rows) in various cells (columns). - -## Required R Packages -- data.table -- ggalluvial -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggalluvial) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/matrix-bubble/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[, 1] <- factor(data[, 1], levels = unique(data[, 1])) -data[, 2] <- factor(data[, 2], levels = unique(data[, 2])) - -# View data -head(data) - -# Create visualization -# Matrix Bubble -p <- ggplot(data = data, aes(x = x, y = y, size = value, color = y)) + - geom_point(alpha = 1) + - labs(title = "Matrix Bubble") + - guides(color = FALSE) + - theme(panel.background = element_blank(), - panel.grid.major = element_line(colour = "gray"), - strip.background = element_blank(), - panel.border = element_rect(colour = "black", fill = NA), - panel.spacing = unit(0, "lines"), - plot.title = element_text(size = 12, hjust = 0.5), - text = element_text(family = "Arial"), - legend.title = element_text(size = 10), - axis.text.x = element_text(angle=0, hjust=0.5, vjust=1)) + - facet_grid(~group, scales = 'fixed', margins = F) + - scale_color_manual(values = c( - "#3B4992FF","#EE0000FF","#008B45FF","#631879FF","#008280FF","#BB0021FF", - "#5F559BFF","#A20056FF","#808180FF","#1B1919FF")) - -p -``` - -## Key Parameters -- `x`: Maps `x` to the x aesthetic -- `y`: Maps `y` to the y aesthetic -- `size`: Maps `value` to the size aesthetic -- `color`: Maps `y` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/118-matrix-bubble.html diff --git a/skills/Hiplot/119-meta-bin_skill.md b/skills/Hiplot/119-meta-bin_skill.md deleted file mode 100644 index c6755f7c7d..0000000000 --- a/skills/Hiplot/119-meta-bin_skill.md +++ /dev/null @@ -1,52 +0,0 @@ -# Skill: Meta-analysis of Binary Data (R) - -## Category -Hiplot - -## When to Use -Create a Meta-analysis of Binary Data using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- meta - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(meta) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/meta-bin/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -m1 <- metabin(ev.exp, n.exp, ev.cont, n.cont, studlab = Study, data = data) - -# View data -head(data) - -# Create visualization -# Meta-analysis of Binary Data -p <- as.ggplot(function(){ - meta::forest(m1, layout = "meta") - }) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/119-meta-bin.html diff --git a/skills/Hiplot/120-meta-cont_skill.md b/skills/Hiplot/120-meta-cont_skill.md deleted file mode 100644 index dab29f909b..0000000000 --- a/skills/Hiplot/120-meta-cont_skill.md +++ /dev/null @@ -1,53 +0,0 @@ -# Skill: Meta-analysis of Continuous Data (R) - -## Category -Hiplot - -## When to Use -Create a Meta-analysis of Continuous Data using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- meta - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(meta) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/meta-cont/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -m1 <- metacont(n.e, mean.e, sd.e, n.c, mean.c, sd.c, studlab = Study, data = data, - sm = "SMD") - -# View data -head(data) - -# Create visualization -# Meta-analysis of Continuous Data -p <- as.ggplot(function(){ - meta::forest(m1, layout = "meta") - }) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/120-meta-cont.html diff --git a/skills/Hiplot/121-metawho_skill.md b/skills/Hiplot/121-metawho_skill.md deleted file mode 100644 index e31d0228c7..0000000000 --- a/skills/Hiplot/121-metawho_skill.md +++ /dev/null @@ -1,53 +0,0 @@ -# Skill: Meta-Subgroup Analysis (R) - -## Category -Hiplot - -## When to Use -The goal of metawho is to provide simple R implementation of “Meta-analytical method to Identify Who Benefits Most from Treatments”. - -## Required R Packages -- cowplot -- data.table -- jsonlite -- metawho - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(data.table) -library(jsonlite) -library(metawho) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/metawho/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data = deft_prepare(data, conf_level = 1 - 0.95) -res = deft_do(data, group_level = unique(data$subgroup)) - -# View data -head(data) - -# Create visualization -# Meta-Subgroup Analysis -p1 <- deft_show(res, element = "all") -p2 <- deft_show(res, element = "subgroup") -p <- plot_grid(p1, p2, nrow = 2) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/121-metawho.html diff --git a/skills/Hiplot/122-moon-charts_skill.md b/skills/Hiplot/122-moon-charts_skill.md deleted file mode 100644 index f82f733e58..0000000000 --- a/skills/Hiplot/122-moon-charts_skill.md +++ /dev/null @@ -1,71 +0,0 @@ -# Skill: Moon charts (R) - -## Category -Hiplot - -## When to Use -The moon chart is a graph that uses the moon's waxing and waning to reflect the size of the data. - -## Required R Packages -- data.table -- gggibbous -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(gggibbous) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/moon-charts/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[, 1] <- factor(data[, 1], levels = unique(data[, 1])) -rest_cols <- colnames(data)[-1] -tidyrest <- reshape( - data, - varying = rest_cols, - v.names = "Score", - timevar = "Category", - times = factor(rest_cols, levels = rest_cols), - idvar = colnames(data)[1], - direction = "long" -) - -# View data -head(data) - -# Create visualization -# Moon charts -p <- ggplot(tidyrest, aes(0, 0)) + - geom_moon(aes(ratio = (Score - 1) / 4), fill = "black") + - geom_moon(aes(ratio = 1 - (Score - 1) / 4), right = FALSE) + - facet_grid(Category ~ Restaurant, switch = "y") + - theme_minimal() + - theme( - panel.grid = element_blank(), - axis.text = element_blank(), - axis.title = element_blank() - ) - -p -``` - -## Key Parameters -- `theme`: Plot theme; tutorial uses `theme_minimal()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/122-moon-charts.html diff --git a/skills/Hiplot/123-mosaic_skill.md b/skills/Hiplot/123-mosaic_skill.md deleted file mode 100644 index 300c391c3d..0000000000 --- a/skills/Hiplot/123-mosaic_skill.md +++ /dev/null @@ -1,55 +0,0 @@ -# Skill: Mosaic Ratio Plot (R) - -## Category -Hiplot - -## When to Use -Use mosaic blocks to show data proportions. - -## Required R Packages -- DescTools -- data.table -- ggplotify -- jsonlite -- vcd - -## Minimal Reproducible Code -```r -# Load packages -library(DescTools) -library(data.table) -library(ggplotify) -library(jsonlite) -library(vcd) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/mosaic/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -tbl <- xtabs(~ Survived + PassengerClass + Gender, data) - -# View data -head(data) - -# Create visualization -# Mosaic Ratio Plot -p <- as.ggplot(function() { - mosaic(tbl, shade = TRUE, legend = TRUE, main = "Mosaic Ratio Plot", - gp = shading_binary(tbl, col = c("#3B4992FF","#EE0000FF"))) -}) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/123-mosaic.html diff --git a/skills/Hiplot/125-multiple-histograms_skill.md b/skills/Hiplot/125-multiple-histograms_skill.md deleted file mode 100644 index f8157183ea..0000000000 --- a/skills/Hiplot/125-multiple-histograms_skill.md +++ /dev/null @@ -1,54 +0,0 @@ -# Skill: Multiple Histograms (R) - -## Category -Hiplot - -## When to Use -Multiple histograms are plotted on the same graph to compare differences between multiple sets of data. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/multiple-histograms/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Multiple Histograms -p <- ggplot(data, aes(x = value, fill = type)) + - geom_histogram(color = "black", alpha = 0.5, - position = "identity", binwidth = 0.3) + - scale_fill_manual(values = c("#BC3C29FF","#0072B5FF")) + - theme_bw() - -p -``` - -## Key Parameters -- `x`: Maps `value` to the x aesthetic -- `fill`: Maps `type` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/125-multiple-histograms.html diff --git a/skills/Hiplot/127-network-igraph_skill.md b/skills/Hiplot/127-network-igraph_skill.md deleted file mode 100644 index b077d7a5c6..0000000000 --- a/skills/Hiplot/127-network-igraph_skill.md +++ /dev/null @@ -1,82 +0,0 @@ -# Skill: Network (igraph) (R) - -## Category -Hiplot - -## When to Use -Network (igraph) can be used to visulize basic network based on igraph. - -## Required R Packages -- RColorBrewer -- data.table -- ggplotify -- igraph -- jsonlite -- stringr - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(data.table) -library(ggplotify) -library(igraph) -library(jsonlite) -library(stringr) - -# Prepare data -# Load data -nodes_data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/network-igraph/data.json")$exampleData[[1]]$textarea[[1]]) -nodes_data <- as.data.frame(nodes_data) -edges_data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/network-igraph/data.json")$exampleData[[1]]$textarea[[2]]) -edges_data <- as.data.frame(edges_data) - -# Convert data structure -nodes_data[,"type.label"] <- factor(nodes_data[,"type.label"], - levels = unique(nodes_data[,"type.label"])) -nodes_data$hiplot_color_type <- as.numeric(nodes_data[,"type.label"]) -net <- graph_from_data_frame(d = edges_data, vertices = nodes_data, directed = T) -## Generate colors based on type -colrs <- c("#7f7f7f","#ff6347","#ffd700") -colrs2 <- c("#BC3C29FF","#0072B5FF","#E18727FF","#20854EFF","#7876B1FF", - "#6F99ADFF","#FFDC91FF","#EE4C97FF") -V(net)$color <- colrs[V(net)$hiplot_color_type] -## Compute node degrees (#links) and use that to set node size -deg <- degree(net, mode="all") -V(net)$size <- deg*3 -## Set label -V(net)$label.color <- "black" -V(net)$label <- NA -## Set edge width based on weight -weight_column <- edges_data$weight -E(net)$width <- weight_column/6 -## Change arrow size and edge color -E(net)$arrow.size <- .2 -E(net)$edge.color <- "gray80" -edge.start <- ends(net, es=E(net), names=F)[,1] -edge.col <- V(net)$color[edge.start] - -# View data -head(nodes_data) -head(edges_data) - -# Create visualization -# Network (igraph) -raw <- par() -p <- as.ggplot(function () { - par(mar=c(8,2,2,2)) - radian.rescale <- function(x, start=0, direction=1) { -# ... (see full tutorial for more) -``` - -## Key Parameters -- `width`: Controls element width -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/127-network-igraph.html diff --git a/skills/Hiplot/129-neural-network_skill.md b/skills/Hiplot/129-neural-network_skill.md deleted file mode 100644 index b330d3f81b..0000000000 --- a/skills/Hiplot/129-neural-network_skill.md +++ /dev/null @@ -1,50 +0,0 @@ -# Skill: Neural Network (R) - -## Category -Hiplot - -## When to Use -Create a Neural Network using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- NeuralNetTools -- data.table -- jsonlite -- nnet - -## Minimal Reproducible Code -```r -# Load packages -library(NeuralNetTools) -library(data.table) -library(jsonlite) -library(nnet) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/neural-network/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Neural Network -mod <- nnet(Y1 ~ X1 + X2 + X3, data = neuraldat, size = 10, - maxint = 100, decay = 0) - -# plot -par(mar = numeric(4)) -plotnet(mod) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/129-neural-network.html diff --git a/skills/Hiplot/130-nomogram-logistic_skill.md b/skills/Hiplot/130-nomogram-logistic_skill.md deleted file mode 100644 index 8da1f50908..0000000000 --- a/skills/Hiplot/130-nomogram-logistic_skill.md +++ /dev/null @@ -1,68 +0,0 @@ -# Skill: Nomogram (Logistic) (R) - -## Category -Hiplot - -## When to Use -Create a Nomogram (Logistic) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- rms - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(rms) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/nomogram-logistic/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -dd <- datadist(data) -options(datadist = "dd") -## Build Logistic model and run nomogram -logistic_res <- lrm(data=data, as.formula(paste( - colnames(data)[1], " ~ ", - paste(colnames(data)[2:length(colnames(data))], - collapse = "+" - ) - )) -) -logistic_nomo <- nomogram(logistic_res, maxscale = 100, - fun= function(x)1/(1+exp(-x)), lp=F, funlabel="Dead Risk", - fun.at=c(.001,.01,.05,seq(.1,.9,by=.1),.95,.99,.999) -) - -# View data -head(data) - -# Create visualization -# Nomogram (Logistic) -p <- as.ggplot(function() { - plot(logistic_nomo, - scale = 1 - ) - title(main = "Nomogram (Logistic)") -}) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/130-nomogram-logistic.html diff --git a/skills/Hiplot/131-nomogram_skill.md b/skills/Hiplot/131-nomogram_skill.md deleted file mode 100644 index 6e1e960ed6..0000000000 --- a/skills/Hiplot/131-nomogram_skill.md +++ /dev/null @@ -1,81 +0,0 @@ -# Skill: Nomogram (R) - -## Category -Hiplot - -## When to Use -Nomogram is often used to evaluate the prognosis of oncology and medicine, and can visualize the results of logistic regression or Cox regression. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- rms -- survival - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(rms) -library(survival) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/nomogram/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -dd <- datadist(data) -options(datadist = "dd") -## Build COX model and run nomogram -cox_res <- psm( - data = data, - as.formula(paste( - sprintf("Surv(%s, %s) ~ ", colnames(data)[1], colnames(data)[2]), - paste(colnames(data)[3:length(colnames(data))], - collapse = "+" - ) - )), - # Surv(time, status) ~ age + sex + ph.ecog + ph.karno + pat.karno, - dist = "lognormal" -) -## Build survival probability function -surv <- Survival(cox_res) -## Build quantile survival time function -med <- Quantile(cox_res) - -cox_nomo <- nomogram( - cox_res, - fun = list(function(x) surv(365, x), function(x) surv(1095, x), - function(x) surv(1825, x), function(x) med(lp = x)), - funlabel = c("1-year Survival Probability", - "3-year Survival Probability", - "5-year Survival Probability", - "Median Survival Time"), - maxscale = 100 -) - -# View data -head(data) - -# Create visualization -# Nomogram -p <- as.ggplot(function() { - plot(cox_nomo, scale = 1) -# ... (see full tutorial for more) -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/131-nomogram.html diff --git a/skills/Hiplot/132-parallel-coordinate_skill.md b/skills/Hiplot/132-parallel-coordinate_skill.md deleted file mode 100644 index 50509a4ac2..0000000000 --- a/skills/Hiplot/132-parallel-coordinate_skill.md +++ /dev/null @@ -1,71 +0,0 @@ -# Skill: Parallel Coordinate (R) - -## Category -Hiplot - -## When to Use -Create a Parallel Coordinate using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- GGally -- data.table -- ggthemes -- hrbrthemes -- jsonlite -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(GGally) -library(data.table) -library(ggthemes) -library(hrbrthemes) -library(jsonlite) -library(viridis) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/parallel-coordinate/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[, 6] <- factor(data[, 6], levels = unique(data[, 6])) - -# View data -head(data) - -# Create visualization -# Parallel Coordinate -p <- ggparcoord(data, columns = 2:(ncol(data) - 1), groupColumn = ncol(data), - title = "Parallel Coordinate Plot for cancer Data", - alphaLines = 0.3, scale = "globalminmax", - showPoints = T, boxplot = F) + - theme_base() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12, hjust = 0.5), - axis.title = element_text(size = 10), - axis.text = element_text(size = 12), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) + - scale_color_viridis(discrete = TRUE) + - facet_grid(formula(paste("~", (colnames(data)[ncol(data)])))) - -p -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_base()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/132-parallel-coordinate.html diff --git a/skills/Hiplot/133-pareto-chart_skill.md b/skills/Hiplot/133-pareto-chart_skill.md deleted file mode 100644 index 4f63dc1aac..0000000000 --- a/skills/Hiplot/133-pareto-chart_skill.md +++ /dev/null @@ -1,65 +0,0 @@ -# Skill: Pareto Chart (R) - -## Category -Hiplot - -## When to Use -Create a Pareto Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pareto-chart/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data <- data[order(-data[["sales"]]), ] -data[["channel"]] <- factor(data[["channel"]], levels = data[["channel"]]) -## Calculate percentage number -data$accumulating <- cumsum(data[["sales"]]) -max_y <- max(data[["sales"]]) -cal_num <- sum(data[["sales"]]) / max_y -data$accumulating <- data$accumulating / cal_num - -# View data -head(data) - -# Create visualization -# Pareto Chart -p <- ggplot(data, aes(x = channel, y = sales, fill = channel)) + - geom_bar(stat = "identity") + - geom_line(aes(y = accumulating), group = 1) + - geom_point(aes(y = accumulating), show.legend = FALSE) + - scale_y_continuous(sec.axis = sec_axis(trans = ~ . / max_y * 100, name = "Percentage")) + - scale_fill_manual(values = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF", - "#F39B7FFF","#8491B4FF","#91D1C2FF","#DC0000FF")) + - theme_bw() - -p -``` - -## Key Parameters -- `x`: Maps `channel` to the x aesthetic -- `y`: Maps `accumulating` to the y aesthetic -- `fill`: Maps `channel` to the fill aesthetic -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/133-pareto-chart.html diff --git a/skills/Hiplot/134-parliament_skill.md b/skills/Hiplot/134-parliament_skill.md deleted file mode 100644 index d5c3e7aebf..0000000000 --- a/skills/Hiplot/134-parliament_skill.md +++ /dev/null @@ -1,59 +0,0 @@ -# Skill: Parliament (R) - -## Category -Hiplot - -## When to Use -The parliamentary chart is a data processing method that looks like a parliamentary seat, with points representing a data set to show the share ratio of each group more flexibly. - -## Required R Packages -- data.table -- ggplot2 -- ggpol -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggpol) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/parliament/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Parliament -p <- ggplot(data) + - geom_parliament(alpha = 1, aes(seats = value, fill = group), color = "black") + - coord_fixed() + - scale_fill_discrete(name = "group", labels = unique(data$group)) + - scale_fill_manual(values = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF", - "#F39B7FFF")) + - ggtitle("Parliament Plot") + - theme_void() + - theme(legend.position = "bottom", - plot.title = element_text(hjust = 0.5)) - -p -``` - -## Key Parameters -- `fill`: Maps `group` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/134-parliament.html diff --git a/skills/Hiplot/135-pca2_skill.md b/skills/Hiplot/135-pca2_skill.md deleted file mode 100644 index f7c06d80ad..0000000000 --- a/skills/Hiplot/135-pca2_skill.md +++ /dev/null @@ -1,74 +0,0 @@ -# Skill: PCA2 (R) - -## Category -Hiplot - -## When to Use -Principal component analysis (PCA) is a data processing method with "dimension reduction" as the core, replacing multi-index data with a few comprehensive indicators (PCA), and restoring the most essential characteristics of data. - -## Required R Packages -- FactoMineR -- data.table -- factoextra -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(FactoMineR) -library(data.table) -library(factoextra) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pca2/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) -sample_info <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pca2/data.json")$exampleData[[1]]$textarea[[2]]) -sample_info <- as.data.frame(sample_info) - -# Convert data structure -row.names(sample_info) <- sample_info[,1] -sample_info <- sample_info[colnames(data)[-1],] -## tsne -rownames(data) <- data[, 1] -data <- as.matrix(data[, -1]) -pca_data <- PCA(t(as.matrix(data)), scale.unit = TRUE, ncp = 5, graph = FALSE) - -# View data -head(data[,1:5]) - -# Create visualization -# PCA2 -p <- fviz_pca_ind(pca_data, geom.ind = "point", pointsize = 6, addEllipses = TRUE, - mean.point = F, col.ind = sample_info[,"Group"]) + - ggtitle("Principal Component Analysis") + - scale_fill_manual(values = c("#00468BFF","#ED0000FF")) + - scale_color_manual(values = c("#00468BFF","#ED0000FF")) + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/135-pca2.html diff --git a/skills/Hiplot/136-pcatools_skill.md b/skills/Hiplot/136-pcatools_skill.md deleted file mode 100644 index e78b48fca2..0000000000 --- a/skills/Hiplot/136-pcatools_skill.md +++ /dev/null @@ -1,81 +0,0 @@ -# Skill: PCAtools (R) - -## Category -Hiplot - -## When to Use -PCAtools can reduce the dimensionality of data through principal component analysis, and view principal component related features at a two-dimensional level - -## Required R Packages -- PCAtools -- cowplot -- data.table -- ggplotify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(PCAtools) -library(cowplot) -library(data.table) -library(ggplotify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pcatools/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) -data2 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pcatools/data.json")$exampleData$textarea[[2]]) -data2 <- as.data.frame(data2) - -# View data -head(data[,1:5]) -head(data2[,1:5]) - -# Create visualization -# PCAtools -## Define the plot function -call_pcatools <- function(datTable, sampleInfo, - top_var, - screeplotComponents, screeplotColBar, - pairsplotComponents, - biplotShapeBy, biplotColBy, - plotloadingsComponents, - plotloadingsLowCol, - plotloadingsMidCol, - plotloadingsHighCol, - eigencorplotMetavars, - eigencorplotComponents) { - row.names(datTable) <- datTable[, 1] - datTable <- datTable[, -1] - row.names(sampleInfo) <- sampleInfo[, 1] - data3 <<- pca(datTable, metadata = sampleInfo, removeVar = (100 - top_var) / 100) - - for (i in c("screeplotComponents", "pairsplotComponents", - "plotloadingsComponents", "eigencorplotComponents")) { - if (ncol(data3$rotated) < get(i)) { - assign(i, ncol(data3$rotated)) - } - } - - p1 <- PCAtools::screeplot( - data3, - components = getComponents(data3, 1:screeplotComponents), - axisLabSize = 14, titleLabSize = 20, - colBar = screeplotColBar, - gridlines.major = FALSE, gridlines.minor = FALSE, -# ... (see full tutorial for more) -``` - -## Key Parameters -- `width`: Controls element width -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/136-pcatools.html diff --git a/skills/Hiplot/137-perspective_skill.md b/skills/Hiplot/137-perspective_skill.md deleted file mode 100644 index d2556f1ced..0000000000 --- a/skills/Hiplot/137-perspective_skill.md +++ /dev/null @@ -1,63 +0,0 @@ -# Skill: Perspective (R) - -## Category -Hiplot - -## When to Use -The three-dimensional perspective is a three-dimensional figure that can connect the higher values contained in a matrix with surfaces. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- shape - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(shape) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/perspective/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data <- as.matrix(data) -col <- drapecol(data) - -# View data -head(data[,1:5]) - -# Create visualization -# Perspective -p <- as.ggplot(function() { - persp(as.matrix(data), - theta = 45, phi = 20, - expand = 0.5, - r = 180, col = col, - ltheta = 120, - shade = 0.5, - ticktype = "detailed", - xlab = "X", ylab = "Y", zlab = "Z", - border = "black" # could be NA - ) - title("Perspective Plot", line = 0) -}) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/137-perspective.html diff --git a/skills/Hiplot/138-pie-3d_skill.md b/skills/Hiplot/138-pie-3d_skill.md deleted file mode 100644 index e6e5066df3..0000000000 --- a/skills/Hiplot/138-pie-3d_skill.md +++ /dev/null @@ -1,55 +0,0 @@ -# Skill: 3D Pie (R) - -## Category -Hiplot - -## When to Use -The 3D pie chart is a pie chart that has a 3D appearance. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- plotrix - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(plotrix) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pie-3d/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -colnames(data) <- c("Group", "Value") -data$Value <- as.numeric(data$Value) -data <- data[data$Value != 0,] - -# View data -head(data) - -# Create visualization -# 3D Pie -pie3D(data$Value, radius = 0.8, height = 0.05, theta = 0.8, - labels = paste(data$Group, "\n(n=", data$Value, ", ", - round(data$Value / sum(data$Value) * 100, 2), "%)", - sep = ""), - explode = 0.1, main = "", labelcex = 1, shade = 0.4, labelcol = "black", - col = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF")) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/138-pie-3d.html diff --git a/skills/Hiplot/139-pie-group_skill.md b/skills/Hiplot/139-pie-group_skill.md deleted file mode 100644 index 66d9d37018..0000000000 --- a/skills/Hiplot/139-pie-group_skill.md +++ /dev/null @@ -1,72 +0,0 @@ -# Skill: Pie Group (R) - -## Category -Hiplot - -## When to Use -Create a Pie Group using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- cowplot -- data.table -- ggplotify -- jsonlite -- patchwork - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(data.table) -library(ggplotify) -library(jsonlite) -library(patchwork) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pie-group/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[,"genre"] <- factor(data[,"genre"], levels = unique(data[,"genre"])) -data[,"mpaa"] <- factor(data[,"mpaa"], levels = unique(data[,"mpaa"])) - -# View data -head(data) - -# Create visualization -# Pie Group -col <- c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF","#F39B7FFF","#8491B4FF", - "#91D1C2FF","#DC0000FF","#7E6148FF","#B09C85FF") -plist <- list() -for (i in 1:length(unique(data[,"mpaa"]))) { - data_tmp <- data[data[,"mpaa"] == unique(data[,"mpaa"])[i],] - x <- table(data_tmp[,"genre"]) - ptmp <- as.ggplot(function(){ - par(oma=c(0,0,0,0)) - pie(x, - labels = sprintf("%s\n(n=%s, %s%%)", names(x), x, - round(x / sum(x) * 100, 0)), - col = col, - main = paste0("mpaa", ":", unique(data[,"mpaa"])[i]), - edges = 200, - radius = 0.8, - clockwise = F - ) - }) - plist[[i]] <- ptmp -} - -plot_grid(plotlist = plist, ncol = 2) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/139-pie-group.html diff --git a/skills/Hiplot/140-pie-matrix_skill.md b/skills/Hiplot/140-pie-matrix_skill.md deleted file mode 100644 index b1a5ebba57..0000000000 --- a/skills/Hiplot/140-pie-matrix_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Pie Matrix (R) - -## Category -Hiplot - -## When to Use -Create a Pie Matrix using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- dplyr -- ggplot2 -- jsonlite -- stringr -- tidyr - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(ggplot2) -library(jsonlite) -library(stringr) -library(tidyr) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pie-matrix/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[,"genre"] <- factor(data[,"genre"], levels = unique(data[,"genre"])) -data[,"mpaa"] <- factor(data[,"mpaa"], levels = unique(data[,"mpaa"])) -data[,"status"] <- factor(data[,"status"], levels = unique(data[,"status"])) -col <- c("#E64B35FF","#4DBBD5FF") -df <- matrix(NA, nrow = length(unique(data[,"mpaa"])), - ncol = length(unique(data[,"genre"]))) -row.names(df) <- unique(data[,"mpaa"]) -colnames(df) <- unique(data[,"genre"]) -for (i in 1:nrow(df)) { - for (j in 1:ncol(df)) { - for (k in unique(data[,"status"])) { - if (is.na(df[i, j])) { - df[i, j] <- sum(data[,"genre"] == unique(data[,"genre"])[j] & - data[,"mpaa"] == unique(data[,"mpaa"])[i] & - data[,"status"] == k) - } else { - df[i, j] <- paste0(df[i, j], ",", - sum(data[,"genre"] == unique(data[,"genre"])[j] & - data[,"mpaa"] == unique(data[,"mpaa"])[i] & - data[,"status"] == k)) - } - } - } -} -df <- as.matrix(df) - -# View data -head(data[,1:5]) - -# Create visualization -# Pie Matrix -p <- df %>% as.table() %>% - as.data.frame() %>% - mutate(Freq = str_split(Freq,",")) %>% - unnest(Freq) %>% - mutate(Freq = as.integer(Freq)) %>% -# ... (see full tutorial for more) -``` - -## Key Parameters -- `fill`: Maps `factor` to the fill aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/140-pie-matrix.html diff --git a/skills/Hiplot/141-pie_skill.md b/skills/Hiplot/141-pie_skill.md deleted file mode 100644 index 58c1aee71a..0000000000 --- a/skills/Hiplot/141-pie_skill.md +++ /dev/null @@ -1,84 +0,0 @@ -# Skill: Pie (R) - -## Category -Hiplot - -## When to Use -The pie chart is a statistical chart that shows the proportion of each part by dividing a circle into sections. - -## Required R Packages -- data.table -- dplyr -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pie/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - - -# Convert data structure -colnames(data) <- c("Group", "Value") -data <- data %>% - arrange(desc(Group)) %>% - mutate(prop = Value / sum(data$Value) * 100) %>% - mutate(ypos = Value / length(unique(Group)) + - c(0, cumsum(Value)[-length(Value)]) + 5) - -# View data -head(data) - -# Create visualization -# Pie -p <- ggplot(data, aes(x = "", y = Value, fill = Group)) + - geom_col(width = 1) + - geom_bar(stat = "identity", width = 1, color = "white") + - geom_text(aes(y = ypos, - label = sprintf("%s\n(n=%s, %s%%)", Group, Value, - round(Value / sum(data$Value) * 100, 2))), - color = "white", fontface = "bold") + - coord_polar(theta = "y", start = 0, direction = -1) + - guides(fill = guide_legend(title = "Group")) + - scale_fill_discrete( - breaks = data$Group, - labels = paste(data$Group," (", round(data$Value / sum(data$Value) * 100, 2), - "%)", sep = "")) + - scale_fill_manual(values = c("#00468BFF","#ED0000FF","#42B540FF","#0099B4FF")) + - ggtitle("Pie Plot") + - theme_minimal() + - theme( - axis.title.x = element_blank(), - axis.title.y = element_blank(), - axis.text.x = element_blank(), - axis.text.y = element_blank(), - panel.border = element_blank(), - panel.grid = element_blank(), - axis.ticks = element_blank(), - plot.title = element_text(size = 14, face = "bold", -# ... (see full tutorial for more) -``` - -## Key Parameters -- `y`: Maps `ypos` to the y aesthetic -- `fill`: Maps `Group` to the fill aesthetic -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/141-pie.html diff --git a/skills/Hiplot/142-point-sd_skill.md b/skills/Hiplot/142-point-sd_skill.md deleted file mode 100644 index b9d3da6463..0000000000 --- a/skills/Hiplot/142-point-sd_skill.md +++ /dev/null @@ -1,74 +0,0 @@ -# Skill: Point (SD) (R) - -## Category -Hiplot - -## When to Use -Displaying the standard deviation (SD) of multi-group data. - -## Required R Packages -- data.table -- dplyr -- grafify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(grafify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/point-sd/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -y <- "Doubling_time" -group <- "Student" -data[, group] <- factor(data[, group], levels = unique(data[, group])) -data <- data %>% - mutate(median = median(get(y), na.rm = TRUE), - mean = mean(get(y), na.rm = TRUE)) - -# View data -head(data) - -# Create visualization -# Point (SD) -p <- plot_point_sd(data = data, Student, Doubling_time, symsize = 5, - symthick = 0.5, s_alpha = 1, ewid = 0, symshape = 21, - all_alpha = 0) + - geom_hline(aes(yintercept = median), colour = 'black', linetype = 2, - size = 0.5) + - xlab(group) + ylab(y) + - guides(fill = guide_legend(title = group)) + - ggtitle("Point-SD") + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - - -p -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/142-point-sd.html diff --git a/skills/Hiplot/143-pseudo-enhanced-ma_skill.md b/skills/Hiplot/143-pseudo-enhanced-ma_skill.md deleted file mode 100644 index 54d4d6d62c..0000000000 --- a/skills/Hiplot/143-pseudo-enhanced-ma_skill.md +++ /dev/null @@ -1,70 +0,0 @@ -# Skill: EnhancedMA (R) - -## Category -Hiplot - -## When to Use -Visualization of differentially expressed genes. - -## Required R Packages -- EnhancedVolcano -- data.table -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(EnhancedVolcano) -library(data.table) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pseudo-enhanced-ma/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -row.names(data) <- data[,1] -data <- data[,-1] -data$baseMeanNew <- 1 / (10^log(data$baseMean + 1)) - -# View data -head(data) - -# Create visualization -# EnhancedMA -p <- EnhancedVolcano( - data, lab = rownames(data), title = "MA plot", subtitle = "EnhancedMA", - x = 'log2FoldChange', y = 'baseMeanNew', xlab = bquote(~Log[2]~ 'fold change'), - ylab = bquote(~Log[e]~ 'base mean + 1'), ylim = c(0,12), - pCutoff = as.numeric(1e-05), FCcutoff = 1, pointSize = 3.5, - labSize = 4, boxedLabels = T, colAlpha = 1, - legendLabels = c('NS', expression(Log[2]~FC), - 'Mean expression', - expression(Mean-expression~and~log[2]~FC)), - legendPosition = "bottom", legendLabSize = 16, legendIconSize = 4.0, - encircleCol = 'black', encircleSize = 2.5, encircleFill = 'pink', - encircleAlpha = 1/2) + - coord_flip() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `coord_flip()` for horizontal orientation when labels are long -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/143-pseudo-enhanced-ma.html diff --git a/skills/Hiplot/144-pyramid-chart_skill.md b/skills/Hiplot/144-pyramid-chart_skill.md deleted file mode 100644 index 5e06b4816f..0000000000 --- a/skills/Hiplot/144-pyramid-chart_skill.md +++ /dev/null @@ -1,56 +0,0 @@ -# Skill: Pyramid Chart (R) - -## Category -Hiplot - -## When to Use -The pyramid chart is a pyramid-like figure that distributes data on both sides of a central axis. - -## Required R Packages -- data.table -- ggcharts -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggcharts) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pyramid-chart/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Pyramid Chart -p <- pyramid_chart(data = data, x = age, y = pop, group = sex, - title = "", sort = "no", bar_colors = c("#C20B01","#196ABD")) + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/144-pyramid-chart.html diff --git a/skills/Hiplot/145-pyramid-chart2_skill.md b/skills/Hiplot/145-pyramid-chart2_skill.md deleted file mode 100644 index 23fedbe64f..0000000000 --- a/skills/Hiplot/145-pyramid-chart2_skill.md +++ /dev/null @@ -1,67 +0,0 @@ -# Skill: Pyramid Chart 2 (R) - -## Category -Hiplot - -## When to Use -The pyramid chart is a pyramid-like figure that distributes data on both sides of a central axis. - -## Required R Packages -- apyramid -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(apyramid) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pyramid-chart2/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -x <- as.integer(data[,"age"]) -data$age_group <- cut(x, breaks = pretty(x), right = TRUE, include.lowest = TRUE) - -# View data -head(data[,1:5]) - -# Create visualization -# Pyramid Chart 2 -p <- age_pyramid(data, "age_group", split_by = "Gender") + - scale_fill_manual(values = c("#BC3C29FF","#0072B5FF")) + - xlab("Age group") + - ylab("Gender") + - theme_classic() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_classic()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/145-pyramid-chart2.html diff --git a/skills/Hiplot/146-pyramid-stack_skill.md b/skills/Hiplot/146-pyramid-stack_skill.md deleted file mode 100644 index 80db0f08aa..0000000000 --- a/skills/Hiplot/146-pyramid-stack_skill.md +++ /dev/null @@ -1,78 +0,0 @@ -# Skill: Pyramid Stack (R) - -## Category -Hiplot - -## When to Use -The pyramid stack is a pyramid-like figure that distributes data on both sides of a central axis. - -## Required R Packages -- data.table -- dplyr -- ggplot2 -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(ggplot2) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pyramid-stack/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[,3] <- factor(data[,3], levels = unique(data[,3])) -data[,1] <- factor(data[,1], levels = unique(data[,1])) - -# View data -head(data) - -# Create visualization -# Pyramid Stack -p <- ggplot(data = data, aes(x = age, y = pop, fill = year)) + - geom_bar(data = data %>% filter(gender == "female") %>% arrange(rev(year)), - stat = "identity", position = "identity") + - geom_bar(data = data %>% filter(gender == "male") %>% arrange(rev(year)), - stat = "identity", position = "identity", mapping = aes(y = -pop)) + - coord_flip() + - geom_hline(yintercept = 0) + - scale_fill_economist() + - scale_fill_manual(values = c("#e04d39","#5bbad6","#1e9f86")) + - labs(y = "pop | male (left) - female (right)", x= "") + - theme_economist(horizontal = FALSE) + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "top", - legend.direction = "horizontal", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10), - panel.grid.major = element_blank(), - panel.grid.minor = element_blank()) - -p -``` - -## Key Parameters -- `x`: Maps `age` to the x aesthetic -- `y`: Maps `pop` to the y aesthetic -- `fill`: Maps `year` to the fill aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Use `coord_flip()` for horizontal orientation when labels are long -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/146-pyramid-stack.html diff --git a/skills/Hiplot/147-pyramid-stack2_skill.md b/skills/Hiplot/147-pyramid-stack2_skill.md deleted file mode 100644 index b5f92d3dfa..0000000000 --- a/skills/Hiplot/147-pyramid-stack2_skill.md +++ /dev/null @@ -1,64 +0,0 @@ -# Skill: Pyramid Stack2 (R) - -## Category -Hiplot - -## When to Use -The pyramid stack is a pyramid-like figure that distributes data on both sides of a central axis. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- plotrix - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(plotrix) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pyramid-stack2/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -agegrps <- unique(data[,1]) -split_var <- unique(data[,2]) -dat_left <- as.matrix(data[data[,2] == split_var[1],-c(1,2)]) -dat_right <- as.matrix(data[data[,2] == split_var[2],-c(1,2)]) - -# View data -head(data) - -# Create visualization -# Pyramid Stack2 -p <- as.ggplot(function() { - cols <- c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF") - names(cols) <- colnames(dat_left) - cols <- cols[1:ncol(dat_left)] - pyramid.plot(dat_left, dat_right, labels = agegrps, unit = "Value", - lxcol = cols, rxcol = cols, - laxlab=as.numeric(c(0,10,20,30)), raxlab=as.numeric(c(0,10,20,30)), - top.labels=c(split_var[1], colnames(data)[1], split_var[2]), - gap=4, ppmar=c(4,2,4,7), do.first="plot_bg(\"#FFFFFF\")") - mtext("Porridge temperature by age and sex of bear", 3, 2, cex=1) - legend("right", inset=c(-0.25,0), legend = colnames(dat_left), fill = cols) - }) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/147-pyramid-stack2.html diff --git a/skills/Hiplot/148-qqplot_skill.md b/skills/Hiplot/148-qqplot_skill.md deleted file mode 100644 index c8380528b0..0000000000 --- a/skills/Hiplot/148-qqplot_skill.md +++ /dev/null @@ -1,65 +0,0 @@ -# Skill: QQ Plot (R) - -## Category -Hiplot - -## When to Use -Verify whether a set of data comes from a certain distribution or whether two sets of data come from the same (family) distribution. - -## Required R Packages -- data.table -- grafify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(grafify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/qqplot/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[, "Genotype"] <- factor(data[, "Genotype"], levels = unique(data[, "Genotype"])) - -# View data -head(data) - -# Create visualization -# QQ Plot -p <- plot_qqline(data = data, ycol = Cytokine, group = Genotype, - symsize = 2, symthick = 0.5, s_alpha = 1) + - ggtitle("QQplot without facet") + - xlab("theoretical") + ylab("sample") + - guides(fill = guide_legend(title = "Genotype")) + - scale_color_manual(values = c("#E69F00","#4DB1DC")) + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/148-qqplot.html diff --git a/skills/Hiplot/149-r-code-flow_skill.md b/skills/Hiplot/149-r-code-flow_skill.md deleted file mode 100644 index 64a0a8629b..0000000000 --- a/skills/Hiplot/149-r-code-flow_skill.md +++ /dev/null @@ -1,48 +0,0 @@ -# Skill: R Script Flow (R) - -## Category -Hiplot - -## When to Use -R script flow can realize the visual window of if, else and other logic functions. - -## Required R Packages -- flow - -## Minimal Reproducible Code -```r -# Load packages -library(flow) - -# Prepare data -# Load data -code <- function(){ - if (x < 10) { - a <- 1 - } else { - a <- 2 - } - if (a == 2) { - c <- d - } else { - d <- a - } -} - -# Create visualization -# R Script Flow -p <- flow_view(code) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/149-r-code-flow.html diff --git a/skills/Hiplot/150-radar_skill.md b/skills/Hiplot/150-radar_skill.md deleted file mode 100644 index 667dd70d39..0000000000 --- a/skills/Hiplot/150-radar_skill.md +++ /dev/null @@ -1,81 +0,0 @@ -# Skill: Radar (R) - -## Category -Hiplot - -## When to Use -Radar chart displays multivariable data in the form of two-dimensional charts representing three or more quantitative variables on the axis starting from the same point, so as to visually express the comparison of a research object in multiple parameters. - -## Required R Packages -- data.table -- dplyr -- ggplot2 -- ggradar -- jsonlite -- scales -- tibble - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(ggplot2) -library(ggradar) -library(jsonlite) -library(scales) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/radar/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data <- as.data.frame(t(data)) -colnames(data) <- data[1, ] -data <- data[-1, ] -for (i in seq_len(ncol(data))) { - data[, i] <- as.numeric(data[, i]) -} -data_radar <- data %>% - rownames_to_column(var = "sample") -data_radar <- data_radar %>% mutate_at(vars(-sample), rescale) - -# View data -head(data) - -# Create visualization -# Radar -p <- ggradar(data_radar, gridline.max.linetype = 1, group.point.size = 4, - group.line.width = 1, font.radar = "Arial", fill.alpha = 0.5, - gridline.min.colour = "grey", gridline.mid.colour = "#007A87", - gridline.max.colour = "grey") + - ggtitle("Radar Plot") + - scale_color_manual(values = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF")) + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_blank(), - axis.text = element_text(size = 10), - axis.text.x = element_blank(), - axis.title.y=element_blank(), - axis.ticks.y=element_blank(), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/150-radar.html diff --git a/skills/Hiplot/151-rcs-cox_skill.md b/skills/Hiplot/151-rcs-cox_skill.md deleted file mode 100644 index 5a42a4f4cc..0000000000 --- a/skills/Hiplot/151-rcs-cox_skill.md +++ /dev/null @@ -1,83 +0,0 @@ -# Skill: RCS-COX (R) - -## Category -Hiplot - -## When to Use -Nonlinear regression analysis. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite -- rms -- stringr -- survival - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) -library(rms) -library(stringr) -library(survival) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/rcs-cox/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data <- na.omit(data) -ex <- set::not(colnames(data), c("main", "time", "event")) -ex <- str_c(ex, collapse = "+") -dd <<- datadist(data) -options(datadist = "dd") -for (i in 3:5) { - fit <- coxph(as.formula(paste0("Surv(time, event) ~ rcs(main, nk = i, inclx = T)+", ex, collapse = "+")), data = data, x = TRUE) - tmp <- extractAIC(fit) - if (i == 3) { - AIC <- tmp[2] - nk <<- 3 - } - if (tmp[2] < AIC) { - AIC <- tmp[2] - nk <<- i - } -} -fit <- cph(as.formula(paste0("Surv(time, event) ~ rcs(main, nk = nk, inclx = T)+", ex, collapse = "+")), data = data, x = TRUE) -dd$limits$main[2] <- median(data$main) -fit <- update(fit) -orr <- Predict(fit, main, fun = exp, ref.zero = TRUE) - -# View data -head(data) - -# Create visualization -# RCS-COX -p <- ggplot() + - geom_line(data = orr, aes(main, yhat), linetype = "solid", size = 1, alpha = 1, - colour = "#FF0000") + - geom_ribbon(data = orr, aes(main, ymin = lower, ymax = upper), alpha = 0.6, - fill = "#FFC0CB") + - geom_hline(yintercept = 1, linetype = 2, size = 0.5) + - geom_vline(xintercept = dd$limits$main[2], linetype = 2, size = 0.5) + - labs(x = " ", y = "Hazard Ratio(95%CI)") + - theme_bw() + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/151-rcs-cox.html diff --git a/skills/Hiplot/152-rcs-lrm_skill.md b/skills/Hiplot/152-rcs-lrm_skill.md deleted file mode 100644 index 80973b4c0e..0000000000 --- a/skills/Hiplot/152-rcs-lrm_skill.md +++ /dev/null @@ -1,83 +0,0 @@ -# Skill: RCS-LRM (R) - -## Category -Hiplot - -## When to Use -Nonlinear regression analysis. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite -- rms -- stringr -- survival - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) -library(rms) -library(stringr) -library(survival) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/rcs-lrm/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data <- na.omit(data) -ex <- set::not(colnames(data), c("main", "group")) -ex <- str_c(ex, collapse = "+") -dd <<- datadist(data) -options(datadist = "dd") -for (i in 3:5) { - fit <- lrm(as.formula(paste0("group~rcs(main,nk=i,inclx = T)+", ex, collapse = "+")), data = data, x = TRUE) - tmp <- AIC(fit) - if (i == 3) { - AIC <- tmp - nk <<- 3 - } - if (tmp < AIC) { - AIC <- tmp - nk <<- i - } -} -fit <- lrm(as.formula(paste0("group~rcs(main,nk=nk,inclx = T)+", ex, collapse = "+")), data = data, x = TRUE) -dd$limits$main[2] <- median(data$main) -fit <- update(fit) -orr <- Predict(fit, main, fun = exp, ref.zero = TRUE) - -# View data -head(data) - -# Create visualization -# RCS-LRM -p <- ggplot() + - geom_line(data = orr, aes(main, yhat), linetype = "solid", size = 1, alpha = 1, - colour = "#FF0000") + - geom_ribbon(data = orr, aes(main, ymin = lower, ymax = upper), alpha = 0.6, - fill = "#FFC0CB") + - geom_hline(yintercept = 1, linetype = 2, size = 0.5) + - geom_vline(xintercept = dd$limits$main[2], linetype = 2, size = 0.5) + - labs(x = "main", y = "Odds Ratio(95%CI)") + - theme_bw() + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/152-rcs-lrm.html diff --git a/skills/Hiplot/153-ribbon_skill.md b/skills/Hiplot/153-ribbon_skill.md deleted file mode 100644 index 4c77eef928..0000000000 --- a/skills/Hiplot/153-ribbon_skill.md +++ /dev/null @@ -1,76 +0,0 @@ -# Skill: Ribbon (R) - -## Category -Hiplot - -## When to Use -The ribbon diagram is a pattern similar to a ribbon. - -## Required R Packages -- data.table -- ggplot2 -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ribbon/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -colnames(data) <- c("group", "xvalue", "yvalue1", "yvalue2") -data$yvalue <- (data$yvalue1 + data$yvalue2) / 2 - -# View data -head(data) - -# Create visualization -# Ribbon -p <- ggplot(data, aes(xvalue, yvalue, fill = group)) + - geom_ribbon(alpha = 0.2, aes(ymin = yvalue1, ymax = yvalue2)) + - geom_line(aes(y = yvalue, color = group), lwd = 1) + - geom_line(aes(y = yvalue1, color = group), linetype = "dotted") + - geom_line(aes(y = yvalue2, color = group), linetype = "dotted") + - ylab("y axis value") + - xlab("x axis value") + - ggtitle("Ribbon Plot") + - scale_fill_manual(values = c("#e04d39","#5bbad6")) + - scale_color_manual(values = c("#e04d39","#5bbad6")) + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `fill`: Maps `group` to the fill aesthetic -- `y`: Maps `yvalue2` to the y aesthetic -- `color`: Maps `group` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/153-ribbon.html diff --git a/skills/Hiplot/154-ridge_skill.md b/skills/Hiplot/154-ridge_skill.md deleted file mode 100644 index b12a554e5e..0000000000 --- a/skills/Hiplot/154-ridge_skill.md +++ /dev/null @@ -1,77 +0,0 @@ -# Skill: Ridge (R) - -## Category -Hiplot - -## When to Use -The ridge map is a graph that connects points and forms a ridge. - -## Required R Packages -- data.table -- ggplot2 -- ggridges -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggridges) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/ridge/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data$group <- factor(data$group, levels = unique(data$group)[length(unique(data$group)):1]) - -# View data -head(data) - -# Create visualization -# Ridge -p <- ggplot(data, aes(x = value, y = group, fill = group, col = group)) + - geom_density_ridges(scale = 5, alpha = 0.8) + - labs(x = "value", y = "group") + - theme(plot.title = element_text(hjust = 0.5), - legend.position = "none") + - ggtitle("Ridge Plot") + - guides(color = guide_legend(reverse = TRUE), - fill = guide_legend(reverse = TRUE)) + - scale_fill_manual(values = c("#e04d39","#5bbad6","#1e9f86")) + - scale_color_manual(values = c("#e04d39","#5bbad6","#1e9f86")) + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `value` to the x aesthetic -- `y`: Maps `group` to the y aesthetic -- `fill`: Maps `group` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/154-ridge.html diff --git a/skills/Hiplot/155-risk-plot_skill.md b/skills/Hiplot/155-risk-plot_skill.md deleted file mode 100644 index e71f489832..0000000000 --- a/skills/Hiplot/155-risk-plot_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Risk Factor Analysis (R) - -## Category -Hiplot - -## When to Use -Create a Risk Factor Analysis using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- cowplot -- cutoff -- data.table -- fastStat -- ggplot2 -- jsonlite -- survminer - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(cutoff) -library(data.table) -library(fastStat) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/risk-plot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data <- data[order(data[, "riskscore"], decreasing = F), ] -cutoff_point <- median(x = data$riskscore, na.rm = TRUE) -data$Group <- ifelse(data$riskscore > cutoff_point, "High", "Low") -cut.position <- (1:nrow(data))[data$riskscore == cutoff_point] -if (length(cut.position) == 0) { - cut.position <- which.min(abs(data$riskscore - cutoff_point)) -} else if (length(cut.position) > 1) { - cut.position <- cut.position[length(cut.position)] -} -## Generate the data.frame required to draw A B graph -data2 <- data[, c("time", "event", "riskscore", "Group")] - -# View data -head(data) - -# Create visualization -# Risk Factor Analysis -## Figure A -fA <- ggplot(data = data2, aes(x = 1:nrow(data2), y = data2$riskscore, - color = Group)) + - geom_point(size = 2) + - scale_color_manual(name = "Risk Group", - values = c("Low" = "#0B45A5", "High" = "#E20B0B")) + - geom_vline(xintercept = cut.position, linetype = "dotted", size = 1) + - theme(panel.grid = element_blank(), panel.background = element_blank(), - axis.ticks.x = element_blank(), axis.line.x = element_blank(), - axis.text.x = element_blank(), axis.title.x = element_blank(), - axis.title.y = element_text(size = 14, vjust = 1, angle = 90), - axis.text.y = element_text(size = 11), - axis.line.y = element_line(size = 0.5, colour = "black"), - axis.ticks.y = element_line(size = 0.5, colour = "black"), - legend.title = element_text(size = 13), - legend.text = element_text(size = 12)) + - coord_trans() + - ylab("Risk Score") + - scale_x_continuous(expand = c(0, 3)) -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `id` to the x aesthetic -- `fill`: Maps `value` to the fill aesthetic -- `y`: Maps `variable` to the y aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/155-risk-plot.html diff --git a/skills/Hiplot/156-roc_skill.md b/skills/Hiplot/156-roc_skill.md deleted file mode 100644 index 228fee5277..0000000000 --- a/skills/Hiplot/156-roc_skill.md +++ /dev/null @@ -1,76 +0,0 @@ -# Skill: ROC (R) - -## Category -Hiplot - -## When to Use -Receiver operating characteristic curve (ROC curve) is used to describe the diagnostic ability of binary classifier system when its recognition threshold changes. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- pROC - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(pROC) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/roc/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -name_val <- colnames(data)[2:ncol(data)] -num_value <- ncol(data) - 1 - -# View data -head(data) - -# Create visualization -# ROC -col <- c("#00468BFF","#ED0000FF","#42B540FF") -p <- as.ggplot(function() { - for (i in 1:num_value) { - if (i == 1) { - roc_data <- roc(data[, 1], data[, i + 1], - percent = T, plot = T, grid = T, lty = i, quiet = T, - print.auc = F, col = col[i], smooth = F, - main = "ROC Plot" - ) - text(30, 50, "AUC", font = 2, col = "darkgray") - text(30, 50 - 10 * i, - paste(name_val[i], ":", sprintf("%0.4f", as.numeric(roc_data$auc))), - col = col[i] - ) - } else { - roc_data <- roc(data[, 1], data[, i + 1], - percent = T, plot = T, grid = T, add = T, lty = i, quiet = T, - print.auc = F, col = col[i] - ) - text(30, 50 - 10 * i, - paste(name_val[i], ":", sprintf("%0.4f", as.numeric(roc_data$auc))), - col = col[i] - ) - } - } - }) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/156-roc.html diff --git a/skills/Hiplot/157-rose-chart_skill.md b/skills/Hiplot/157-rose-chart_skill.md deleted file mode 100644 index 22181a7c25..0000000000 --- a/skills/Hiplot/157-rose-chart_skill.md +++ /dev/null @@ -1,65 +0,0 @@ -# Skill: Rose Chart (R) - -## Category -Hiplot - -## When to Use -The rose chart is a column chart drawn in polar coordinates. The radius of the arc is used to indicate the size of the data. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/rose-chart/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -data[, 2] <- factor(data[, 2], levels = unique(data[, 2])) - -# View data -head(data) - -# Create visualization -# Rose Chart -p <- ggplot(data, aes(x = Sample, y = Freq)) + - geom_col(aes(fill = Group), width = 0.9, size = 0, alpha = 0.8) + - coord_polar() + - ggtitle("Rose Chart") + - scale_fill_manual(values = c("#E64B35FF", "#4DBBD5FF")) + - theme_bw() + - theme(aspect.ratio = 1, - axis.text.x = element_text(colour = "black"), - axis.text.y = element_text(colour = "black"), - legend.title = element_blank(), - legend.position = "bottom", - plot.title = element_text(hjust = 0.5)) - -p -``` - -## Key Parameters -- `x`: Maps `Sample` to the x aesthetic -- `y`: Maps `Freq` to the y aesthetic -- `fill`: Maps `Group` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/157-rose-chart.html diff --git a/skills/Hiplot/158-sankey_skill.md b/skills/Hiplot/158-sankey_skill.md deleted file mode 100644 index ece7a2c1e2..0000000000 --- a/skills/Hiplot/158-sankey_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Sankey (R) - -## Category -Hiplot - -## When to Use -Sankey diagrams are a type of flow diagramin which the width of the arrows is proportional to the flow rate. - -## Required R Packages -- data.table -- ggalluvial -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggalluvial) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/sankey/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -value <- "Freq" -axis <- c("Class", "Sex") -usr_axis <- c() -for (i in seq_len(length(axis))) { - usr_axis <- c(usr_axis, axis[i]) - assign(paste0("axis", i), axis[i]) -} -index_axis <- match(usr_axis, colnames(data)) -index_value <- match(value, colnames(data)) -data1 <- data[, c(index_value, index_axis)] -## define band color -nlevels <- as.numeric(apply(data1[, -1], 2, function(data) { - return(length(unique(data))) -})) -band_color <- c("#8DD3C7", "#FFFFB3", "#BEBADA", "#FB8072", "#8DD3C7", "#FFFFB3") -## rename data -data_rename <- data1 -colnames(data_rename) <- c( - "value", - paste("axis", seq_len(length(usr_axis)), sep = "") -) - -# View data -head(data) - -# Create visualization -# Sankey -p <- ggplot(data_rename, aes(y = value, axis1 = axis1, axis2 = axis2)) + - geom_alluvium(alpha = 1, aes(fill = data1[, colnames(data1) == "Sex"]), - width = 0, reverse = FALSE) + - scale_x_discrete(limits = usr_axis, expand = c(0.02, 0.1)) + - ylab("") + - scale_fill_discrete(name = "Sex") + - coord_flip() + - geom_stratum(alpha = 1, width = 1 / 8, reverse = FALSE, fill = band_color, - color = "white") + - geom_text(stat = "stratum", infer.label = TRUE, reverse = FALSE) + - ggtitle("Sankey plot") + -# ... (see full tutorial for more) -``` - -## Key Parameters -- `y`: Maps `value` to the y aesthetic -- `fill`: Maps `data1` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Use `coord_flip()` for horizontal orientation when labels are long -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/158-sankey.html diff --git a/skills/Hiplot/159-scatter-3d_skill.md b/skills/Hiplot/159-scatter-3d_skill.md deleted file mode 100644 index dd3464a9db..0000000000 --- a/skills/Hiplot/159-scatter-3d_skill.md +++ /dev/null @@ -1,70 +0,0 @@ -# Skill: 3D-Scatter (R) - -## Category -Hiplot - -## When to Use -3D scatter plot is to apply a number of quantitative variables to different coaxes in space and combine different variables into coordinates in space, so as to clearly explain the interaction between the three quantitative variables. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- plot3D - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(plot3D) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/scatter-3d/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# Convert data structure -col_idx <- which(colnames(data) == "group") -data[, col_idx] <- as.factor(data[, col_idx]) -shapes <- 19 -shape_idx <- "" - -# View data -head(data) - -# Create visualization -# 3D-Scatter -p <- as.ggplot(function() { - plot3d <- scatter3D(data[, 1], data[, 2], data[, 3], - pch = shapes, cex = 1, - phi = 0, theta = 45, ticktype = "detailed", - bty = "b2", colkey = FALSE, alpha = 1, - xlab = colnames(data)[1], ylab = colnames(data)[2], - zlab = colnames(data)[3], - main = "3D-Scatter Plot", - colvar = as.numeric(as.factor(data[, 4])), - col = c("#e04d39","#5bbad6","#1e9f86") - ) - - legend("right", pch=19, legend = levels(data[, col_idx]), - cex = 1.1, bty = 'n', xjust = 0.5, horiz = F, - title = colnames(data)[col_idx], - col = c("#e04d39","#5bbad6","#1e9f86")) -}) - -p -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/159-scatter-3d.html diff --git a/skills/Hiplot/160-scatter-gradient_skill.md b/skills/Hiplot/160-scatter-gradient_skill.md deleted file mode 100644 index 1f352e48b7..0000000000 --- a/skills/Hiplot/160-scatter-gradient_skill.md +++ /dev/null @@ -1,70 +0,0 @@ -# Skill: Gradient Scatter (R) - -## Category -Hiplot - -## When to Use -Two-dimensional spatial scatter to demonstrate multi-numerical variable relationships. - -## Required R Packages -- data.table -- ggplot2 -- grafify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(grafify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/scatter-gradient/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Gradient Scatter -p <- ggplot(data, aes(x = mpg, y = disp)) + - geom_point(aes(fill = gear), size = 5, alpha = 1, shape = 21, stroke = 0.5) + - labs(fill = "gear", color = "gear") + - theme_classic(base_size = 10) + - theme(strip.background = element_blank()) + - guides(x = guide_axis(angle = 0)) + - scale_fill_gradient(low = "#00438E", high = "#E43535") + - scale_color_gradient(low = "#00438E", high = "#E43535") + - guides(fill = guide_legend(title = "gear"), - size = guide_legend(title = "gear")) + - ggtitle("Scatter-gradient Plot") + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `mpg` to the x aesthetic -- `y`: Maps `disp` to the y aesthetic -- `fill`: Maps `gear` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/160-scatter-gradient.html diff --git a/skills/Hiplot/161-scatter_skill.md b/skills/Hiplot/161-scatter_skill.md deleted file mode 100644 index bd47b10732..0000000000 --- a/skills/Hiplot/161-scatter_skill.md +++ /dev/null @@ -1,64 +0,0 @@ -# Skill: Scatter (R) - -## Category -Hiplot - -## When to Use -Two groups of data are used to form multiple coordinate points. By observing the distribution of coordinate points, it can judge whether there is correlation between variables or summarize the data processing mode of coordinate point distribution. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/scatter/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Scatter -p <- ggplot(data, aes(x = Value1, y = Value2)) + - geom_point(size = 1, alpha = 1, aes(color = Group, shape = Group)) + - ggtitle("Scatter Plot") + - scale_color_manual(values = c("#00468BFF", "#ED0000FF")) + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `Value1` to the x aesthetic -- `y`: Maps `Value2` to the y aesthetic -- `color`: Maps `Group` to the color aesthetic -- `shape`: Maps `Group` to the shape aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/161-scatter.html diff --git a/skills/Hiplot/162-scatter2_skill.md b/skills/Hiplot/162-scatter2_skill.md deleted file mode 100644 index 38af3d7d9c..0000000000 --- a/skills/Hiplot/162-scatter2_skill.md +++ /dev/null @@ -1,73 +0,0 @@ -# Skill: Scatter2 (R) - -## Category -Hiplot - -## When to Use -Two-dimensional spatial scatter to demonstrate multi-numerical variable relationships. - -## Required R Packages -- data.table -- ggplot2 -- grafify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(grafify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/scatter2/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data[,1:5]) - -# Create visualization -# scatter2 -symsize <- data[,"gear"] -data[,"gear"] <- factor(data[,"gear"], levels = unique(data[,"gear"])) -p <- ggplot(data, aes(x = mpg, y = disp)) + - geom_point(alpha = 1, aes(size = gear, fill = gear), shape = 21, stroke = 0.5) + - labs(fill = "gear", color = "gear") + - guides(x = guide_axis(angle = 0), - fill = guide_legend(title = "gear"), - color = FALSE, - size = guide_legend(title = "gear")) + - ggtitle("Scatter2 Plot") + - scale_fill_grafify() + - theme_classic(base_size = 20) + - theme(text = element_text(family = "Arial"), - strip.background = element_blank(), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `mpg` to the x aesthetic -- `y`: Maps `disp` to the y aesthetic -- `size`: Maps `gear` to the size aesthetic -- `fill`: Maps `gear` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/162-scatter2.html diff --git a/skills/Hiplot/163-scatterpie_skill.md b/skills/Hiplot/163-scatterpie_skill.md deleted file mode 100644 index 39e046f38f..0000000000 --- a/skills/Hiplot/163-scatterpie_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Scatterpie (R) - -## Category -Hiplot - -## When to Use -Scatter Pie can be used to visualize data fraction in different space coordinates. - -## Required R Packages -- data.table -- jsonlite -- scatterpie - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(jsonlite) -library(scatterpie) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/scatterpie/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Scatterpie -p <- ggplot() + - geom_scatterpie(data = data, aes(x = x, y = y), cols = colnames(data)[-c(1, 2)]) + - scale_fill_manual(values = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF")) + - labs(x="x", y="y") + - theme_minimal() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `x`: Maps `x` to the x aesthetic -- `y`: Maps `y` to the y aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/163-scatterpie.html diff --git a/skills/Hiplot/164-simple-funnel-diagram_skill.md b/skills/Hiplot/164-simple-funnel-diagram_skill.md deleted file mode 100644 index 4894a7afb7..0000000000 --- a/skills/Hiplot/164-simple-funnel-diagram_skill.md +++ /dev/null @@ -1,51 +0,0 @@ -# Skill: Simple Funnel Diagram (R) - -## Category -Hiplot - -## When to Use -Create a Simple Funnel Diagram using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- echarts4r -- jsonlite -- magrittr - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(echarts4r) -library(jsonlite) -library(magrittr) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/simple-funnel-diagram/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Simple Funnel Diagram -p <- data %>% - e_charts() %>% - e_funnel(value, key) %>% - e_title("Funnel") %>% - e_theme("macarons") - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/164-simple-funnel-diagram.html diff --git a/skills/Hiplot/165-slopegraph_skill.md b/skills/Hiplot/165-slopegraph_skill.md deleted file mode 100644 index 3a3878db12..0000000000 --- a/skills/Hiplot/165-slopegraph_skill.md +++ /dev/null @@ -1,59 +0,0 @@ -# Skill: Slopegraph (R) - -## Category -Hiplot - -## When to Use -Sopegraph can be used to display the change of values. - -## Required R Packages -- CGPfunctions -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(CGPfunctions) -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/slopegraph/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data[, "country"] <- factor(data[ ,"country"], levels = unique(data[ ,"country"])) -data[, "year"] <- factor(data[ ,"year"], levels = unique(data[ ,"year"])) - -# View data -head(data) - -# Create visualization -# Slopegraph -p <- newggslopegraph(data, year, lifeExp, country) + - labs(subtitle = "", title = "Slope Graph", x = "Life Expectancy (years)", - y = "country", caption = "") + - scale_color_manual(values = c("#3B4992FF", "#EE0000FF", "#008B45FF", - "#631879FF", "#008280FF", "#BB0021FF")) + - theme_minimal() + - theme(plot.title = element_text(hjust = 0.5)) - -p -``` - -## Key Parameters -- `theme`: Plot theme; tutorial uses `theme_minimal()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/165-slopegraph.html diff --git a/skills/Hiplot/166-stack-violin_skill.md b/skills/Hiplot/166-stack-violin_skill.md deleted file mode 100644 index ad670d4de3..0000000000 --- a/skills/Hiplot/166-stack-violin_skill.md +++ /dev/null @@ -1,81 +0,0 @@ -# Skill: Stack Violin (R) - -## Category -Hiplot - -## When to Use -The expression of key genes in each cluster in single-cell transcriptomic (Single Cell RNA-Seq)analysis. - -## Required R Packages -- Seurat -- ggplot2 -- limma -- readr - -## Minimal Reproducible Code -```r -# Load packages -library(Seurat) -library(ggplot2) -library(limma) -library(readr) - -# Prepare data -# Load data -data <- readr::read_delim("https://download.hiplot.cn/api/file/fetch/?path=/c622f9b0-54da-11f0-ba5f-8dc116702904/public/demo/stack-violin.txt") - -# convert data structure -data <- as.matrix(data) -rownames(data) <- data[, 1] -exp <- data[, 2:ncol(data)] -dimnames <- list( - rownames(exp), - colnames(exp) -) -data <- matrix(as.numeric(as.matrix(exp)), - nrow = nrow(exp), - dimnames = dimnames -) -data <- avereps(data, - ID = rownames(data) -) -## Convert the matrix to a Seurat object and filter the data -pbmc <- CreateSeuratObject( - counts = data, - project = "seurat", - min.cells = 0, - min.features = 0, - names.delim = "_", -) -## Calculate the percentage of mitochondrial genes using the PercentageFeatureSet function -pbmc[["percent.mt"]] <- PercentageFeatureSet( - object = pbmc, - pattern = "^MT-" -) -## Filter the data -pbmc <- subset( - x = pbmc, - subset = nFeature_RNA > 50 & percent.mt < 5 -) -## Normalize the data -pbmc <- NormalizeData( - object = pbmc, - normalization.method = "LogNormalize", - scale.factor = 10000, verbose = F -) -## Extract genes with large coefficient of variation between cells -# ... (see full tutorial for more) -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/166-stack-violin.html diff --git a/skills/Hiplot/167-stacked-percentage-bar-chart_skill.md b/skills/Hiplot/167-stacked-percentage-bar-chart_skill.md deleted file mode 100644 index b7cf21d993..0000000000 --- a/skills/Hiplot/167-stacked-percentage-bar-chart_skill.md +++ /dev/null @@ -1,72 +0,0 @@ -# Skill: Percentsge Stacked Bar Chart (R) - -## Category -Hiplot - -## When to Use -Create a Percentsge Stacked Bar Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- dplyr -- ggplot2 -- jsonlite -- scales -- tidyr - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(ggplot2) -library(jsonlite) -library(scales) -library(tidyr) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/stacked-percentage-bar-chart/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data$total <- rowSums(data[, -1]) -data_long <- gather(data, kinds, value, -days, -total) -data_long <- data_long %>% - group_by(days) %>% - mutate(percent = value / total * 100) -data_long[["days"]] <- factor(data_long[["days"]], levels = data[["days"]]) - -# View data -head(data) - -# Create visualization -# Percentsge Stacked Bar Chart -p <- ggplot(data_long, aes(x = percent, y = days, fill = kinds)) + - geom_bar(stat = "identity", position = "stack") + - geom_text(aes(label = ifelse(percent != 0, paste0(round(percent), "%"), "")), - position = position_stack(vjust = 0.5)) + - labs(title = "Percentage Stacked Bar Chart", x = "Percentage", y = "Days") + - scale_x_continuous(labels = percent_format(scale = 1)) + - theme_bw() + - theme(plot.title = element_text(hjust = 0.5)) + - scale_fill_manual(values = c("#E64B35FF","#4DBBD5FF","#00A087FF")) - -p -``` - -## Key Parameters -- `x`: Maps `percent` to the x aesthetic -- `y`: Maps `days` to the y aesthetic -- `fill`: Maps `kinds` to the fill aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/167-stacked-percentage-bar-chart.html diff --git a/skills/Hiplot/168-streamgraph_skill.md b/skills/Hiplot/168-streamgraph_skill.md deleted file mode 100644 index 684e462b10..0000000000 --- a/skills/Hiplot/168-streamgraph_skill.md +++ /dev/null @@ -1,51 +0,0 @@ -# Skill: Streamgraph (R) - -## Category -Hiplot - -## When to Use -Create a Streamgraph using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- jsonlite -- streamgraph - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(jsonlite) -library(streamgraph) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/streamgraph/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -colnames(data) <- c("date","key","value") - -# View data -head(data) - -# Create visualization -# Streamgraph -p <- streamgraph(data, key = "key", value = "value", date = "date", - offset = "silhouette", interpolate = "cardinal", - interactive = F, scale = "date") %>% - sg_fill_brewer(palette = "Spectral") - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/168-streamgraph.html diff --git a/skills/Hiplot/169-survival_skill.md b/skills/Hiplot/169-survival_skill.md deleted file mode 100644 index de307efcf2..0000000000 --- a/skills/Hiplot/169-survival_skill.md +++ /dev/null @@ -1,66 +0,0 @@ -# Skill: Survival Analysis (R) - -## Category -Hiplot - -## When to Use -The survivorship curve is a graph showing the number or proportion of individuals surviving to each age for a given species or group (e.g. males or females). - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- survival -- survminer - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(survival) -library(survminer) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/survival/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -colnames(data) <- c("Time", "Status", "Group") -data[,1] <- as.numeric(data[,1]) -fit <- survfit(Surv(Time, Status == 1) ~ Group, data = data) -data <- data[data[,1] < 1100,] - -# View data -head(data) - -# Create visualization -# Survival Analysis -p <- ggsurvplot( - fit, data = data, risk.table = T, pval = T, conf.int = T, fun = "pct", - size = 0.5, xlab = "Time", ylab = "Survival probability", - ggtheme = theme_bw(), risk.table.y.text.col = TRUE, - risk.table.height = 0.25, risk.table.y.text = T, - ncensor.plot = T, ncensor.plot.height = 0.25, - conf.int.style = "ribbon", surv.median.line = "hv", - palette = c("#00468BFF", "#ED0000FF"), - xlim = c(0, 1100), ylim = c(0, 100), - break.x.by = 150) - -p -``` - -## Key Parameters -- `theme`: Plot theme; tutorial uses `theme_bw()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/169-survival.html diff --git a/skills/Hiplot/170-taylor-diagram_skill.md b/skills/Hiplot/170-taylor-diagram_skill.md deleted file mode 100644 index a1c1c00b0d..0000000000 --- a/skills/Hiplot/170-taylor-diagram_skill.md +++ /dev/null @@ -1,53 +0,0 @@ -# Skill: Taylor Diagram (R) - -## Category -Hiplot - -## When to Use -It can be used to display the standard deviation (SD), root mean square (RMS) error and correlation coefficient of the models simultaneously. - -## Required R Packages -- openair - -## Minimal Reproducible Code -```r -# Load packages -library(openair) - -# Prepare data -# Load data -dat <- selectByDate(mydata, year = 2003) - -# convert data structure -dat <- data.frame(date = mydata$date, obs = mydata$nox, mod = mydata$nox) -dat <- transform(dat, month = as.numeric(format(date, "%m"))) -mod1 <- transform(dat, mod = mod + 10 * month + 10 * month * rnorm(nrow(dat)), -model = "model 1") -mod1 <- transform(mod1, mod = c(mod[5:length(mod)], mod[(length(mod) - 3) : -length(mod)])) -mod2 <- transform(dat, mod = mod + 7 * month + 7 * month * rnorm(nrow(dat)), -model = "model 2") -mod3 <- transform(dat, mod = mod + 3 * month + 3 * month * rnorm(nrow(dat)), -model = "model 3") -mod.dat <- rbind(mod1, mod2, mod3) - -# View data -head(mod.dat) - -# Create visualization -# Taylor Diagram -TaylorDiagram(mod.dat, obs = "obs", mod = "mod", group = "model", - main = "Taylor diagram", - cols = c("#00468BFF","#8e6097","#BFACF0FF")) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/170-taylor-diagram.html diff --git a/skills/Hiplot/171-time-roc_skill.md b/skills/Hiplot/171-time-roc_skill.md deleted file mode 100644 index f641954d2b..0000000000 --- a/skills/Hiplot/171-time-roc_skill.md +++ /dev/null @@ -1,86 +0,0 @@ -# Skill: Time ROC (R) - -## Category -Hiplot - -## When to Use -Receiver Operating Characteristic (ROC) analysis with time records in survival analysis. - -## Required R Packages -- data.table -- ggplot2 -- grid -- jsonlite -- plotROC -- survivalROC - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(grid) -library(jsonlite) -library(plotROC) -library(survivalROC) - -# Prepare data -# Load data -data1 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/time-roc/data.json")$exampleData$textarea[[1]]) -data1 <- as.data.frame(data1) -data2 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/time-roc/data.json")$exampleData$textarea[[2]]) -data2 <- as.data.frame(data2) - -# convert data structure -surv_table <- data1 -colnames(surv_table) <- c("surv", "cens", "risk") -mtime <- as.data.frame(data2)[, 1] -sroc <- lapply(mtime, function(t) { - stroc <- survivalROC( - Stime = surv_table$surv, - status = surv_table$cens, - marker = surv_table$risk, - predict.time = t, - method = "KM" - ) - data.frame( - TPF = stroc[["TP"]], - FPF = stroc[["FP"]], - cut = stroc[["cut.values"]], - time = rep( - stroc[["predict.time"]], - length(stroc[["TP"]]) - ), - AUC = rep( - stroc$AUC, - length(stroc$FP) - ) - ) -}) -mroc <- do.call(rbind, sroc) -mroc$time <- factor(mroc$time) - -# View data -head(data1) -head(data2) - -# Create visualization -# Time ROC -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `FPF` to the x aesthetic -- `y`: Maps `TPF` to the y aesthetic -- `color`: Maps `time` to the color aesthetic -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/171-time-roc.html diff --git a/skills/Hiplot/172-treeheatr_skill.md b/skills/Hiplot/172-treeheatr_skill.md deleted file mode 100644 index 4cf558c690..0000000000 --- a/skills/Hiplot/172-treeheatr_skill.md +++ /dev/null @@ -1,78 +0,0 @@ -# Skill: Treeheatr (R) - -## Category -Hiplot - -## When to Use -The heatmap decision tree is a visualization graph that combines two types of graphs: heatmap and decision tree visualization. - -## Required R Packages -- data.table -- ggplotify -- jsonlite -- treeheatr - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplotify) -library(jsonlite) -library(treeheatr) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/treeheatr/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -x <- data -wrong_cols <- suppressWarnings(sapply(x, function(x) { - if (!is.numeric(x)) { - sum(!is.na(as.numeric(x))) > 0.7 * length(x) - } else { - FALSE - } -})) -if (any(wrong_cols)) { - ix <- which(wrong_cols) - for (i in ix) { - data[[i]] <- suppressWarnings(as.numeric(data[[i]])) - } - rm(ix) -} -rm(x, wrong_cols) - -# View data -head(data) - -# Create visualization -# Treeheatr -p <- as.ggplot(function() { - print(heat_tree(data, - target_lab = "species", - task = 'classification', - show = "heat-tree", - heat_rel_height = 0.2, - panel_space = 0.001, - clust_samps = T, - clust_target = T, - lev_fac = 1.3, - cont_legend = F, - cate_legend = F - )) -}) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/172-treeheatr.html diff --git a/skills/Hiplot/173-treemap_skill.md b/skills/Hiplot/173-treemap_skill.md deleted file mode 100644 index 2907cdaba8..0000000000 --- a/skills/Hiplot/173-treemap_skill.md +++ /dev/null @@ -1,50 +0,0 @@ -# Skill: Treemap (R) - -## Category -Hiplot - -## When to Use -Tree map is a kind of tree structure diagram that graphical form to represent hierarchy structure. - -## Required R Packages -- data.table -- jsonlite -- treemap - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(jsonlite) -library(treemap) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/treemap/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Treemap -treemap(data, index = colnames(data)[1], vSize = colnames(data)[2], - vColor = colnames(data)[1], type = "index", title = "", - algorithm = "pivotSize", sortID = colnames(data)[1], border.lwds = 1, - fontcolor.labels = "#000000", inflate.labels = F, overlap.labels = 0.5, - fontfamily.title = "Arial", fontfamily.legend = "Arial", - fontfamily.labels = "Arial", - palette = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF","#F39B7FFF"), - aspRatio = 6 / 6) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/173-treemap.html diff --git a/skills/Hiplot/174-tricolor-histogram_skill.md b/skills/Hiplot/174-tricolor-histogram_skill.md deleted file mode 100644 index 72728120d3..0000000000 --- a/skills/Hiplot/174-tricolor-histogram_skill.md +++ /dev/null @@ -1,58 +0,0 @@ -# Skill: Tricolor Histogram (R) - -## Category -Hiplot - -## When to Use -The tricolored histogram divides the histogram into three regions: low-value zone, middle-value zone, and high-value zone, using three different colors. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/tricolor-histogram/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data$draw_color <- ifelse(data$value < 5, "#F44336", - ifelse(data$value > 7, "#006064", "#3F51B5") -) - -# View data -head(data) - -# Create visualization -# Tricolor Histogram -p <- ggplot(data, aes(x = values, fill = draw_color)) + - geom_histogram(alpha = 0.5, binwidth = 0.05, position = "identity") + - scale_fill_manual(values = c("#3F51B5", "#006064", "#F44336")) + - theme_bw() - -p -``` - -## Key Parameters -- `x`: Maps `values` to the x aesthetic -- `fill`: Maps `draw_color` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/174-tricolor-histogram.html diff --git a/skills/Hiplot/175-tsne_skill.md b/skills/Hiplot/175-tsne_skill.md deleted file mode 100644 index c95edff002..0000000000 --- a/skills/Hiplot/175-tsne_skill.md +++ /dev/null @@ -1,82 +0,0 @@ -# Skill: tSNE (R) - -## Category -Hiplot - -## When to Use -T-sne is a nonlinear dimensionality reduction algorithm suitable for high-dimensional data reduction to two or three dimensions and visualization. The algorithm can make the t distribution of points with greater similarity closer in the lower dimensional space. For low similarity points, the t distribution is farther away in the low dimensional space. - -## Required R Packages -- Rtsne -- data.table -- ggpubr -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(Rtsne) -library(data.table) -library(ggpubr) -library(jsonlite) - -# Prepare data -# Load data -data1 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/tsne/data.json")$exampleData[[1]]$textarea[[1]]) -data1 <- as.data.frame(data1) -data2 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/tsne/data.json")$exampleData[[1]]$textarea[[2]]) -data2 <- as.data.frame(data2) - -# convert data structure -sample.info <- data2 -rownames(data1) <- data1[, 1] -data1 <- as.matrix(data1[, -1]) -## tsne -set.seed(123) -tsne_info <- Rtsne(t(data1), perplexity = 1, theta = 0.1, check_duplicates = FALSE) -colnames(tsne_info$Y) <- c("tSNE_1", "tSNE_2") -# handle data -tsne_data <- data.frame( - sample = colnames(data1), - tsne_info$Y -) -colorBy <- sample.info[match(colnames(data1), sample.info[, 1]), "group"] -colorBy <- factor(colorBy, level = colorBy[!duplicated(colorBy)]) -tsne_data$colorBy = colorBy -shapeBy <- NULL - -# View data -head(data1) -head(data2) - -# Create visualization -# tsne -p <- ggscatter(data = tsne_data, x = "tSNE_1", y = "tSNE_2", size = 2, - palette = "lancet", color = "colorBy") + - labs(color = "group") + - ggtitle("tSNE Plot1") + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), -# ... (see full tutorial for more) -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/175-tsne.html diff --git a/skills/Hiplot/176-umap_skill.md b/skills/Hiplot/176-umap_skill.md deleted file mode 100644 index 10fbba0a3b..0000000000 --- a/skills/Hiplot/176-umap_skill.md +++ /dev/null @@ -1,81 +0,0 @@ -# Skill: UMAP (R) - -## Category -Hiplot - -## When to Use -UMAP is a nonlinear dimensionality reduction algorithm suitable for high-dimensional data reduction to two or three dimensions and visualization. The algorithm can make the t distribution of points with greater similarity closer in the lower dimensional space. For low similarity points, the t distribution is farther away in the low dimensional space. - -## Required R Packages -- data.table -- ggpubr -- jsonlite -- umap - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggpubr) -library(jsonlite) -library(umap) - -# Prepare data -# Load data -data1 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/umap/data.json")$exampleData$textarea[[1]]) -data1 <- as.data.frame(data1) -data2 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/umap/data.json")$exampleData$textarea[[2]]) -data2 <- as.data.frame(data2) - -# convert data structure -sample.info <- data2 -rownames(data1) <- data1[, 1] -data1 <- as.matrix(data1[, -1]) -## umap -set.seed(123) -umap_info <- umap(t(data1)) -colnames(umap_info$layout) <- c("UMAP_1", "UMAP_2") -# handle data -umap_data <- data.frame( - sample = colnames(data1), - umap_info$layout -) -colorBy <- sample.info[match(colnames(data1), sample.info[, 1]), "Species"] -colorBy <- factor(colorBy, level = colorBy[!duplicated(colorBy)]) -umap_data$colorBy = colorBy -shapeBy <- NULL - -# View data -head(data1[,1:5]) -head(data2) - -# Create visualization -# umap -p <- ggscatter(data = umap_data, x = "UMAP_1", y = "UMAP_2", size = 2, - palette = "lancet", color = "colorBy") + - labs(color = "group") + - ggtitle("UMAP Plot") + - theme_classic() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), -# ... (see full tutorial for more) -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_classic()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/176-umap.html diff --git a/skills/Hiplot/177-upset-plot_skill.md b/skills/Hiplot/177-upset-plot_skill.md deleted file mode 100644 index ee5a130c0b..0000000000 --- a/skills/Hiplot/177-upset-plot_skill.md +++ /dev/null @@ -1,82 +0,0 @@ -# Skill: Upset Plot (R) - -## Category -Hiplot - -## When to Use -Upset can be used to show the interactive relationship between collections. - -## Required R Packages -- ComplexHeatmap -- VennDiagram -- data.table -- ggplot2 -- ggplotify -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(ComplexHeatmap) -library(VennDiagram) -library(data.table) -library(ggplot2) -library(ggplotify) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/upset-plot/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -for (i in seq_len(ncol(data))) { - data[is.na(data[, i]), i] <- "" -} -data2 <- as.list(data) -data2 <- lapply(data2, function(x) {x[x != ""]}) -data2 <- list_to_matrix(data2) -m = make_comb_mat(data2, mode = "distinct") -ss = set_size(m) -cs = comb_size(m) -set_order <- order(ss) -comb_order <- order(comb_degree(m), -cs) - -# View data -head(data) - -# Create visualization -# Upset Plot -p <- as.ggplot(function(){ - top_annotation <- HeatmapAnnotation( - Intersections = anno_barplot( - cs, ylim = c(0, max(cs)*1.1), - border = FALSE, - gp = gpar(fill = "#000000", fontsize = 10), - height = unit(5, "cm") - ), - annotation_name_side = "left", - annotation_name_rot = 90 - ) - - left_annotation <- rowAnnotation( - Numbers = anno_barplot(-ss, axis_param = list( - at = seq(-max(ss), 0, round(max(ss)/5)), - labels = rev(seq(0, max(ss), round(max(ss)/5))), - labels_rot = 0), - baseline = 0, - border = FALSE, -# ... (see full tutorial for more) -``` - -## Key Parameters -- `width`: Controls element width -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/177-upset-plot.html diff --git a/skills/Hiplot/178-venn_skill.md b/skills/Hiplot/178-venn_skill.md deleted file mode 100644 index 6a31f6486c..0000000000 --- a/skills/Hiplot/178-venn_skill.md +++ /dev/null @@ -1,79 +0,0 @@ -# Skill: Venn (R) - -## Category -Hiplot - -## When to Use -A Venn diagram is a diagramthat shows all possible logical relations between a finite collection of different sets. These diagrams depict elements as points in the plane, and sets as regions inside closed curves. A Venn diagram consists of multiple overlapping closed curves, usually circles, each representing a set. The points inside a curve labelled S represent elements of the set S, while points outside the boundary represent elements not in the set S. This lends to easily read visualizatio... - -## Required R Packages -- VennDiagram -- data.table -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(VennDiagram) -library(data.table) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/venn/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -for (i in seq_len(ncol(data))) { - data[is.na(data[, i]), i] <- "" -} -raw <- data -data <- as.data.frame(raw[raw[, 1] != "", 1]) -colnames(data) <- colnames(raw)[1] -list.num <- 1 -for (i in 2:ncol(raw)) { - if (any(!is.na(raw[, i]) & raw[, i] != "")) { - tmp <- raw[i] - tmp <- tmp[tmp[, 1] != "", ] - tmp <- as.data.frame(tmp) - colnames(tmp) <- colnames(raw)[i] - assign(paste0("data", i), tmp) - list.num <- list.num + 1 - } -} -colnames(data) <- paste("V", seq_len(ncol(data)), sep = "") -colnames(data2) <- paste("V", seq_len(ncol(data2)), sep = "") -colnames(data3) <- paste("V", seq_len(ncol(data3)), sep = "") -colnames(data4) <- paste("V", seq_len(ncol(data4)), sep = "") -colnames(data5) <- paste("V", seq_len(ncol(data5)), sep = "") -data_list <- list( - n1 = data$V1, n2 = data2$V1, n3 = data3$V1, - n4 = data4$V1, n5 = data5$V1 -) -names(data_list) <- colnames(raw)[1:5] - -# View data -head(data) - -# Create visualization -# Venn -col <- c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF","#F39B7FFF") -p <- venn.diagram( - data_list, scaled = F, euler.d = F, filename = NULL, col = "black", - fill = col, - cex = c( - 1.5, 1.5, 1.5, 1.5, 1.5, 1, 0.8, 1, 0.8, 1, 0.8, 1, 0.8, -# ... (see full tutorial for more) -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/178-venn.html diff --git a/skills/Hiplot/179-venn2_skill.md b/skills/Hiplot/179-venn2_skill.md deleted file mode 100644 index 37e11af83f..0000000000 --- a/skills/Hiplot/179-venn2_skill.md +++ /dev/null @@ -1,53 +0,0 @@ -# Skill: Venn2 (R) - -## Category -Hiplot - -## When to Use -A Venn diagram is a diagramthat shows all possible logical relations between a finite collection of different sets. These diagrams depict elements as points in the plane, and sets as regions inside closed curves. A Venn diagram consists of multiple overlapping closed curves, usually circles, each representing a set. The points inside a curve labelled S represent elements of the set S, while points outside the boundary represent elements not in the set S. This lends to easily read visualizatio... - -## Required R Packages -- data.table -- jsonlite -- venn - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(jsonlite) -library(venn) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/venn2/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data_venn <- as.list(data) -data_venn <- lapply(data_venn, function(x) { - x[is.na(x)] <- "" - x <- x[x != ""] - return(x) -}) - -# View data -head(data) - -# Create visualization -# Venn2 -col <- c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF","#F39B7FFF") -venn(x=data_venn, opacity=0.8, ggplot=F, ilabels = TRUE, zcolor=col, box=F) -title(main = "Vene Plot (5 sets)", line = -1) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/179-venn2.html diff --git a/skills/Hiplot/180-violin-group_skill.md b/skills/Hiplot/180-violin-group_skill.md deleted file mode 100644 index b5bd9b67ed..0000000000 --- a/skills/Hiplot/180-violin-group_skill.md +++ /dev/null @@ -1,70 +0,0 @@ -# Skill: Violin Group (R) - -## Category -Hiplot - -## When to Use -Violin and box plot of grouped data with T-test. - -## Required R Packages -- data.table -- ggpubr -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggpubr) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/violin-group/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data[, 3] <- factor(data[, 3], levels = unique(data[, 3])) - -# View data -head(data) - -# Create visualization -# Violin Group -p <- ggviolin(data, x = "Group1", y = "Value", color = "Group2", add = "dotplot", - add.params = list(fill = "white",size = 1), title = "Violin Diagram", - xlab = "Group1", ylab = "Value", fill = "Group2", - palette = c("#374E55FF", "#DF8F44FF"), alpha = 0.5, trim = F) + - stat_compare_means(aes(group = data[, colnames(data)[3]]), - method = "t.test", vjust = -6, label.x.npc = "left", label.y.npc = "top", - tip.length = 0.03, bracket.size = 0.3, step.increase = 0, position = "identity", - na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, geom = "text") + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `group`: Maps `data` to the group aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/180-violin-group.html diff --git a/skills/Hiplot/181-violin_skill.md b/skills/Hiplot/181-violin_skill.md deleted file mode 100644 index cedb5d8f61..0000000000 --- a/skills/Hiplot/181-violin_skill.md +++ /dev/null @@ -1,73 +0,0 @@ -# Skill: Violin (R) - -## Category -Hiplot - -## When to Use -The violin plot, named for its resemblance to a violin, is a statistical diagram combining a box diagram with a kernel density diagram to show the distribution of data and the probability density. - -## Required R Packages -- data.table -- ggpubr -- ggthemes -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggpubr) -library(ggthemes) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/violin/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -groups <- unique(data[, 2]) -ngroups <- length(groups) -comb <- combn(1:ngroups, 2) -my_comparisons <- list() -for (i in seq_len(ncol(comb))) { - my_comparisons[[i]] <- groups[comb[, i]] -} - -# View data -head(data) - -# Create visualization -# Violin -p <- ggviolin(data, x = "Tumor", y = "Expresssion", fill = "Tumor", add = "boxplot", - xlab = "Tumor", ylab = "Expresssion", - add.params = list(fill = "white"), - palette = c("#e04d39","#5bbad6","#1e9f86"), - title = "Violin Plot", alpha = 1) + - stat_compare_means(comparisons = my_comparisons, label = "p.signif") + - theme_stata() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_stata()` - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/181-violin.html diff --git a/skills/Hiplot/182-visdat_skill.md b/skills/Hiplot/182-visdat_skill.md deleted file mode 100644 index 35f4b675f4..0000000000 --- a/skills/Hiplot/182-visdat_skill.md +++ /dev/null @@ -1,74 +0,0 @@ -# Skill: Visdat (R) - -## Category -Hiplot - -## When to Use -Create a Visdat using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- dplyr -- ggplot2 -- jsonlite -- patchwork -- visdat - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(dplyr) -library(ggplot2) -library(jsonlite) -library(patchwork) -library(visdat) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/visdat/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Visdat -add_palette <- function (p) { - ## add color palette - p <- p + scale_fill_manual(values = c("#3B4992FF", "#EE0000FF")) -} -pobj <- list() -pobj[["p1"]] <- add_palette(vis_dat(data)) + ggtitle(':vis_dat') -pobj[["p2"]] <- add_palette(vis_guess(data)) + ggtitle(':vis_guess') -pobj[["p3"]] <- vis_miss(data, cluster = T, sort_miss = T) + ggtitle(':vis_miss') -pobj[["p4"]] <- add_palette(vis_expect(data, ~.x >= 20 )) + ggtitle(':vis_expect') -pobj[["p5"]] <- vis_cor(data) + - scale_fill_gradientn(colours = c("#0571B0", "#92C5DE", "#F4A582", "#CA0020")) + - ggtitle(':vis_cor') -pobj[["p6"]] <- data %>% - select_if(is.numeric) %>% - vis_value() + ggtitle(':vis_value') -pobj[["p6"]] <- pobj[["p6"]] + - scale_fill_gradientn(colours = c("#0571B0","#92C5DE","#F7F7F7","#F4A582", - "#CA0020")) - -pstr <- paste0(sprintf("pobj[[%s]]", 1:length(pobj)), collapse = " + ") -p <- eval(parse(text = - sprintf("%s + plot_layout(ncol = 2) + -plot_annotation(tag_levels = 'A')", pstr))) - -p -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/182-visdat.html diff --git a/skills/Hiplot/183-volcano_skill.md b/skills/Hiplot/183-volcano_skill.md deleted file mode 100644 index a4c16654d9..0000000000 --- a/skills/Hiplot/183-volcano_skill.md +++ /dev/null @@ -1,80 +0,0 @@ -# Skill: Volcano (R) - -## Category -Hiplot - -## When to Use -The volcanogram is a visual representation of the difference in gene expression between two samples. - -## Required R Packages -- data.table -- ggpubr -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggpubr) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/volcano/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -## Perform log10 transformation on the difference p (adj.P.Val column) -data[, "logP"] <- -log10(as.numeric(data[, "P.Value"])) -data[, "logFC"] <- as.numeric(data[, "logFC"]) -## Add a new column Group -data[, "Group"] <- "not-significant" -## Up and down -data$Group[which((data[, "P.Value"] < 0.05) & (data$logFC >= 2))] <- "Up-regulated" -data$Group[which((data[, "P.Value"] < 0.05) & (data$logFC <= 2 * -1))] <- "Down-regulated" -## Add a new column Label -data[["Label"]] <- "" -## Sort the p-values of differentially expressed genes from small to large -data <- data[order(data[, "P.Value"]), ] -## Among the highly expressed genes, select the 10 with the smallest adj.P.Val -up_genes <- head(data[, "Symbol"][which(data$Group == "Up-regulated")], 10) -down_genes <- head(data[, "Symbol"][which(data$Group == "Down-regulated")], 10) -not_sig_genes <- NA -## Merge up_genes and down_genes and add them to Label -deg_top_genes <- c(as.character(up_genes), as.character(not_sig_genes), -as.character(down_genes)) -deg_top_genes <- deg_top_genes[!is.na(deg_top_genes)] -data$Label[match(deg_top_genes, data[, "Symbol"])] <- deg_top_genes - -# View data -head(data) - -# Create visualization -# Volcano -options(ggrepel.max.overlaps = 100) -p <- ggscatter(data, x = "logFC", y = "logP", color = "Group", - palette = c("#2f5688", "#BBBBBB", "#CC0000"), size = 1, - alpha = 0.5, font.label = 8, repel = TRUE, label=data$Label, - xlab = "log2(Fold Change)", ylab = "-log10(P Value)", - show.legend.text = FALSE) + - ggtitle("Volcano Plot") + - geom_hline(yintercept = -log(0.05, 10), linetype = "dashed") + - geom_vline(xintercept = c(2, -2), linetype = "dashed") + - theme_bw() + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), -# ... (see full tutorial for more) -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/183-volcano.html diff --git a/skills/Hiplot/184-waffle_skill.md b/skills/Hiplot/184-waffle_skill.md deleted file mode 100644 index 3ffbaf3b66..0000000000 --- a/skills/Hiplot/184-waffle_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Waffle Plot (R) - -## Category -Hiplot - -## When to Use -Create a Waffle Plot using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output. - -## Required R Packages -- data.table -- jsonlite -- waffle - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(jsonlite) -library(waffle) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/waffle/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -parts <- data[,2] - -# View data -head(data) - -# Create visualization -# Waffle Plot -p <- waffle(parts, rows = 8, size = 1, legend_pos = "right") + - ggtitle("Waffle Plot") + - scale_fill_manual(values = c("#e04d39","#5bbad6","#1e9f86")) + - theme(text = element_text(family = "Arial"), - plot.title = element_text(size = 12,hjust = 0.5), - axis.title = element_text(size = 12), - axis.text = element_text(size = 10), - axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1), - legend.position = "right", - legend.direction = "vertical", - legend.title = element_text(size = 10), - legend.text = element_text(size = 10)) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/184-waffle.html diff --git a/skills/Hiplot/185-waterfalls-plot_skill.md b/skills/Hiplot/185-waterfalls-plot_skill.md deleted file mode 100644 index d21c583e6d..0000000000 --- a/skills/Hiplot/185-waterfalls-plot_skill.md +++ /dev/null @@ -1,56 +0,0 @@ -# Skill: Waterfalls Plot2 (R) - -## Category -Hiplot - -## When to Use -Used to visualize changes in data, with the difference from version 1 being the ability to customize the colors for upward and downward values. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite -- waterfalls - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) -library(waterfalls) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/waterfalls-plot/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# convert data structure -data[["name"]] <- factor(data[["name"]], levels = data[["name"]]) -data$fill <- ifelse(data$value > 0, "#B71C1C", "#1B5E20") - -# View data -head(data) - -# Create visualization -# Waterfalls Plot2 -p <- waterfall(data, calc_total = T, rect_width = 0.7, fill_by_sign = F, - fill_colours = data$fill, total_rect_color = "#1E065D") + - theme_bw() - -p -``` - -## Key Parameters -- `width`: Controls element width -- `theme`: Plot theme; tutorial uses `theme_bw()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/185-waterfalls-plot.html diff --git a/skills/Hiplot/186-waterfalls_skill.md b/skills/Hiplot/186-waterfalls_skill.md deleted file mode 100644 index 4da3a86862..0000000000 --- a/skills/Hiplot/186-waterfalls_skill.md +++ /dev/null @@ -1,62 +0,0 @@ -# Skill: Waterfalls (R) - -## Category -Hiplot - -## When to Use -The waterfall chart is used to display the cumulative effect of sequentially introduced positive or negative values . These intermediate values can either be time based or category based. - -## Required R Packages -- data.table -- ggplot2 -- jsonlite -- waterfalls - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(jsonlite) -library(waterfalls) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/waterfalls/data.json")$exampleData$textarea[[1]]) -data <- as.data.frame(data) - -# View data -head(data) - -# Create visualization -# Waterfalls -p <- waterfall(data, rect_text_labels = data$value, rect_text_size = 1, - rect_text_labels_anchor = "centre", calc_total = T, - total_axis_text = "Total", total_rect_text = sum(data$value), - total_rect_color = "steelblue", total_rect_text_color = "black", - rect_width = 0.7, rect_border = "black", draw_lines = TRUE, - linetype = 2, fill_by_sign = F, - fill_colours = c("#E64B35FF","#4DBBD5FF","#00A087FF","#3C5488FF","#F39B7FFF", - "#8491B4FF"), - scale_y_to_waterfall = T) + - theme_bw() + - theme(axis.text = element_text(size = 12), - plot.title = element_text(hjust = 0.5)) + - labs(title = "Waterfalls Plot") - -p -``` - -## Key Parameters -- `width`: Controls element width -- `theme`: Plot theme; tutorial uses `theme_bw()` -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/186-waterfalls.html diff --git a/skills/Hiplot/187-pca_skill.md b/skills/Hiplot/187-pca_skill.md deleted file mode 100644 index 647445e670..0000000000 --- a/skills/Hiplot/187-pca_skill.md +++ /dev/null @@ -1,86 +0,0 @@ -# Skill: PCA (R) - -## Category -Hiplot - -## When to Use -Principal component analysis (PCA) is a data processing method with "dimension reduction" as the core, replacing multi-index data with a few comprehensive indicators (PCA), and restoring the most essential characteristics of data. - -## Required R Packages -- data.table -- ggplot2 -- ggpubr -- gmodels -- jsonlite - -## Minimal Reproducible Code -```r -# Load packages -library(data.table) -library(ggplot2) -library(ggpubr) -library(gmodels) -library(jsonlite) - -# Prepare data -# Load data -data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pca/data.json")$exampleData[[1]]$textarea[[1]]) -data <- as.data.frame(data) -group <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/pca/data.json")$exampleData[[1]]$textarea[[2]]) -group <- as.data.frame(group) - -# Convert data structure -rownames(data) <- data[, 1] -data <- as.matrix(data[, -1]) -pca_info <- fast.prcomp(data) -## Create configuration -conf <- list( - dataArg = list( - list(list(value = "group")), # Color by group - list(list(value = "")) # No shape group - ), - general = list( - title = "Principal Component Analysis", - palette = "Set1" - ) -) -## Perform PCA - Note: data must be transposed because PCA analyzes samples (columns) -pca_info <- prcomp(t(data), scale. = TRUE) -## Prepare plot data -axis <- sapply(conf$dataArg[[1]], function(x) x$value) -## Process color grouping -if (is.null(axis[1]) || axis[1] == "") { - colorBy <- rep('ALL', ncol(data)) -} else { - ## Ensure sample order matches - colorBy <- group[match(colnames(data), group$sample), axis[1]] -} -colorBy <- factor(colorBy, levels = unique(colorBy)) -## Create PCA data frame -pca_data <- data.frame( - sample = rownames(pca_info$x), - PC1 = pca_info$x[, 1], - PC2 = pca_info$x[, 2], - colorBy = colorBy -) -## Calculate explained variance -variance_explained <- round(pca_info$sdev^2 / sum(pca_info$sdev^2) * 100, 1) -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `PC1` to the x aesthetic -- `y`: Maps `PC2` to the y aesthetic -- `color`: Maps `colorBy` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Hiplot/187-pca.html diff --git a/skills/Julia/Heatmap_skill.md b/skills/Julia/Heatmap_skill.md deleted file mode 100644 index 7d852484cb..0000000000 --- a/skills/Julia/Heatmap_skill.md +++ /dev/null @@ -1,53 +0,0 @@ -# Skill: Heatmap (Julia) - -## Category -Julia - -## When to Use -A heatmap visualizes matrix data using color gradients. Julia's `CairoMakie` provides high-performance heatmap rendering suitable for large gene expression matrices and multi-omics data. The Makie ecosystem supports annotations, clustering, and complex layouts for publication-quality figures. - -## Required Julia Packages -- CairoMakie - -## Minimal Reproducible Code -```julia -# Load packages -using CairoMakie -using Random - -# Prepare data -Random.seed!(42) -n_genes = 20 -n_samples = 10 -expr_matrix = randn(n_genes, n_samples) -expr_matrix[1:8, 1:5] .+= 2.5 -expr_matrix[9:15, 6:10] .+= 2.0 -gene_names = ["Gene_$i" for i in 1:n_genes] -sample_names = ["S$i" for i in 1:n_samples] - -# Create visualization -fig = Figure(size=(700, 600)) -ax = Axis(fig[1,1], xlabel="Samples", ylabel="Genes", - title="Gene Expression Heatmap", - xticks=(1:n_samples, sample_names), - yticks=(1:n_genes, gene_names)) -hm = heatmap!(ax, 1:n_samples, 1:n_genes, expr_matrix', - colormap=:RdBu, colorrange=(-3, 3)) -Colorbar(fig[1,2], hm, label="Expression (z-score)") -fig -``` - -## Key Parameters -- `colormap`: Color scheme for the plot (e.g., :viridis, :RdBu) -- `color`: Color of plot elements (e.g., :steelblue or (:red, 0.5) for alpha) -- `colorrange`: Range for color mapping as (min, max) tuple -- `size`: Figure size as (width, height) in pixels -- `alpha`: Transparency via color tuple syntax: color=(:steelblue, 0.7) - -## Tips -- Save figures with `save("plot.png", fig)` or `save("plot.pdf", fig)` -- Adjust figure resolution with `Figure(size=(800, 600), figure_padding=20)` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Julia/Heatmap.html diff --git a/skills/Julia/ScatterPlot_skill.md b/skills/Julia/ScatterPlot_skill.md deleted file mode 100644 index fcfe2a6fc5..0000000000 --- a/skills/Julia/ScatterPlot_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Scatter Plot (Julia) - -## Category -Julia - -## When to Use -A scatter plot displays values for two continuous variables as a collection of points. Julia's `CairoMakie` package (part of the Makie.jl ecosystem) provides high-performance, GPU-accelerated plotting capabilities ideal for large biomedical datasets. Makie offers publication-quality rendering with a composable, declarative API. - -## Required Julia Packages -- CairoMakie -- DataFrames - -## Minimal Reproducible Code -```julia -# Load packages -using CairoMakie -using DataFrames -using Random - -# Prepare data -Random.seed!(42) -n = 150 -species = repeat(["setosa", "versicolor", "virginica"], inner=50) -sepal_length = [randn(50) .* 0.35 .+ 5.0; - randn(50) .* 0.52 .+ 5.9; - randn(50) .* 0.64 .+ 6.6] -sepal_width = [randn(50) .* 0.38 .+ 3.4; - randn(50) .* 0.31 .+ 2.8; - randn(50) .* 0.32 .+ 3.0] -iris_df = DataFrame(species=species, sepal_length=sepal_length, sepal_width=sepal_width) - -# Create visualization -fig = Figure(size=(700, 500)) -ax = Axis(fig[1,1], xlabel="Sepal Length (cm)", ylabel="Sepal Width (cm)", - title="Iris Scatter Plot") -colors_map = Dict("setosa" => :steelblue, "versicolor" => :coral, "virginica" => :green) -for sp in unique(iris_df.species) - mask = iris_df.species .== sp - scatter!(ax, iris_df.sepal_length[mask], iris_df.sepal_width[mask], - color=colors_map[sp], markersize=10, alpha=0.7, label=sp) -end -axislegend(ax, position=:rt) -fig -``` - -## Key Parameters -- `colormap`: Color scheme for the plot (e.g., :viridis, :RdBu) -- `markersize`: Size of scatter plot markers -- `color`: Color of plot elements (e.g., :steelblue or (:red, 0.5) for alpha) -- `linewidth`: Width of lines in the plot -- `alpha`: Transparency level (0–1) via color tuple (color, alpha) -- `width`: Width of violin or box plot elements -- `size`: Figure size as (width, height) in pixels - -## Tips -- Save figures with `save("plot.png", fig)` or `save("plot.pdf", fig)` -- Adjust figure resolution with `Figure(size=(800, 600), figure_padding=20)` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Julia/ScatterPlot.html diff --git a/skills/Julia/ViolinPlot_skill.md b/skills/Julia/ViolinPlot_skill.md deleted file mode 100644 index 4c3b4fdc39..0000000000 --- a/skills/Julia/ViolinPlot_skill.md +++ /dev/null @@ -1,55 +0,0 @@ -# Skill: Violin Plot (Julia) - -## Category -Julia - -## When to Use -A violin plot combines box plot statistics with kernel density estimation to show data distributions. Julia's `CairoMakie` makes it straightforward to create violin plots for comparing gene expression, biomarker levels, or clinical measurements across groups. - -## Required Julia Packages -- CairoMakie -- DataFrames - -## Minimal Reproducible Code -```julia -# Load packages -using CairoMakie -using DataFrames -using Random - -# Prepare data -Random.seed!(42) -n_per = 80 -groups = vcat(fill("Tumor", n_per), fill("Normal", n_per), fill("Adjacent", n_per)) -expression = vcat( - randn(n_per) .* 1.5 .+ 8, - randn(n_per) .* 1.2 .+ 5, - randn(n_per) .* 1.8 .+ 6.5 -) -group_idx = vcat(fill(1, n_per), fill(2, n_per), fill(3, n_per)) -df = DataFrame(Group=groups, Expression=expression, GroupIdx=group_idx) - -# Create visualization -fig = Figure(size=(700, 500)) -ax = Axis(fig[1,1], xlabel="Group", ylabel="Expression Level", - title="Gene Expression Distribution", - xticks=(1:3, ["Tumor", "Normal", "Adjacent"])) -violin!(ax, df.GroupIdx, df.Expression, color=(:steelblue, 0.7)) -fig -``` - -## Key Parameters -- `markersize`: Size of scatter plot markers -- `color`: Color of plot elements (e.g., :steelblue or (:red, 0.5) for alpha) -- `side`: Side of violin to draw (:left, :right, or both) -- `width`: Width of violin or box plot elements -- `size`: Figure size as (width, height) in pixels -- `alpha`: Transparency via color tuple syntax: color=(:steelblue, 0.7) - -## Tips -- Save figures with `save("plot.png", fig)` or `save("plot.pdf", fig)` -- Adjust figure resolution with `Figure(size=(800, 600), figure_padding=20)` -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Julia/ViolinPlot.html diff --git a/skills/Misc/About_skill.md b/skills/Misc/About_skill.md deleted file mode 100644 index 6aae3d2863..0000000000 --- a/skills/Misc/About_skill.md +++ /dev/null @@ -1,24 +0,0 @@ -# Skill: About Us (R) - -## Category -Misc - -## When to Use -Create a About Us visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- (see tutorial) - -## Minimal Reproducible Code -(See full tutorial for code) - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/About.html diff --git a/skills/Misc/GraphGallery_skill.md b/skills/Misc/GraphGallery_skill.md deleted file mode 100644 index eb86beb92d..0000000000 --- a/skills/Misc/GraphGallery_skill.md +++ /dev/null @@ -1,37 +0,0 @@ -# Skill: Graph Gallery (R) - -## Category -Misc - -## When to Use -👋 **Bizard** is a comprehensive repository of advanced visualization codes tailored for biomedical research. It currently includes approximately 750 graphics across more than 65 chart types. Below is the gallery for all graphics. - -## Required R Packages -- crosstalk -- dplyr -- htmltools -- jsonlite -- reactable - -## Minimal Reproducible Code -```r -library(reactable) -library(jsonlite) -library(dplyr) -library(crosstalk) -library(htmltools) - -data <- read.csv("files/gallery_data.csv") -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/GraphGallery.html diff --git a/skills/Misc/Skills_skill.md b/skills/Misc/Skills_skill.md deleted file mode 100644 index 49e8637964..0000000000 --- a/skills/Misc/Skills_skill.md +++ /dev/null @@ -1,24 +0,0 @@ -# Skill: Bizard Skills (R) - -## Category -Misc - -## When to Use -Create a Bizard Skills visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- (see tutorial) - -## Minimal Reproducible Code -(See full tutorial for code) - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Skills.html diff --git a/skills/Omics/CellChatCirclePlot_skill.md b/skills/Omics/CellChatCirclePlot_skill.md deleted file mode 100644 index 7e9e2440ef..0000000000 --- a/skills/Omics/CellChatCirclePlot_skill.md +++ /dev/null @@ -1,85 +0,0 @@ -# Skill: Cell-Cell Communication Circle Plot (R) - -## Category -Omics - -## When to Use -The Cell-Cell Communication Circle Plot (细胞-细胞通讯网络圈图) is a specialized visualization for depicting intercellular signaling interactions inferred from single-cell RNA sequencing (scRNA-seq) data. Using the **CellChat** R package, this plot presents a circular network where nodes represent cell populations (cell types or clusters) and directed edges indicate the strength and direction of ligand-receptor communication signals between them. - -## Required R Packages -- BiocManager -- CellChat -- Seurat -- circlize -- ggplot2 -- igraph -- remotes - -## Minimal Reproducible Code -```r -# Load packages -library(BiocManager) -library(CellChat) -library(Seurat) -library(circlize) -library(ggplot2) -library(igraph) - -# Prepare data -# Simulate a communication count/weight matrix -# In real use, these come from cellchat@net$count and cellchat@net$weight - -set.seed(42) -cell_types <- c("CD4 T", "CD8 T", "NK", "B cell", "Monocyte", - "DC", "Fibroblast", "Epithelial", "Endothelial") -n <- length(cell_types) - -net_count <- matrix(sample(0:50, n * n, replace = TRUE), n, n, - dimnames = list(cell_types, cell_types)) -net_weight <- matrix(runif(n * n, 0, 1), n, n, - dimnames = list(cell_types, cell_types)) -diag(net_count) <- 0 # remove self-communication -diag(net_weight) <- 0 - -# Group size (proportional to number of cells per type, simulated) -group_size <- sample(50:500, n, replace = TRUE) -names(group_size) <- cell_types - -cat("Simulated", n, "cell types with", sum(net_count), "total interactions\n") -print(net_count) - -# Create visualization -par(mfrow = c(1, 2), xpd = TRUE) - -# Panel A: Number of interactions -netVisual_circle( - net_count, - vertex.weight = group_size, - weight.scale = TRUE, - label.edge = FALSE, - title.name = "Number of interactions" -) - -# Panel B: Interaction strength (weights) -netVisual_circle( - net_weight, - vertex.weight = group_size, - weight.scale = TRUE, - label.edge = FALSE, - title.name = "Interaction weights/strength" -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `Receiver` to the x aesthetic -- `y`: Maps `Sender` to the y aesthetic -- `fill`: Maps `Weight` to the fill aesthetic -- `width`: Controls element width - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/CellChatCirclePlot.html diff --git a/skills/Omics/ChromosomePlot_skill.md b/skills/Omics/ChromosomePlot_skill.md deleted file mode 100644 index 56321f2fcc..0000000000 --- a/skills/Omics/ChromosomePlot_skill.md +++ /dev/null @@ -1,40 +0,0 @@ -# Skill: Chromosome Plot (R) - -## Category -Omics - -## When to Use -An chromosome plot (ideogram) is a graphical tool used to visualize chromosome structure and various genomic features on chromosomes. It typically represents each chromosome individually, drawing the length and structures such as the centromere to scale. Additionally, it can annotate multiple types of information on the chromosomes, including gene density, genetic variations, expression levels, repetitive sequences, and functional markers. - -## Required R Packages -- RIdeogram - -## Minimal Reproducible Code -```r -# Load packages -library(RIdeogram) - -# Prepare data -data(human_karyotype, package="RIdeogram") -data(gene_density, package="RIdeogram") -data(Random_RNAs_500, package="RIdeogram") - -# Create visualization -# Basic Chromosome Plot -ideogram(karyotype = human_karyotype) -convertSVG("chromosome.svg", device = "png") -``` - -## Key Parameters -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/ChromosomePlot.html diff --git a/skills/Omics/CollinearityPlot_skill.md b/skills/Omics/CollinearityPlot_skill.md deleted file mode 100644 index dfb9b88041..0000000000 --- a/skills/Omics/CollinearityPlot_skill.md +++ /dev/null @@ -1,37 +0,0 @@ -# Skill: Collinearity Plot (R) - -## Category -Omics - -## When to Use -Collinearity plot is often used to compare genome sequences of different species, identify conserved homologous gene blocks and their arrangement order, and reveal changes in chromosome structure during evolution. This plot is widely used in the study of genome evolution, functional gene localization, and species relationship analysis. - -## Required R Packages -- RIdeogram - -## Minimal Reproducible Code -```r -# Load packages -library(RIdeogram) - -# Prepare data -data(karyotype_ternary_comparison, package="RIdeogram") -data(synteny_ternary_comparison, package="RIdeogram") - -# Create visualization -# Basic Collinearity Plot -ideogram(karyotype = karyotype_ternary_comparison, synteny = synteny_ternary_comparison) -convertSVG("chromosome.svg", device = "png") -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/CollinearityPlot.html diff --git a/skills/Omics/GeneStructurePlot_skill.md b/skills/Omics/GeneStructurePlot_skill.md deleted file mode 100644 index dd9f3a3315..0000000000 --- a/skills/Omics/GeneStructurePlot_skill.md +++ /dev/null @@ -1,47 +0,0 @@ -# Skill: Gene Structure Plot (R) - -## Category -Omics - -## When to Use -In biology, especially in molecular biology research, analyzing the expression and regulation patterns of genes has always been a research focus. In this process, it is inevitable that there will be a need to draw the structure of a gene or the upstream and downstream relationships. Therefore, this tutorial will summarize some common gene structure drawing methods based on the R package gggenes. - -## Required R Packages -- gggenes -- ggtree -- tidyverse - -## Minimal Reproducible Code -```r -# Load packages -library(gggenes) -library(ggtree) -library(tidyverse) - -# Prepare data -head(example_genes) - -# Create visualization -# Plotting the relative positions of a series of genes -ggplot(example_genes, aes(xmin = start, xmax = end, y = molecule)) + - geom_gene_arrow() + - facet_wrap(~ molecule, scales = "free", ncol = 1) # gggenes is usually used with the facet_wrap function for faceting. It should be noted that if the drawing interface is too small, an error message will be displayed: "Viewport has zero dimension(s)". Just enlarge the drawing window or set a larger interface. -``` - -## Key Parameters -- `y`: Maps `molecule` to the y aesthetic -- `fill`: Maps `gene` to the fill aesthetic -- `x`: Maps `position` to the x aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_genes()` - -## Tips -- The tutorial includes a '2. Beautification' section with advanced styling options -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/GeneStructurePlot.html diff --git a/skills/Omics/GwasSnpPlot_skill.md b/skills/Omics/GwasSnpPlot_skill.md deleted file mode 100644 index 13493fabb0..0000000000 --- a/skills/Omics/GwasSnpPlot_skill.md +++ /dev/null @@ -1,54 +0,0 @@ -# Skill: GWAS Circos Plot (R) - -## Category -Omics - -## When to Use -The visualization of Genome-Wide Association Study (GWAS) results mainly includes SNP circular plots displayed by chromosome positions, SNP density plots, Manhattan plots for significance screening, QQ plots comparing the distribution of observed p-values with expected p-values, etc., which are used to screen candidate variant genes at the genome-wide level. - -## Required R Packages -- CMplot - -## Minimal Reproducible Code -```r -# Load packages -library(CMplot) - -# Prepare data -# Example data -data(pig60K) -data <- pig60K - -# Data preview -head(data, 5) - -# Create visualization -# SNP screening genome circular map -CMplot( - data, - type = "p", - plot.type = "c", - chr.labels = paste("Chr", c(1:18, "X", "Y"), sep = ""), - r = 8, - cir.axis = TRUE, - outward = TRUE, - cir.axis.col = "black", - cir.chr.h = 2, - chr.den.col = "black", - file.output = FALSE, - verbose = FALSE, - mar = c(0,0,0,0) -) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/GwasSnpPlot.html diff --git a/skills/Omics/KeggPathwayPlot_skill.md b/skills/Omics/KeggPathwayPlot_skill.md deleted file mode 100644 index 43b4607395..0000000000 --- a/skills/Omics/KeggPathwayPlot_skill.md +++ /dev/null @@ -1,48 +0,0 @@ -# Skill: KEGG Pathway Plot (R) - -## Category -Omics - -## When to Use -Create a KEGG Pathway Plot visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- dbplyr -- pathview - -## Minimal Reproducible Code -```r -# Load packages -library(dbplyr) -library(pathview) - -# Prepare data -data("gse16873.d") -head(gse16873.d) -gene_data <- as.data.frame(gse16873.d) -head(gene_data) - -# Create visualization -p1 <- pathview(gene.data = gse16873.d[, 1], # Input gene matrix - pathway.id = "04110", # Pathway ID - species = "hsa", # Species: Human - out.suffix = "gse16873_KEGG", # Output file suffix - kegg.native = T, # Output in original KEGG view - same.layer = T # Drawing a single layer - ) -p1 -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/KeggPathwayPlot.html diff --git a/skills/Omics/ManhattanPlot_skill.md b/skills/Omics/ManhattanPlot_skill.md deleted file mode 100644 index 14613ee928..0000000000 --- a/skills/Omics/ManhattanPlot_skill.md +++ /dev/null @@ -1,42 +0,0 @@ -# Skill: Manhattan Plot (R) - -## Category -Omics - -## When to Use -Manhattan plot is a graph used to describe the relationship between mutations on chromosomes and traits. It is named Manhattan plot because it resembles the urban landscape of Manhattan, USA. Manhattan plot is generally drawn in the form of scatter plot, but it can also be displayed in bar chart or line chart. It is usually drawn using R package qqman or directly using ggplot2. - -## Required R Packages -- aplot -- qqman -- tidyverse - -## Minimal Reproducible Code -```r -# Load packages -library(aplot) -library(qqman) -library(tidyverse) - -# Prepare data -# View the dataset -head(gwasResults) - -# Create visualization -# Basic manhattan plot -manhattan(gwasResults) -``` - -## Key Parameters -- `x`: Maps `BP` to the x aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_bw()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/ManhattanPlot.html diff --git a/skills/Omics/MotifPlot_skill.md b/skills/Omics/MotifPlot_skill.md deleted file mode 100644 index fc16cc27e6..0000000000 --- a/skills/Omics/MotifPlot_skill.md +++ /dev/null @@ -1,55 +0,0 @@ -# Skill: Motif Plot (R) - -## Category -Omics - -## When to Use -For visualizing motif logos, ggseqlogo is an R package based on ggplot2 specifically designed for plotting logos from sequence motifs. Compared to other motif visualization tools, ggseqlogo boasts advantages such as concise syntax, flexible output formats, and full compatibility with the ggplot2 ecosystem. The package supports various sequence input formats, including position-frequency matrices (PFM), position-weight matrices (PWM), and sequence vectors, and provides rich customization optio... - -## Required R Packages -- cowplot -- ggplot2 -- ggseqlogo -- gridExtra - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(ggplot2) -library(ggseqlogo) -library(gridExtra) - -# Prepare data -data(ggseqlogo_sample) - -head(pfms_dna,n = 1) - -head(seqs_aa, n = 1)[[1]][1:3] - -# Create visualization -# Using sequence vectors -ggseqlogo(seqs_dna$MA0001.1) -# Using PFM matrix -ggseqlogo(pfms_dna$MA0018.2) -# Plotting using ggplot syntax -ggplot() + geom_logo( seqs_dna$MA0001.1 ) + theme_logo() -``` - -## Key Parameters -- `color`: Maps `mut` to the color aesthetic -- `size`: Maps `mut` to the size aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_logo()` - -## Tips -- The tutorial includes a '3. Motif plot beautify' section with advanced styling options -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/MotifPlot.html diff --git a/skills/Omics/MultiSeqsAlignment_skill.md b/skills/Omics/MultiSeqsAlignment_skill.md deleted file mode 100644 index 70550ac12f..0000000000 --- a/skills/Omics/MultiSeqsAlignment_skill.md +++ /dev/null @@ -1,53 +0,0 @@ -# Skill: Multiple Sequences Alignment (R) - -## Category -Omics - -## When to Use -Multiple Sequence Alignment (MSA) is a fundamental and crucial technique in bioinformatics. It is used to align three or more biological sequences (DNA, RNA, or proteins) based on their evolutionary or structural similarities, so that homologous sites (i.e., sites derived from a common ancestor) are aligned as much as possible. - -## Required R Packages -- ggmsa - -## Minimal Reproducible Code -```r -# Load packages -library(ggmsa) - -# Prepare data -# Example data -protein_fasta <- system.file("extdata", "sample.fasta", package = "ggmsa") - -# Data preview -seqs <- readLines(protein_fasta) -head(seqs) - -# Create visualization -# Multiple sequence alignment of proteins -p <- ggmsa( - protein_fasta, - start = 300, - end = 330, - font = "DroidSansMono", - color = "Chemistry_AA", - char_width = 0.5, - seq_name = TRUE, - consensus_views = FALSE -) - -p -``` - -## Key Parameters -- `width`: Controls element width -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/MultiSeqsAlignment.html diff --git a/skills/Omics/MultiVolcanoPlot_skill.md b/skills/Omics/MultiVolcanoPlot_skill.md deleted file mode 100644 index 26cc860344..0000000000 --- a/skills/Omics/MultiVolcanoPlot_skill.md +++ /dev/null @@ -1,53 +0,0 @@ -# Skill: Multiple Volcano Plot (R) - -## Category -Omics - -## When to Use -Multiple Volcano Plot is a graph used for differential expression analysis of high-throughput data (such as transcriptomes and proteomes). Compared with the traditional volcano plot, the multi-group volcano plot can display the results of multiple groups at the same time, making it easier to compare the consistency or specificity of differential features horizontally. - -## Required R Packages -- corrplot -- scRNAtoolVis - -## Minimal Reproducible Code -```r -# Load packages -library(corrplot) -library(scRNAtoolVis) - -# Prepare data -# Load data -data('pbmc.markers') -# View data -head(pbmc.markers) - -# Create visualization -# Basic Multiple Volcano Plot -p <- jjVolcano( - diffData = pbmc.markers, - topGeneN = 5, - log2FC.cutoff = 0.5, - col.type = "updown", - aesCol = c('#0099CC','#CC3333'), - tile.col = corrplot::COL2('PuOr', 15)[4:12], - cluster.order = rev(unique(pbmc.markers$cluster)), - size = 3.5, - fontface = 'italic' - ) - -p -``` - -## Key Parameters -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/MultiVolcanoPlot.html diff --git a/skills/Omics/NetworkPlot_skill.md b/skills/Omics/NetworkPlot_skill.md deleted file mode 100644 index 71e1ae2276..0000000000 --- a/skills/Omics/NetworkPlot_skill.md +++ /dev/null @@ -1,48 +0,0 @@ -# Skill: Network Plot (R) - -## Category -Omics - -## When to Use -In microbiome research, it is crucial to understand the interactions between microorganisms. Network analysis is a powerful method that can help us visualize and quantify these complex relationships. Next, we will introduce the network operation and annotation functions of the `MetaNet` package, which can make our network analysis more in-depth and intuitive. - -## Required R Packages -- MetaNet -- dplyr -- igraph -- pcutils - -## Minimal Reproducible Code -```r -# Load packages -library(MetaNet) -library(dplyr) -library(igraph) -library(pcutils) - -# Prepare data -data(otutab, package = "pcutils") -t(otutab) -> totu -c_net_calculate(totu, method = "spearman") -> corr -c_net_build(corr, r_threshold = 0.6, p_threshold = 0.05, delete_single = T) -> co_net -class(co_net) - -# Create visualization -# Basic Network -data("multi_test", package = "MetaNet") -data("c_net", package = "MetaNet") -multi1 <- multi_net_build(list(Microbiome = micro, Metabolome = metab, Transcriptome = transc)) -plot(multi1) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/NetworkPlot.html diff --git a/skills/Omics/PopulationMapPlot_skill.md b/skills/Omics/PopulationMapPlot_skill.md deleted file mode 100644 index f92e96df99..0000000000 --- a/skills/Omics/PopulationMapPlot_skill.md +++ /dev/null @@ -1,66 +0,0 @@ -# Skill: Population Map Plot (R) - -## Category -Omics - -## When to Use -Create a Population Map Plot visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- doParallel -- dplyr -- ggfx -- ggnewscale -- ggplot2 -- ggrepel -- ggspatial -- gstat -- rnaturalearth -- rnaturalearthdata -- sf -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(doParallel) -library(dplyr) -library(ggfx) -library(ggnewscale) -library(ggplot2) -library(ggrepel) - -# Prepare data -# Global geographic data -world <- ne_countries(scale = "medium", returnclass = "sf") -# Simulating epidemiological data -set.seed(123) -world$incidence <- runif(nrow(world), 0, 100) # Randomly generate incidence data - -# Create visualization -# Basic map of global disease incidence distribution -p1 <- ggplot(data = world) + - geom_sf(aes(fill = incidence)) + - scale_fill_viridis(option = "C") + - labs(title = "Global Disease Incidence", - fill = "Incidence Rate\n(per 100k)") - -p1 -``` - -## Key Parameters -- `fill`: Maps `incidence` to the fill aesthetic -- `color`: Maps `var1` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- The tutorial includes a '2. Advanced plot' section with advanced styling options -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/PopulationMapPlot.html diff --git a/skills/Omics/SankeyBubblePlot_skill.md b/skills/Omics/SankeyBubblePlot_skill.md deleted file mode 100644 index 1e391a9cf6..0000000000 --- a/skills/Omics/SankeyBubblePlot_skill.md +++ /dev/null @@ -1,86 +0,0 @@ -# Skill: Sankey Bubble plot (R) - -## Category -Omics - -## When to Use -Create a Sankey Bubble plot visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- ggalluvial -- patchwork -- readr -- tidyverse - -## Minimal Reproducible Code -```r -# Load packages -library(ggalluvial) -library(patchwork) -library(readr) -library(tidyverse) - -# Prepare data -# Load data -data <- read_tsv("files/DAVID.txt") - -# Add a new categorical column -get_category <- function(cat) { - if (grepl("BP", cat)) return("BP") - if (grepl("MF", cat)) return("MF") - if (grepl("CC", cat)) return("CC") - if (grepl("KEGG", cat)) return("KEGG") - return(NA) -} -data$MainCategory <- sapply(data$Category, get_category) - -# Remove SMART and NA -data2 <- data %>% - filter(!grepl("SMART", Category)) %>% - filter(!is.na(MainCategory)) - -# Sort each category and take the top 10 -topN <- function(data, n=10) { - data %>% - arrange(desc(Count), PValue) %>% - head(n) -} -result <- data2 %>% - group_by(MainCategory) %>% - group_modify(~topN(.x, 10)) %>% - ungroup() - -# KEGG pathway annotation -result <- result %>% - mutate( - Source = ifelse(MainCategory == "KEGG", "KEGG", "GO"), - KEGG_Group = case_when( - MainCategory == "KEGG" & str_detect(Term,"Neuro|synapse|neurodegeneration|Alzheimer|Parkinson|Prion") ~ "Nervous system", - MainCategory == "KEGG" & str_detect(Term, "Cytokine|inflammatory") ~ "Immune system", - MainCategory == "KEGG" & str_detect(Term, "Lipid|atherosclerosis") ~ "Lipid metabolism", - MainCategory == "KEGG" ~ "Other KEGG", - TRUE ~ NA_character_ - ), - GO_Group = ifelse(MainCategory != "KEGG", MainCategory, NA) - ) -alluvial_data <- result %>% -# ... (see full tutorial for more) -``` - -## Key Parameters -- `y`: Maps `1` to the y aesthetic -- `fill`: Maps `Group` to the fill aesthetic -- `x`: Maps `min` to the x aesthetic -- `size`: Maps `Count` to the size aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/SankeyBubblePlot.html diff --git a/skills/Omics/SyntenyBlocksPlot_skill.md b/skills/Omics/SyntenyBlocksPlot_skill.md deleted file mode 100644 index 34330116bc..0000000000 --- a/skills/Omics/SyntenyBlocksPlot_skill.md +++ /dev/null @@ -1,38 +0,0 @@ -# Skill: Synteny Blocks Plot (R) - -## Category -Omics - -## When to Use -Collinearity is widely used in the study of complex genomes. This tutorial, based on the R package syntR, summarizes the identification of shared collinearity blocks between two genetic maps, chromosomal rearrangements, and their mapping. - -## Required R Packages -- syntR - -## Minimal Reproducible Code -```r -# Load packages -library(syntR) - -# Prepare data -# load the example marker data -data(ann_pet_map) -head(ann_pet_map) - -# Create visualization -# Adjust the order of the graphs -plot_maps(map_df = map_list[[1]], map1_chrom_breaks = map_list[[2]], map2_chrom_breaks = map_list[[3]]) -``` - -## Key Parameters -- `stat`: Statistical transformation to use -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/SyntenyBlocksPlot.html diff --git a/skills/Omics/TextEnrichmentBarPlot_skill.md b/skills/Omics/TextEnrichmentBarPlot_skill.md deleted file mode 100644 index 8261412570..0000000000 --- a/skills/Omics/TextEnrichmentBarPlot_skill.md +++ /dev/null @@ -1,87 +0,0 @@ -# Skill: Text-Overlaid Enrichment Barplot (R) - -## Category -Omics - -## When to Use -The Text-Overlaid Enrichment Barplot is a visualization tool designed for the high-density display of functional enrichment analysis results (e.g., GO, KEGG). It typically maps enrichment significance (adjusted p-value) to the length of rounded bars and utilizes the internal space of the graphics to directly overlay annotations of pathway names and core gene lists. Additionally, it uses colored blocks and bubbles on the left side to distinguish functional categories and gene counts. - -## Required R Packages -- clusterProfiler -- ggprism -- gground -- org.Hs.eg.db -- tidyverse - -## Minimal Reproducible Code -```r -# Load packages -library(clusterProfiler) -library(ggprism) -library(gground) -library(org.Hs.eg.db) -library(tidyverse) - -# Prepare data -# 1. Read Data -raw_data <- read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/DAVID.txt") - -# 2. Data Cleaning -# Convert DAVID format to the standard format required for plotting -raw_data <- raw_data %>% - # 2.1 Extract Category Labels - mutate(Category = case_when( - grepl("BP_DIRECT", Category) ~ "BP", - grepl("CC_DIRECT", Category) ~ "CC", - grepl("MF_DIRECT", Category) ~ "MF", - grepl("KEGG_PATHWAY", Category) ~ "KEGG", - TRUE ~ "Other" - )) %>% - # Keep only GO and KEGG results - filter(Category %in% c("BP", "CC", "MF", "KEGG")) %>% - - # 2.2 Clean Pathway Names (Remove IDs, e.g., "GO:001~Name" -> "Name") - mutate(Description = sub("^.*~|.*:", "", Term)) %>% - - # 2.3 Rename Columns (Unified variable names for plotting code) - # FDR -> p.adjust (Significance) - # Genes -> geneID (Gene List) - rename( - p.adjust = FDR, - geneID = Genes - ) %>% - - # 2.4 Format Gene Lists (Replace commas with slashes) - mutate(geneID = gsub(", ", "/", geneID)) - -# Create visualization -# Define color palette -pal <- c('#eaa052', '#b74147', '#90ad5b', '#23929c') - -# Other recommended palettes -#pal <- c('#c3e1e6', '#f3dfb7', '#dcc6dc', '#96c38e') -#pal <- c('#7bc4e2', '#acd372', '#fbb05b', '#ed6ca4') - -# Adjust position parameters for left blocks in the simplified version -rect.data.simple <- rect.data %>% - mutate( -# ... (see full tutorial for more) -``` - -## Key Parameters -- `y`: Maps `Description` to the y aesthetic -- `x`: Maps `0` to the x aesthetic -- `fill`: Maps `Category` to the fill aesthetic -- `colour`: Maps `Category` to the colour aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_prism()` - -## Tips -- The tutorial includes a '2. Advanced Plotting (Detailed Version)' section with advanced styling options -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/TextEnrichmentBarPlot.html diff --git a/skills/Omics/VolcanoPlot_skill.md b/skills/Omics/VolcanoPlot_skill.md deleted file mode 100644 index e0bb7923c6..0000000000 --- a/skills/Omics/VolcanoPlot_skill.md +++ /dev/null @@ -1,83 +0,0 @@ -# Skill: Volcano Plot (R) - -## Category -Omics - -## When to Use -The volcano plot is used to compare the two groups and obtain the up-regulation/down-regulation between the two groups. The screening basis is the p value and FC value, which are converted to -logP value and log2(FC) value. The imported data can be the OTU table or ASV table of the microbiome, the table of transcriptome gene expression, or the features table of metabolomics and other multi-omics data. - -## Required R Packages -- ggrepel -- readxl -- tidyverse - -## Minimal Reproducible Code -```r -# Load packages -library(ggrepel) -library(readxl) -library(tidyverse) - -# Prepare data -# Load excel data -data <- read_excel("files/volcano.eg.xlsx") - -# Rename column names (handle special characters) -data <- data %>% - rename(log2FC = "log2 Ratio(WT0/LOG)", Pvalue = "Pvalue") -# Handle the case where the p-value is 0 (avoid calculating -Inf) -data <- data %>% - mutate(log10P = -log10(Pvalue + 1e-300)) # Make sure to handle the case where P=0 -# Convert to numeric type and handle values that fail to convert (such as invalid characters) -data <- data %>% - mutate( - log2FC = as.numeric(log2FC) # Values that fail the conversion become NA - ) - -# Find the original value that caused the conversion to fail -data %>% - filter(is.na(log2FC)) %>% - select(log2FC) # View the raw log2FC values for these lines -# Repair the data as needed (e.g. replace or remove outliers) -# Example: Replace "Inf" with an actual value or filter out -data <- data %>% - mutate( - log2FC = ifelse(log2FC == "Inf", 100, log2FC), # Adjust according to needs - log2FC = as.numeric(log2FC) - ) %>% - filter(!is.na(log2FC)) # Delete the rows that cannot be repaired - -# Defining significance (satisfying both P value < 0.05 and |log2FC| > 1) -# Define significance categories (upregulated, downregulated, not significant) -data <- data %>% - mutate( - significant = case_when( - Pvalue < 0.05 & log2FC > 2 ~ "Upregulated", # Up (red) - Pvalue < 0.05 & log2FC < -2 ~ "Downregulated", # Down (green) - TRUE ~ "Not significant" # Not significant (grey) - ) - ) - -# View data structure -head(data, 5) - -# Create visualization -# Basic volcano plot -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `log2FC` to the x aesthetic -- `color`: Maps `significant` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Omics/VolcanoPlot.html diff --git a/skills/Proportion/ArcDiagram_skill.md b/skills/Proportion/ArcDiagram_skill.md deleted file mode 100644 index e5e8440ae7..0000000000 --- a/skills/Proportion/ArcDiagram_skill.md +++ /dev/null @@ -1,87 +0,0 @@ -# Skill: Arc Diagram (R) - -## Category -Proportion - -## When to Use -The arc diagram is a diagram connected by arcs, showing the relationships between nodes. - -## Required R Packages -- colormap -- ggraph -- igraph -- patchwork -- tidyverse -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(colormap) -library(ggraph) -library(igraph) -library(patchwork) -library(tidyverse) -library(viridis) - -# Prepare data -# 1.Custom data -# `links` stores edge information, and `nodes` stores node information and node grouping information. -links <- data.frame( -source = c("A", "A", "A", "A", "B", "G", "G", "G", "G"), - target = c("B", "C", "D", "F", "E", "H", "I", "J", "F") -) -nodes <- data.frame( - point = c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J"), - groups = c( - "group-one", "group-one", "group-one", "group-one", "group-one", - "group-one", "group-two", "group-two", "group-two", "group-two" - ) -) - -head(links) -head(nodes) - -# 2.Researchers co-authored network -# Copy the link information to a txt file, read it, and draw the plot. -data_dif <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/Arc.txt", header = T, sep = " ") - -head(data_dif[,1:5]) - -# 3.PPI network node and edge data -# Read PPI network information downloaded from GitHub -data_ppi <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/string_interactions_short.tsv_1%20default%20edge.csv", header = TRUE) - -head(data_ppi[,c(9,3)]) - -# Create visualization -# Basic arc diagram -mygraph <- graph_from_data_frame(links, vertices = nodes) # Generate graph structure - -p <- ggraph(mygraph, layout = "linear") + - geom_edge_arc(edge_colour = "black", edge_alpha = 0.3, edge_width = 0.4) + - geom_node_point(color = "grey", size = 5) + - geom_node_text(aes(label = name), repel = FALSE, size = 6, nudge_y = -0.15) + - theme_void() + - theme( - legend.position = "none", - plot.margin = unit(rep(2, 4), "cm") -# ... (see full tutorial for more) -``` - -## Key Parameters -- `color`: Maps `as` to the color aesthetic -- `size`: Maps `n` to the size aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Proportion/ArcDiagram.html diff --git a/skills/Proportion/ChordDiagram_skill.md b/skills/Proportion/ChordDiagram_skill.md deleted file mode 100644 index 678d98a42f..0000000000 --- a/skills/Proportion/ChordDiagram_skill.md +++ /dev/null @@ -1,89 +0,0 @@ -# Skill: Chord Diagram (R) - -## Category -Proportion - -## When to Use -Chord diagrams can use connecting lines or bars to represent the relationships between different objects. The connections in a chord diagram directly show the relationships between different objects; the width of the connection is proportional to the strength of the relationship, and the color of the connection can represent another mapping of the relationship, such as the type of relationship. The size of the sectors in the diagram represents the measurement of the objects. - -## Required R Packages -- chorddiag -- circlize -- dplyr -- ggraph -- htmlwidgets -- igraph -- readr -- readxl -- tidygraph -- tidyverse -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(chorddiag) -library(circlize) -library(dplyr) -library(ggraph) -library(htmlwidgets) -library(igraph) - -# Prepare data -# TCGA-BRCA.star_counts.tsv -tcga_brca_star_counts <- readr::read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.star_counts.tsv") -target_ensembl_ids <- c("ENSG00000012048.23", # BRCA1 - "ENSG00000139618.16", # BRCA2 - "ENSG00000141736.14", # ERBB2 - "ENSG00000121879.6", # PIK3CA - "ENSG00000171862.11", # PTEN - "ENSG00000111537.5") # AKT1 -gene_data <- tcga_brca_star_counts[tcga_brca_star_counts$Ensembl_ID %in% target_ensembl_ids, ] -gene_data <- gene_data[,2:101] -gene_data_t <- t(gene_data) - -x <- c(gene_data_t[, 1], gene_data_t[, 3], gene_data_t[, 5]) -y <- c(gene_data_t[, 2], gene_data_t[, 4], gene_data_t[, 6]) -factor <- rep(c("a", "b", "c"), each = 100) -plot_data <- data.frame(x = x, y = y, factor = factor) - -# Berberine_new -berberine_blood_glucose <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/Berberine_new.csv") -berberine_blood_glucose <- berberine_blood_glucose %>% na.omit() - -blood_glucose_category <- function(value) { - if (value < 4.5) { - return("Low") - } else if (value >= 4.5 & value < 6.5) { - return("Normal") - } else if (value >= 6.5 & value <= 11.0) { - return("Slightly High") - } else { - return("High") - } -} - -berberine_blood_glucose$before_category <- sapply(berberine_blood_glucose$before, blood_glucose_category) -berberine_blood_glucose$after_category <- sapply(berberine_blood_glucose$after, blood_glucose_category) - -adj_matrix <- table(berberine_blood_glucose$before_category, berberine_blood_glucose$after_category) # Generate adjacency matrix -adj_matrix_df <- as.data.frame(as.table(adj_matrix)) - -adj_matrix_wide <- adj_matrix_df %>% - pivot_wider(names_from = Var2, values_from = Freq, values_fill = list(Freq = 0)) -# ... (see full tutorial for more) -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- The tutorial includes a '4. Highly customized chord diagrams' section with advanced styling options -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Proportion/ChordDiagram.html diff --git a/skills/Proportion/DicePlot_skill.md b/skills/Proportion/DicePlot_skill.md deleted file mode 100644 index 0d57c4ebf1..0000000000 --- a/skills/Proportion/DicePlot_skill.md +++ /dev/null @@ -1,82 +0,0 @@ -# Skill: Dice Plot (R) - -## Category -Proportion - -## When to Use -Dice plots are a visualization technique for representing high-dimensional categorical data. The ggdiceplot package provides ggplot2 extensions for creating dice-based visualizations where each dot position on a dice represents a specific categorical variable. This allows intuitive visualization of up to 6 categorical variables simultaneously using traditional dice patterns. Each dice position (1-6) represents a different category, with dots shown only when that category is present. - -## Required R Packages -- dplyr -- ggdiceplot -- ggplot2 - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggdiceplot) -library(ggplot2) - -# Prepare data -# Load sample data from package -data("sample_dice_miRNA", package = "ggdiceplot") -df_dice <- sample_dice_miRNA - -# View data structure -head(df_dice) - -# Check data dimensions -str(df_dice) - -# Create visualization -# Define colors for regulation direction -direction_colors <- c( - Down = "#2166ac", - Unchanged = "grey80", - Up = "#b2182b" -) - -# Create basic dice plot -p1 <- ggplot(df_dice, aes(x = miRNA, y = Compound)) + - geom_dice( - aes( - dots = Organ, - fill = direction, - width = 0.8, - height = 0.8 - ), - show.legend = TRUE, - ndots = length(levels(df_dice$Organ)), - x_length = length(levels(df_dice$miRNA)), - y_length = length(levels(df_dice$Compound)) - ) + - scale_fill_manual(values = direction_colors, name = "Regulation") + - theme_minimal() + - theme( - axis.text.x = element_text(angle = 0, hjust = 0.5), - axis.text.y = element_text(hjust = 1), - panel.grid = element_blank() - ) + - labs( - x = "miRNA", - y = "Compound" - ) - -# ... (see full tutorial for more) -``` - -## Key Parameters -- `x`: Maps `miRNA` to the x aesthetic -- `y`: Maps `Compound` to the y aesthetic -- `fill`: Maps `direction` to the fill aesthetic -- `width`: Controls element width -- `theme`: Plot theme; tutorial uses `theme_minimal()` - -## Tips -- The tutorial includes a '2. Advanced Dice Plot with Continuous Variables' section with advanced styling options -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` - -## Full Tutorial -https://openbiox.github.io/Bizard/Proportion/DicePlot.html diff --git a/skills/Proportion/EdgeBundling_skill.md b/skills/Proportion/EdgeBundling_skill.md deleted file mode 100644 index 019d496f36..0000000000 --- a/skills/Proportion/EdgeBundling_skill.md +++ /dev/null @@ -1,24 +0,0 @@ -# Skill: Hierarchical Edge Bundling (R) - -## Category -Proportion - -## When to Use -Create a Hierarchical Edge Bundling visualization in R for biomedical data analysis and research publications. - -## Required R Packages -- (see tutorial) - -## Minimal Reproducible Code -(See full tutorial for code) - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Proportion/EdgeBundling.html diff --git a/skills/Proportion/Network_skill.md b/skills/Proportion/Network_skill.md deleted file mode 100644 index de54cd2cc9..0000000000 --- a/skills/Proportion/Network_skill.md +++ /dev/null @@ -1,59 +0,0 @@ -# Skill: Network Graph (R) - -## Category -Proportion - -## When to Use -A network graph is a graphical model that resembles a network and consists of nodes and links, where links can be directed or undirected. - -## Required R Packages -- RColorBrewer -- cowplot -- igraph -- networkD3 - -## Minimal Reproducible Code -```r -# Load packages -library(RColorBrewer) -library(cowplot) -library(igraph) -library(networkD3) - -# Prepare data -# network_pmat -## Correlation analysis results of various indicators in the Matcars dataset -data_pmat_links<- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_mat.csv") -data_pmat_links <- na.omit(data_pmat_links) -colnames(data_pmat_links) <- c("from", "to", "p.log") - -data_pmat_node <- colnames(mtcars) -network_pmat <- graph_from_data_frame(d=data_pmat_links, vertices=data_pmat_node, directed=F) - -# data_mat -## mtcars clustering analysis -## Calculate the correlation coefficient matrix -data_mat <- cor(t(mtcars[,c(1,3:6)])) -## Filtering highly relevant data -data_mat[data_mat<0.995] <- 0 - -# Create visualization -# plot---- -par(mfrow=c(2,2), mar=c(1,1,1,1)) -plot(network1, main="Adjacency matrix (square matrix)") -plot(network2, main="Incident matrix") -plot(network3, main="Edge List") -plot(network4, main="Linked text list") -``` - -## Key Parameters -- `width`: Controls element width -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Proportion/Network.html diff --git a/skills/Proportion/Sankey_skill.md b/skills/Proportion/Sankey_skill.md deleted file mode 100644 index b3904beb1f..0000000000 --- a/skills/Proportion/Sankey_skill.md +++ /dev/null @@ -1,67 +0,0 @@ -# Skill: Sankey Diagram (R) - -## Category -Proportion - -## When to Use -A [Sankey diagram](https://www.data-to-viz.com/graph/sankey.html) allows to study flows. Entities (nodes) are represented by rectangles or text. Arrows or arcs are used to show flows between them. In `R`, the `networkD3` package is the best way to build them. - -## Required R Packages -- dplyr -- ggalluvial -- ggplot2 -- networkD3 -- openxlsx -- readxl -- tidyverse -- webshot - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(ggalluvial) -library(ggplot2) -library(networkD3) -library(openxlsx) -library(readxl) - -# Prepare data -#Read drug clinical dataset -drugs <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/drugs.csv", stringsAsFactors = FALSE) -# Create a node data frame -nodes <- data.frame( - name=c(as.character(drugs$source), - as.character(drugs$target)) %>% unique()) -# Reformat -drugs$IDsource <- match(drugs$source, nodes$name)-1 -drugs$IDtarget <- match(drugs$target, nodes$name)-1 - - -#Read drug clinical dataset -drug <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/drug.csv", stringsAsFactors = FALSE) -levels(drug$`glucose(mmol/L)`) <- rev(levels(drug$`glucose(mmol/L)`)) - -# Create visualization -# Basic plotting -p1 <- sankeyNetwork(Links = drugs, Nodes = nodes, - Source = "IDsource", Target = "IDtarget", - Value = "value", NodeID = "name") - -p1 -``` - -## Key Parameters -- `x`: Maps `time` to the x aesthetic -- `y`: Maps `value` to the y aesthetic -- `fill`: Maps `level` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Proportion/Sankey.html diff --git a/skills/Python/Heatmap_skill.md b/skills/Python/Heatmap_skill.md deleted file mode 100644 index c4957d34d9..0000000000 --- a/skills/Python/Heatmap_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Heatmap (Python) - -## Category -Python - -## When to Use -A heatmap is a data visualization technique that uses color to represent values in a matrix. In biomedical research, heatmaps are essential for visualizing gene expression profiles, correlation matrices, methylation data, and drug response panels. Python's `seaborn` and `matplotlib` libraries offer powerful heatmap capabilities with built-in clustering support. - -## Required Python Packages -- matplotlib -- numpy -- pandas -- scipy -- seaborn - -## Minimal Reproducible Code -```python -# Load packages -import matplotlib.pyplot as plt -import seaborn as sns -import pandas as pd -import numpy as np -from scipy.cluster.hierarchy import linkage - -# Prepare data -np.random.seed(42) -n_genes = 30 -n_samples = 12 -gene_names = [f'Gene_{i+1}' for i in range(n_genes)] -sample_names = [f'Sample_{i+1}' for i in range(n_samples)] -groups = ['Tumor'] * 6 + ['Normal'] * 6 - -expr_matrix = np.random.randn(n_genes, n_samples) -expr_matrix[:10, :6] += 2.5 -expr_matrix[10:20, 6:] += 2.0 - -expr_df = pd.DataFrame(expr_matrix, index=gene_names, columns=sample_names) - -# Create visualization -fig, ax = plt.subplots(figsize=(10, 8)) -sns.heatmap(expr_df, cmap='RdBu_r', center=0, xticklabels=True, - yticklabels=True, linewidths=0.5, ax=ax) -ax.set_title('Gene Expression Heatmap') -ax.set_xlabel('Samples') -ax.set_ylabel('Genes') -plt.tight_layout() -plt.show() -``` - -## Key Parameters -- `figsize`: Figure dimensions as (width, height) in inches -- `cmap`: Colormap for continuous color mapping -- `annot`: Whether to annotate cells with values (True/False) - -## Tips -- Call `plt.tight_layout()` to prevent label overlap -- Seaborn integrates with pandas DataFrames for convenient column-based plotting -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Python/Heatmap.html diff --git a/skills/Python/ScatterPlot_skill.md b/skills/Python/ScatterPlot_skill.md deleted file mode 100644 index d7f5806356..0000000000 --- a/skills/Python/ScatterPlot_skill.md +++ /dev/null @@ -1,65 +0,0 @@ -# Skill: Scatter Plot (Python) - -## Category -Python - -## When to Use -A scatter plot displays values for two continuous variables as a collection of points. In biomedical research, scatter plots are widely used for visualizing correlations between gene expression levels, comparing biomarkers, and exploring relationships in multi-omics datasets. Python's `matplotlib` and `seaborn` libraries provide flexible and publication-quality scatter plot capabilities. - -## Required Python Packages -- matplotlib -- numpy -- pandas -- scipy -- seaborn - -## Minimal Reproducible Code -```python -# Load packages -import matplotlib.pyplot as plt -import seaborn as sns -import pandas as pd -import numpy as np -from scipy import stats - -# Prepare data -iris = sns.load_dataset("iris") - -np.random.seed(42) -n = 200 -gene_data = pd.DataFrame({ - 'GeneA': np.random.normal(5, 2, n), - 'GeneB': np.random.normal(5, 2, n), - 'Group': np.random.choice(['Tumor', 'Normal'], n) -}) -gene_data.loc[gene_data['Group'] == 'Tumor', 'GeneA'] += 2 -gene_data.loc[gene_data['Group'] == 'Tumor', 'GeneB'] += 1.5 - -# Create visualization -fig, ax = plt.subplots(figsize=(8, 6)) -for species in iris['species'].unique(): - subset = iris[iris['species'] == species] - ax.scatter(subset['sepal_length'], subset['sepal_width'], - label=species, alpha=0.7, edgecolors='white', linewidth=0.5) -ax.set_xlabel('Sepal Length (cm)') -ax.set_ylabel('Sepal Width (cm)') -ax.set_title('Iris Scatter Plot') -ax.legend(title='Species') -ax.spines[['top', 'right']].set_visible(False) -plt.tight_layout() -plt.show() -``` - -## Key Parameters -- `palette`: Color palette for the plot (e.g., Set2, viridis, coolwarm) -- `figsize`: Figure dimensions as (width, height) in inches -- `alpha`: Transparency level (0–1) -- `hue`: Variable for color grouping - -## Tips -- Call `plt.tight_layout()` to prevent label overlap -- Seaborn integrates with pandas DataFrames for convenient column-based plotting -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Python/ScatterPlot.html diff --git a/skills/Python/ViolinPlot_skill.md b/skills/Python/ViolinPlot_skill.md deleted file mode 100644 index 3228bcaf4f..0000000000 --- a/skills/Python/ViolinPlot_skill.md +++ /dev/null @@ -1,64 +0,0 @@ -# Skill: Violin Plot (Python) - -## Category -Python - -## When to Use -A violin plot combines a box plot and a kernel density estimation to show the distribution of continuous data across categories. In biomedical research, violin plots are ideal for comparing gene expression distributions, drug response measurements, or clinical biomarker levels across patient groups. Python's `seaborn` library makes it simple to create beautiful violin plots. - -## Required Python Packages -- matplotlib -- numpy -- pandas -- seaborn - -## Minimal Reproducible Code -```python -# Load packages -import matplotlib.pyplot as plt -import seaborn as sns -import pandas as pd -import numpy as np - -# Prepare data -iris = sns.load_dataset("iris") - -np.random.seed(42) -n_per_group = 80 -groups = ['Tumor', 'Normal', 'Adjacent'] -gene_expr = pd.DataFrame({ - 'Expression': np.concatenate([ - np.random.normal(8, 1.5, n_per_group), - np.random.normal(5, 1.2, n_per_group), - np.random.normal(6.5, 1.8, n_per_group) - ]), - 'Group': np.repeat(groups, n_per_group), - 'Gene': np.tile(np.repeat(['TP53', 'BRCA1'], n_per_group // 2), 3) -}) - -# Create visualization -fig, ax = plt.subplots(figsize=(8, 6)) -sns.violinplot(data=iris, x='species', y='sepal_length', palette='Set2', - inner='box', ax=ax) -ax.set_xlabel('Species') -ax.set_ylabel('Sepal Length (cm)') -ax.set_title('Distribution of Sepal Length by Species') -ax.spines[['top', 'right']].set_visible(False) -plt.tight_layout() -plt.show() -``` - -## Key Parameters -- `palette`: Color palette for the plot (e.g., Set2, viridis, coolwarm) -- `figsize`: Figure dimensions as (width, height) in inches -- `alpha`: Transparency level (0–1) -- `inner`: Representation inside violin (box, quartile, point, stick, None) -- `hue`: Variable for color grouping - -## Tips -- Call `plt.tight_layout()` to prevent label overlap -- Seaborn integrates with pandas DataFrames for convenient column-based plotting -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Python/ViolinPlot.html diff --git a/skills/Python/VolcanoPlot_skill.md b/skills/Python/VolcanoPlot_skill.md deleted file mode 100644 index d5a33b6fcf..0000000000 --- a/skills/Python/VolcanoPlot_skill.md +++ /dev/null @@ -1,71 +0,0 @@ -# Skill: Volcano Plot (Python) - -## Category -Python - -## When to Use -A volcano plot displays statistical significance (-log10 p-value) versus fold-change (log2 FC) for thousands of features simultaneously. In biomedical research, volcano plots are the standard visualization for differential gene expression results from RNA-seq, proteomics, and metabolomics. Python's `matplotlib` provides full control over customizing these publication-ready plots. - -## Required Python Packages -- matplotlib -- numpy -- pandas - -## Minimal Reproducible Code -```python -# Load packages -import matplotlib.pyplot as plt -import pandas as pd -import numpy as np - -# Prepare data -np.random.seed(42) -n_genes = 5000 -df = pd.DataFrame({ - 'gene': [f'Gene{i+1}' for i in range(n_genes)], - 'log2FC': np.random.normal(0, 1.5, n_genes), - 'pvalue': np.random.uniform(1e-10, 1, n_genes) -}) -df['neg_log10p'] = -np.log10(df['pvalue']) - -fc_thresh = 1.0 -p_thresh = 0.05 - -conditions = [ - (df['log2FC'] > fc_thresh) & (df['pvalue'] < p_thresh), - (df['log2FC'] < -fc_thresh) & (df['pvalue'] < p_thresh), -] -choices = ['Up', 'Down'] -df['regulation'] = np.select(conditions, choices, default='NS') - -# Create visualization -colors = {'Up': '#e63946', 'Down': '#457b9d', 'NS': '#cccccc'} -fig, ax = plt.subplots(figsize=(8, 6)) -for reg, color in colors.items(): - subset = df[df['regulation'] == reg] - ax.scatter(subset['log2FC'], subset['neg_log10p'], - c=color, s=8, alpha=0.6, label=f'{reg} ({len(subset)})') -ax.axhline(-np.log10(p_thresh), color='grey', linestyle='--', linewidth=0.8) -ax.axvline(fc_thresh, color='grey', linestyle='--', linewidth=0.8) -ax.axvline(-fc_thresh, color='grey', linestyle='--', linewidth=0.8) -ax.set_xlabel('log₂(Fold Change)') -ax.set_ylabel('-log₁₀(P-value)') -ax.set_title('Volcano Plot') -ax.legend(frameon=False) -ax.spines[['top', 'right']].set_visible(False) -plt.tight_layout() -plt.show() -``` - -## Key Parameters -- `figsize`: Figure dimensions as (width, height) in inches -- `alpha`: Transparency level (0–1) -- `annot`: Whether to annotate cells with values (True/False) - -## Tips -- The tutorial includes a 'Enhanced Volcano with Significance Regions' section with advanced styling options -- Call `plt.tight_layout()` to prevent label overlap -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Python/VolcanoPlot.html diff --git a/skills/Ranking/BarPlot_skill.md b/skills/Ranking/BarPlot_skill.md deleted file mode 100644 index e3b1b7bdfc..0000000000 --- a/skills/Ranking/BarPlot_skill.md +++ /dev/null @@ -1,82 +0,0 @@ -# Skill: Bar Plot (R) - -## Category -Ranking - -## When to Use -A bar plot is a graph that uses the height or length of the bars to represent the amount of data. - -## Required R Packages -- cowplot -- dplyr -- forcats -- ggpattern -- ggplot2 -- ggpubr -- hrbrthemes -- magrittr -- palmerpenguins -- rstatix -- tidyr - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(dplyr) -library(forcats) -library(ggpattern) -library(ggplot2) -library(ggpubr) - -# Prepare data -data_TCGA <- readr::read_csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.htseq_counts_processed.csv") - -data_TCGA1 <- data_TCGA[1:5,] %>% - gather(key = "sample",value = "gene_expression",3:1219) - -data_tcga_mean <- aggregate(data_TCGA1$gene_expression, - by=list(data_TCGA1$gene_name), mean) # mean -colnames(data_tcga_mean) <- c("gene","expression") - -data_tcga_sd <- aggregate(data_TCGA1$gene_expression, - by=list(data_TCGA1$gene_name), sd) -colnames(data_tcga_sd) <- c("gene","sd") - -data_tcga <- merge(data_tcga_mean, data_tcga_sd, by="gene") - -data_penguins <- penguins - -data_penguins_flipper_length <- aggregate(data_penguins$flipper_length_mm, - by=list(data_penguins$species,data_penguins$sex), - mean) -colnames(data_penguins_flipper_length) <- c("species","sex","flipper_length_mm") - -data_mpg <- mpg - -# Create visualization -# Basic bar plot -p <- ggplot(data_tcga_mean, aes(x=gene, y=expression)) + - geom_bar(stat = "identity") - -p -``` - -## Key Parameters -- `x`: Maps `gene` to the x aesthetic -- `y`: Maps `expression` to the y aesthetic -- `fill`: Maps `group` to the fill aesthetic -- `colour`: Maps `group` to the colour aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Use `coord_flip()` for horizontal orientation when labels are long -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Sort categories by value rather than alphabetically for clearer ranking visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Ranking/BarPlot.html diff --git a/skills/Ranking/CircularBarplot_skill.md b/skills/Ranking/CircularBarplot_skill.md deleted file mode 100644 index 350643b684..0000000000 --- a/skills/Ranking/CircularBarplot_skill.md +++ /dev/null @@ -1,61 +0,0 @@ -# Skill: Circular Barplot (R) - -## Category -Ranking - -## When to Use -Circular Barplot is a variation of the well-known bar chart where bars are displayed along a circle instead of a straight line. Note that while visually appealing, circular bar charts must be used with caution because the groups do not share the same Y-axis. However, they are well-suited for periodic data. - -## Required R Packages -- tidyverse - -## Minimal Reproducible Code -```r -# Load packages -library(tidyverse) - -# Prepare data -# 1.R's built-in data—iris -head(iris) - -# 2.Self-built dataset -data_customize <- data.frame( - individual=paste( "Mister ", seq(1,60), sep=""), - group=c( rep('A', 10), rep('B', 30), rep('C', 14), rep('D', 6)) , - value=sample( seq(10,100), 60, replace=T) -) - -# 3.TCGA database (gene expression data for liver cancer) -tcga_circle <- readr::read_csv( -"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/tcga_circle.csv") - -# Create visualization -iris_id <- iris[order(iris$Species),] -iris_id$new_column <- 1:nrow(iris_id) -p <- ggplot(iris_id, aes(x = new_column, y = Sepal.Length, fill = Species)) + - geom_bar(stat = "identity", width = 1) + - coord_polar(start = 0) + - theme_void() + - labs(fill = "Species", y = "Sepal.Length", x = NULL) + - theme(legend.title = element_blank()) - -p -``` - -## Key Parameters -- `x`: Maps `title` to the x aesthetic -- `y`: Maps `value` to the y aesthetic -- `fill`: Maps `group` to the fill aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `width`: Controls element width -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_void()` - -## Tips -- The tutorial includes a '3. Beautify plot' section with advanced styling options -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Sort categories by value rather than alphabetically for clearer ranking visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Ranking/CircularBarplot.html diff --git a/skills/Ranking/Lollipop_skill.md b/skills/Ranking/Lollipop_skill.md deleted file mode 100644 index 9cba6dbeac..0000000000 --- a/skills/Ranking/Lollipop_skill.md +++ /dev/null @@ -1,84 +0,0 @@ -# Skill: Lollipop Plot (R) - -## Category -Ranking - -## When to Use -A lollipop plot is a variation of a bar chart and a scatter plot. It consists of a line segment and a point, which can clearly display data while reducing the amount of graphics. At the same time, the lollipop plot can help align values with categories and is very suitable for comparing the differences between values of multiple categories. - -## Required R Packages -- cowplot -- ggalt -- ggplot2 -- ggpubr -- hrbrthemes -- palmerpenguins -- rstatix -- tidyr - -## Minimal Reproducible Code -```r -# Load packages -library(cowplot) -library(ggalt) -library(ggplot2) -library(ggpubr) -library(hrbrthemes) -library(palmerpenguins) - -# Prepare data -data_TCGA <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.htseq_counts_processed.csv") - -data_TCGA1 <- data_TCGA[1:25,] %>% - gather(key = "sample",value = "gene_expression",3:1219) - -data_tcga_mean <- aggregate(data_TCGA1$gene_expression, - by=list(data_TCGA1$gene_name), mean) # mean -colnames(data_tcga_mean) <- c("gene","expression") - -data_tcga_sd <- aggregate(data_TCGA1$gene_expression, - by=list(data_TCGA1$gene_name), sd) -colnames(data_tcga_sd) <- c("gene","sd") - -data_tcga <- merge(data_tcga_mean, data_tcga_sd, by="gene") - -data_penguins <- penguins - -data_penguins_mean <- aggregate(data_penguins$flipper_length_mm, - by=list(data_penguins$species,data_penguins$sex), - mean) -colnames(data_penguins_mean) <- c("species","sex","flipper_length") - -# Convert long format data to wide format -data_penguins_mean <- spread(data_penguins_mean, key="sex", value="flipper_length") - -row_mean = apply(data_penguins_mean[,2:3],1,mean) - -data_penguins_mean$mean <- row_mean - -# Create visualization -# `TCGA` data -p <- ggplot(data_tcga, aes(x=gene, y=expression)) + - geom_point() + - geom_segment( aes(x=gene, xend=gene, y=0, yend=expression)) + - theme(axis.text.x = element_text(angle = 30,vjust = 0.85,hjust = 0.85)) - -p -``` - -## Key Parameters -- `x`: Maps `mean` to the x aesthetic -- `y`: Maps `species` to the y aesthetic -- `size`: Maps `mean` to the size aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `stat`: Statistical transformation to use -- `theme`: Plot theme; tutorial uses `theme_light()` - -## Tips -- The tutorial includes a '2. Customize appearance' section with advanced styling options -- Use `coord_flip()` for horizontal orientation when labels are long -- Sort categories by value rather than alphabetically for clearer ranking visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Ranking/Lollipop.html diff --git a/skills/Ranking/Parallel_skill.md b/skills/Ranking/Parallel_skill.md deleted file mode 100644 index 5e84fcc004..0000000000 --- a/skills/Ranking/Parallel_skill.md +++ /dev/null @@ -1,70 +0,0 @@ -# Skill: Parallel Coordinates Plot (R) - -## Category -Ranking - -## When to Use -Parallel coordinate plots are a common method for visualizing high-dimensional multivariate data. To display a set of objects in a multidimensional space, multiple parallel and equally spaced axes are drawn, and the objects in the multidimensional space are represented as broken lines with vertices on the parallel axes. Although parallel line plots are a special type of line plot, they differ significantly from ordinary line plots. This is because parallel line plots are not limited to descri... - -## Required R Packages -- GGally -- MASS -- RColorBrewer -- dplyr -- ggbump -- hrbrthemes -- patchwork -- tibble -- tidyr -- viridis - -## Minimal Reproducible Code -```r -# Load packages -library(GGally) -library(MASS) -library(RColorBrewer) -library(dplyr) -library(ggbump) -library(hrbrthemes) - -# Prepare data -# iris -data_iris <- iris -data_iris <- data_iris %>% - group_by(Species) %>% - sample_n(size = 20, replace = FALSE) - -# TCGA-CHOL.methylation450 -methylation_raw <- readr::read_tsv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-CHOL.methylation450_.tsv") -methylation_selected <- methylation_raw[c(5,7,11),c(4:6)] -rownames(methylation_selected) <- c("cg236", "cg292", "cg658") -colnames(methylation_selected) <- substr(colnames(methylation_selected), 9, 12) -data_tcga <- methylation_selected %>% - rownames_to_column(var = "Composite") %>% - pivot_longer(cols = -Composite, names_to = "sample", values_to = "value") -data_tcga <- data_tcga %>% - mutate(sample = as.numeric(factor(sample))) # Convert the sample to a numerical value - -# Create visualization -# Basic parallel graph -p <- ggparcoord(data_iris, columns = 1:4, groupColumn = 5) - -p -``` - -## Key Parameters -- `x`: Maps `sample` to the x aesthetic -- `y`: Maps `value` to the y aesthetic -- `color`: Maps `Composite` to the color aesthetic -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `theme`: Plot theme; tutorial uses `theme_ipsum()` - -## Tips -- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Sort categories by value rather than alphabetically for clearer ranking visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Ranking/Parallel.html diff --git a/skills/Ranking/Radar_skill.md b/skills/Ranking/Radar_skill.md deleted file mode 100644 index 1e94595f48..0000000000 --- a/skills/Ranking/Radar_skill.md +++ /dev/null @@ -1,54 +0,0 @@ -# Skill: Radar/Spider Plot (R) - -## Category -Ranking - -## When to Use -A radar chart, spider chart, or web chart is a two-dimensional chart type used to plot a series of values over one or more quantitative variables. The fmsb library is an excellent tool for building this type of chart in R. - -## Required R Packages -- fmsb - -## Minimal Reproducible Code -```r -# Load packages -library(fmsb) - -# Prepare data -# 1.R built-in data - iris -head(iris) - -# 2.Self-built dataset -## Here we create a data set about the performance of three students in different subjects -set.seed(99) -data <- as.data.frame(matrix( sample( 0:20 , 15 , replace=F) , ncol=5)) -colnames(data) <- c("math" , "english" , "biology" , "music" , "R-coding" ) -rownames(data) <- paste("mister" , letters[1:3] , sep="-") -data <- rbind(rep(20,5) , rep(0,5) , data) - -# 3.TCGA database (gene expression data of liver cancer) -tcga_group_radar <- readr::read_csv( -"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/tcga_group_radar.csv") -tcga_simple_bar <- data.frame(tcga_group_radar[3,]) - -# Create visualization -# Data collation -iris_setosa <- iris[c(1:50),] -iris_setosa <- iris_setosa[,-5] -iris_setosa_radar <- rbind(rep(6,4),rep(0,4),iris_setosa) -# plot -par(mar = c(1, 1, 1, 1)) -radarchart(iris_setosa_radar) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Sort categories by value rather than alphabetically for clearer ranking visualization -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Ranking/Radar.html diff --git a/skills/Ranking/Table_skill.md b/skills/Ranking/Table_skill.md deleted file mode 100644 index be81673f5e..0000000000 --- a/skills/Ranking/Table_skill.md +++ /dev/null @@ -1,52 +0,0 @@ -# Skill: Table (R) - -## Category -Ranking - -## When to Use -Tables are both a visual communication mode and a means of organizing and collating data. - -## Required R Packages -- dplyr -- gt -- gtExtras -- readr - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(gt) -library(gtExtras) -library(readr) - -# Prepare data -# 1.Select the first 7 rows of the iris dataset -data <- iris[1:7,] - -head(data) - -# 2.The first 7 rows of clinical data on gastric cancer from the UCSC Xena database (this clinical data was only used when creating the three-line table). -data_clinical <- read.table("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-STAD.survival.tsv", header = TRUE, sep = "\t") -data_clinical <- data_clinical[1:7,] - -head(data_clinical) - -# Create visualization -# You can draw the graph by calling the gt() function. -gt(data) -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `position`: Position adjustment (identity, dodge, stack, fill) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Sort categories by value rather than alphabetically for clearer ranking visualization -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Ranking/Table.html diff --git a/skills/Ranking/UpsetPlot_skill.md b/skills/Ranking/UpsetPlot_skill.md deleted file mode 100644 index 48d1572a71..0000000000 --- a/skills/Ranking/UpsetPlot_skill.md +++ /dev/null @@ -1,48 +0,0 @@ -# Skill: Upset Plot (R) - -## Category -Ranking - -## When to Use -The Upset diagram is similar to the Venn diagram, mainly showing the number of elements in the intersection of different sets. However, when the number of sets in the Venn diagram reaches 5, the readability begins to drop sharply. The Upset diagram can well solve the problem of poor readability of the Venn diagram and can also provide additional statistical information on element properties. - -## Required R Packages -- UpSetR -- ggupset - -## Minimal Reproducible Code -```r -# Load packages -library(UpSetR) -library(ggupset) - -# Prepare data -# UpSetR can accept three formats of data. The first is a list with named vectors (see listInput variable), the second is an expression vector (see expressionInput variable), and the third is a data frame consisting of 0,1 (see movies and mutations variables) -# Reading CSV data -# The list format requires each vector in the list to be a set. UpSetR requires each set to be named, and the elements in the vector are members of the corresponding set. When using the upset function to draw, you need to use the fromList function to convert the list data format. -listInput <- list(one = c(1, 2, 3, 5, 7, 8, 11, 12, 13), two = c(1, 2, 4, 5, 10), three = c(1, 5, 6, 7, 8, 9, 10, 12, 13)) -# The expression format accepts a vector of expressions. The elements of the expression vector are the names of the sets in the intersection (separated by &), and the numeric elements in the intersection. When using the upset function to draw, you need to use the fromExpression function to convert the list data format. -expressionInput <- c(one = 2, two = 1, three = 2, `one&two` = 1, `one&three` = 4, `two&three` = 1, `one&two&three` = 2) - -# In the data frame format, each column is a set and each row is an element. The data frame is required to consist of 0 and 1, which respectively indicate whether the element exists in the set. When a column has a value other than 0 or 1, the column is considered to be an attribute of the element. -movies <- read.csv( system.file("extdata", "movies.csv", package = "UpSetR"), header=T, sep=";" ) -mutations <- read.csv( system.file("extdata", "mutations.csv", package = "UpSetR"), header=T, sep = ",") - -# Create visualization -# Use the above three data types to draw the Upset graph -upset(fromList(listInput)) -upset(fromExpression(expressionInput)) -upset(movies) -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- The tutorial includes a '3. Advanced Upset Plot' section with advanced styling options -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Sort categories by value rather than alphabetically for clearer ranking visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Ranking/UpsetPlot.html diff --git a/skills/Ranking/VennPlot_skill.md b/skills/Ranking/VennPlot_skill.md deleted file mode 100644 index d91f71b4af..0000000000 --- a/skills/Ranking/VennPlot_skill.md +++ /dev/null @@ -1,45 +0,0 @@ -# Skill: Veen Plot (R) - -## Category -Ranking - -## When to Use -For the visualization of Venn diagrams, the commonly used R packages are ggVennDiagram and VennDiagram. Compared with the VennDiagram package, ggVennDiagram has the advantages of being applicable to more groups, adapting to ggplot2 syntax, and flexibly setting output formats, and is easier to learn and post-process. However, the set color of ggVennDiagram can only be set to a continuous gradient color related to the number of elements, and cannot be set to a discrete color with one color for... - -## Required R Packages -- VennDiagram -- ggVennDiagram -- ggplot2 - -## Minimal Reproducible Code -```r -# Load packages -library(VennDiagram) -library(ggVennDiagram) -library(ggplot2) - -# Prepare data -genes <- paste("gene",1:1000,sep="") -set.seed(123) -x <- list(A=sample(genes,300), - B=sample(genes,525), - C=sample(genes,440), - D=sample(genes,350)) - -# Create visualization -# Basic Venn Diagram -ggVennDiagram(x) -``` - -## Key Parameters -- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque) -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- The tutorial includes a '2. Beautify the Venn diagram' section with advanced styling options -- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()` -- Sort categories by value rather than alphabetically for clearer ranking visualization - -## Full Tutorial -https://openbiox.github.io/Bizard/Ranking/VennPlot.html diff --git a/skills/Ranking/Wordcloud_skill.md b/skills/Ranking/Wordcloud_skill.md deleted file mode 100644 index 53570a21c7..0000000000 --- a/skills/Ranking/Wordcloud_skill.md +++ /dev/null @@ -1,67 +0,0 @@ -# Skill: Wordcloud (R) - -## Category -Ranking - -## When to Use -A word cloud is a visual representation of text words, which allows you to clearly see the keywords (high-frequency words) in a large amount of text data. - -## Required R Packages -- dplyr -- htmlwidgets -- jiebaR -- jiebaRD -- tidyverse -- webshot2 -- wordcloud2 - -## Minimal Reproducible Code -```r -# Load packages -library(dplyr) -library(htmlwidgets) -library(jiebaR) -library(jiebaRD) -library(tidyverse) -library(webshot2) - -# Prepare data -# 1.Chinese abstract text -words <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/words.txt",header = FALSE,sep="\n") -words <- as.character(words) - -head_words <- substr(words, start = 1, stop = 20) - -head_words - -# 2.demoFreq dataset -data <- demoFreq - -head(data) - -# 3.English abstract text -words_english <- read.csv("https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/words_english.txt",header = FALSE,sep="\n") - -words_english <- as.character(words_english) - -head_words_english <- substr(words_english, start = 1, stop = 20) - -head_words_english - -# Create visualization -# Basic Plotting -BasicPlot <- wordcloud2(data = words_seg, size = 1) -BasicPlot -``` - -## Key Parameters -- `fill`: Maps a variable to fill color for group comparison -- `color`: Maps a variable to outline/point color - -## Tips -- Adjust text size with `theme(text = element_text(size = 14))` for presentations -- Sort categories by value rather than alphabetically for clearer ranking visualization -- See the full tutorial for additional customization options and advanced examples - -## Full Tutorial -https://openbiox.github.io/Bizard/Ranking/Wordcloud.html From cd7c325ce7be5b37b78fd5586fffc48f816405a3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Apr 2026 04:27:01 +0000 Subject: [PATCH 3/4] chore: remove entire skills/ directory and simplify skill generation workflow Agent-Logs-Url: https://github.com/openbiox/Bizard/sessions/7e187a25-bd0b-4f69-a722-6f7dd89266c0 Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com> --- .github/scripts/generate_skills.py | 108 +- .github/workflows/generate-skills.yml | 63 +- .github/workflows/skill-command.yml | 13 +- .gitignore | 3 + Skills.qmd | 163 +- Skills.zh.qmd | 157 +- skills/bizard_skills.json | 4222 ------------------------- skills/index.json | 3965 ----------------------- 8 files changed, 30 insertions(+), 8664 deletions(-) delete mode 100644 skills/bizard_skills.json delete mode 100644 skills/index.json diff --git a/.github/scripts/generate_skills.py b/.github/scripts/generate_skills.py index ab65d36b5c..8add8225b7 100644 --- a/.github/scripts/generate_skills.py +++ b/.github/scripts/generate_skills.py @@ -687,28 +687,18 @@ def main(): formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument("--input", default=".", help="Input QMD file or directory") - parser.add_argument("--output", default="skills", help="Output directory") parser.add_argument("--base-url", default=DEFAULT_BASE_URL) - parser.add_argument("--format", choices=["markdown", "json", "both"], - default="both") parser.add_argument("--offline", action="store_true", help="Use offline rule-based extraction (no LLM)") parser.add_argument("--files", nargs="*", help="Specific QMD files to process") parser.add_argument("--changed-files", - help="Space-separated list of changed QMD files") + help="Space-separated list of changed QMD files (ignored; always processes all)") parser.add_argument("--verbose", action="store_true") args = parser.parse_args() - output_dir = Path(args.output) - output_dir.mkdir(parents=True, exist_ok=True) - # Determine which files to process - if args.changed_files: - qmd_files = [Path(f.strip()) for f in args.changed_files.split() - if f.strip().endswith(".qmd") - and not f.strip().endswith(".zh.qmd")] - elif args.files: + if args.files: qmd_files = [Path(f) for f in args.files if f.endswith(".qmd") and not f.endswith(".zh.qmd")] else: @@ -755,89 +745,8 @@ def main(): errors.append((f, exc)) print(f" ✗ {f}: {exc}", file=sys.stderr) - write_json = args.format in ("json", "both") - write_markdown = args.format in ("markdown", "both") - - # Write individual skill Markdown files - if write_markdown: - for skill in skills: - cat_dir = output_dir / skill["category"] - cat_dir.mkdir(parents=True, exist_ok=True) - stem = Path(skill["source_file"]).stem - out_file = cat_dir / f"{stem}_skill.md" - out_file.write_text(skill["skill"], encoding="utf-8") - print(f"\nWrote {len(skills)} skill file(s) to {output_dir}/") - - # Build or update index - # In full mode (no specific files), replace entirely; in incremental mode, merge - incremental = bool(args.changed_files or args.files) - index_file = output_dir / "index.json" - - if incremental and index_file.exists(): - # Load existing index and merge with new skills - try: - existing_index = json.loads(index_file.read_text(encoding="utf-8")) - except (json.JSONDecodeError, OSError): - existing_index = [] - - new_entries = {s["source_file"]: {k: v for k, v in s.items() if k != "skill"} - for s in skills} - - updated_index = [] - seen = set() - for entry in existing_index: - src = entry.get("source_file", "") - if src in new_entries: - updated_index.append(new_entries[src]) - seen.add(src) - else: - updated_index.append(entry) - for src, entry in new_entries.items(): - if src not in seen: - updated_index.append(entry) - else: - # Full replacement - updated_index = [{k: v for k, v in s.items() if k != "skill"} - for s in skills] - - with open(index_file, "w", encoding="utf-8") as fh: - json.dump(updated_index, fh, ensure_ascii=False, indent=2) - print(f"Index written to {index_file} ({len(updated_index)} entries)") - - # Write full skills JSON - if write_json: - full_file = output_dir / "bizard_skills.json" - - if incremental and full_file.exists(): - # Merge with existing full JSON - try: - existing_full = json.loads(full_file.read_text(encoding="utf-8")) - except (json.JSONDecodeError, OSError): - existing_full = [] - - new_full = {s["source_file"]: s for s in skills} - updated_full = [] - seen_full = set() - for entry in existing_full: - src = entry.get("source_file", "") - if src in new_full: - updated_full.append(new_full[src]) - seen_full.add(src) - else: - updated_full.append(entry) - for src, entry in new_full.items(): - if src not in seen_full: - updated_full.append(entry) - else: - # Full replacement - updated_full = list(skills) - - with open(full_file, "w", encoding="utf-8") as fh: - json.dump(updated_full, fh, ensure_ascii=False, indent=2) - print(f"Full skills JSON written to {full_file} ({len(updated_full)} entries)") - - # Generate unified SKILL.md from the full index - generate_unified_skill(index_file, Path("files/gallery_data.csv"), + # Generate unified SKILL.md directly from in-memory skills list + generate_unified_skill(skills, Path("files/gallery_data.csv"), Path("SKILL.md")) # Summary @@ -888,7 +797,7 @@ def main(): ] -def generate_unified_skill(index_path: Path, gallery_csv: Path, +def generate_unified_skill(all_skills: List[dict], gallery_csv: Path, output_path: Path) -> None: """Generate the unified ``SKILL.md`` — an AI skill instruction document. @@ -898,13 +807,8 @@ def generate_unified_skill(index_path: Path, gallery_csv: Path, """ import csv as _csv - if not index_path.exists(): - print(f" ⚠ Skipping unified SKILL.md: {index_path} not found") - return - - all_skills = json.loads(index_path.read_text(encoding="utf-8")) if not all_skills: - print(" ⚠ Skipping unified SKILL.md: index is empty") + print(" ⚠ Skipping unified SKILL.md: no skills provided") return # Gallery row count diff --git a/.github/workflows/generate-skills.yml b/.github/workflows/generate-skills.yml index 48bcd51bae..78dc1be762 100644 --- a/.github/workflows/generate-skills.yml +++ b/.github/workflows/generate-skills.yml @@ -12,10 +12,6 @@ on: - '.github/scripts/generate_skills.py' workflow_dispatch: inputs: - files: - description: 'Space-separated list of QMD files to process (empty = all)' - required: false - default: '' pr_number: description: 'PR number (for command-triggered runs)' required: false @@ -69,78 +65,47 @@ jobs: - name: Install dependencies run: pip install openai - # Detect changed files for push events - - name: Detect changed QMD files - if: github.event_name == 'push' && inputs.files == '' - id: changed - run: | - CHANGED=$(git diff --name-only HEAD~1 HEAD -- '*.qmd' | grep -v '\.zh\.qmd$' || true) - echo "files<> "$GITHUB_OUTPUT" - echo "$CHANGED" >> "$GITHUB_OUTPUT" - echo "EOF" >> "$GITHUB_OUTPUT" - echo "Changed QMD files: $CHANGED" - - - name: Generate skill documents + - name: Generate unified SKILL.md env: AI_Model_API_KEY: ${{ secrets.AI_Model_API_KEY }} AI_Model_BASE_URL: ${{ secrets.AI_Model_BASE_URL }} AI_Model_Name: ${{ secrets.AI_Model_Name }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} run: | - ARGS="--output skills/ --base-url https://openbiox.github.io/Bizard/ --format json --verbose" + ARGS="--base-url https://openbiox.github.io/Bizard/ --verbose" # Check if offline mode is requested if [ "${{ inputs.offline }}" = "true" ]; then ARGS="${ARGS} --offline" fi - # Determine which files to process - if [ -n "${{ inputs.files }}" ]; then - # Specific files from workflow dispatch - python .github/scripts/generate_skills.py ${ARGS} --changed-files "${{ inputs.files }}" - elif [ -n "${{ steps.changed.outputs.files }}" ]; then - # Changed files from push event - FILES=$(echo "${{ steps.changed.outputs.files }}" | tr '\n' ' ') - python .github/scripts/generate_skills.py ${ARGS} --changed-files "${FILES}" - else - # Process all files (manual dispatch without file list) - python .github/scripts/generate_skills.py ${ARGS} - fi + python .github/scripts/generate_skills.py ${ARGS} - name: Check for changes id: git-check run: | - if git diff --quiet && [ -z "$(git ls-files --others --exclude-standard skills/)" ]; then + if git diff --quiet SKILL.md; then echo "committed=false" >> "$GITHUB_OUTPUT" - echo "No skill file changes detected." + echo "No SKILL.md changes detected." else echo "committed=true" >> "$GITHUB_OUTPUT" - echo "Skill files updated." - git status --short - fi - - - name: Check for changes (including unified SKILL.md) - id: git-check-unified - run: | - if git diff --quiet SKILL.md && git diff --quiet -- skills/; then - echo "No unified skill or skills directory changes." - else - echo "unified_changed=true" >> "$GITHUB_OUTPUT" + echo "SKILL.md updated." + git status --short SKILL.md fi - - name: Commit and push skill documents - if: steps.git-check.outputs.committed == 'true' || steps.git-check-unified.outputs.unified_changed == 'true' + - name: Commit and push SKILL.md + if: steps.git-check.outputs.committed == 'true' run: | git config user.email "github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" - git add skills/ SKILL.md - git commit -m "chore: regenerate AI skill documents" \ - -m "Auto-generated skill documents from QMD tutorials." + git add SKILL.md + git commit -m "chore: regenerate AI skill document" \ + -m "Auto-generated SKILL.md from QMD tutorials." BRANCH="${PR_BRANCH:-${{ github.ref_name }}}" git push origin "${BRANCH}" - name: Post PR comment - if: (steps.git-check.outputs.committed == 'true' || steps.git-check-unified.outputs.unified_changed == 'true') && inputs.pr_number != '' + if: steps.git-check.outputs.committed == 'true' && inputs.pr_number != '' uses: actions/github-script@v7 with: script: | @@ -150,5 +115,5 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, issue_number: prNumber, - body: `✅ **Skill documents regenerated** and pushed to the PR branch.\n\nSee the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.` + body: `✅ **SKILL.md regenerated** and pushed to the PR branch.\n\nSee the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.` }); diff --git a/.github/workflows/skill-command.yml b/.github/workflows/skill-command.yml index 853675b492..a923a1d9bc 100644 --- a/.github/workflows/skill-command.yml +++ b/.github/workflows/skill-command.yml @@ -8,9 +8,7 @@ name: Handle /skill PR Comment Command # 3. Dispatches generate-skills.yml (workflow_dispatch) with the PR context # # Usage in a PR comment: -# /skill → regenerate skills for all changed QMD files -# /skill Omics/VolcanoPlot.qmd → regenerate skill for one specific file -# /skill File1.qmd File2.qmd → regenerate skills for multiple files +# /skill → regenerate SKILL.md from all QMD tutorials # /skill --offline → use offline mode (no LLM API) # ────────────────────────────────────────────────────────────────────────────── on: @@ -79,9 +77,6 @@ jobs: // ── Parse arguments ─────────────────────────────────────────────── const parts = context.payload.comment.body.trim().split(/\s+/).slice(1); const offline = parts.includes('--offline') ? 'true' : 'false'; - const files = parts - .filter(p => (p.endsWith('.qmd') || p.endsWith('.Qmd')) && !p.endsWith('.zh.qmd')) - .join(' '); // ── Dispatch the skill generation workflow ──────────────────────── const defaultBranch = context.payload.repository.default_branch; @@ -92,20 +87,16 @@ jobs: ref: defaultBranch, inputs: { pr_number: String(context.issue.number), - files: files || '', offline: offline, }, }); // ── Post acknowledgement comment ────────────────────────────────── const runsUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/generate-skills.yml`; - const filesMsg = files - ? `\n\n**Target files:** \`${files.replace(/ /g, '`, `')}\`` - : ''; const modeMsg = offline === 'true' ? ' (offline mode)' : ''; await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, - body: `🤖 Skill generation workflow dispatched by @${commenter}${modeMsg}.${filesMsg}\n\n[View recent workflow runs](${runsUrl})`, + body: `🤖 Skill generation workflow dispatched by @${commenter}${modeMsg}.\n\n[View recent workflow runs](${runsUrl})`, }); diff --git a/.gitignore b/.gitignore index 4929cc3c49..541621add0 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ Julia/Manifest.toml # Individual per-tutorial skill markdown files (unified into SKILL.md) skills/**/*_skill.md + +# Entire skills/ directory (superseded by SKILL.md) +skills/ diff --git a/Skills.qmd b/Skills.qmd index 388eaddcdb..4f69374494 100644 --- a/Skills.qmd +++ b/Skills.qmd @@ -63,177 +63,20 @@ The ZIP contains: --- -## Browse Skills by Category {#browse} - -Use the search box, language filter, or click a category to browse all available visualization skills. - -```{=html} -
-
- -
-
-
-
-
- - -
- - -``` - ---- - ## Download Resources - **[Download Skill ZIP](bizard-skill.zip)** — Complete unified skill package -- **[`skills/index.json`](skills/index.json)** — Lightweight JSON index (names, categories, packages, URLs) -- **[`skills/bizard_skills.json`](skills/bizard_skills.json)** — Full skill documents with embedded code ## Regenerating Skills -Skills are **automatically regenerated** when tutorials are updated on the main branch. To regenerate manually: +`SKILL.md` is **automatically regenerated** when tutorials are updated on the main branch. To regenerate manually: ```bash # LLM mode (requires API key in environment) -python .github/scripts/generate_skills.py --format both --verbose +python .github/scripts/generate_skills.py --verbose # Offline mode (rule-based extraction) -python .github/scripts/generate_skills.py --offline --format both --verbose +python .github/scripts/generate_skills.py --offline --verbose ``` -The unified `skill.md` is automatically rebuilt from the skills index every time skills are generated. - See the [Skill Generation Specification](https://github.com/openbiox/Bizard/blob/main/skill-spec.md) for the full technical specification. diff --git a/Skills.zh.qmd b/Skills.zh.qmd index 0c53da3554..ed27394266 100644 --- a/Skills.zh.qmd +++ b/Skills.zh.qmd @@ -63,160 +63,9 @@ ZIP 包含: --- -## 按分类浏览技能 {#browse} - -使用搜索框、语言筛选或点击分类来浏览所有可用的可视化技能。 - -```{=html} -
-
- -
-
-
-
-
- - -
- - -``` - ---- - ## 下载资源 - **[下载技能 ZIP 包](bizard-skill.zip)** — 完整的统一技能包 -- **[`skills/index.json`](skills/index.json)** — 轻量级 JSON 索引 -- **[`skills/bizard_skills.json`](skills/bizard_skills.json)** — 完整技能文档 ## 重新生成技能 @@ -224,12 +73,10 @@ function copySkill() { ```bash # LLM 模式(需要配置 API 密钥) -python .github/scripts/generate_skills.py --format both --verbose +python .github/scripts/generate_skills.py --verbose # 离线模式(基于规则提取) -python .github/scripts/generate_skills.py --offline --format both --verbose +python .github/scripts/generate_skills.py --offline --verbose ``` -统一的 `skill.md` 在每次生成技能时从技能索引自动重建。 - 查看完整技术规范:[技能生成规范](https://github.com/openbiox/Bizard/blob/main/skill-spec.md)。 diff --git a/skills/bizard_skills.json b/skills/bizard_skills.json deleted file mode 100644 index 3808ece16d..0000000000 --- a/skills/bizard_skills.json +++ /dev/null @@ -1,4222 +0,0 @@ -[ - { - "name": "Animation", - "category": "Animation", - "language": "R", - "packages": [ - "Cairo", - "babynames", - "dplyr", - "gapminder", - "gganimate", - "ggplot2", - "gifski", - "hrbrthemes", - "tidyr", - "viridis" - ], - "use_when": "Create a Animation visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Animation/Animation.html", - "skill": "# Skill: Animation (R)\n\n## Category\nAnimation\n\n## When to Use\nCreate a Animation visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- Cairo\n- babynames\n- dplyr\n- gapminder\n- gganimate\n- ggplot2\n- gifski\n- hrbrthemes\n- tidyr\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(Cairo)\nlibrary(babynames)\nlibrary(dplyr)\nlibrary(gapminder)\nlibrary(gganimate)\nlibrary(ggplot2)\n\n# Prepare data\n# data_gapminder\ndata_gapminder <- gapminder\n\n# data_babynames\ndata_babynames <- babynames\n\n# data_covi19\ndata_covi19 <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_covi19.csv\")\ndata_covi19$date <- c(6:12)\ndata_covi19 <- gather(data_covi19, key = \"area\", value = \"cases\", 2:7)\n\n# data_covi19_bar\ndata_covi19_bar_10 <- filter(data_covi19, date == 10)\ndata_covi19_bar_10$frame <- rep(\"a\",6)\n\ndata_covi19_bar_12 <- filter(data_covi19, date == 12)\ndata_covi19_bar_12$frame <- rep(\"b\",6)\n\ndata_covi19_bar <- rbind(data_covi19_bar_10,data_covi19_bar_12)\n\n# Create visualization\n# Scattered bubble animation----\np <- ggplot(data_gapminder, aes(gdpPercap, lifeExp, size = pop, color = continent)) +\n geom_point() +\n scale_x_log10() +\n theme_bw() +\n # Drawing animation\n labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +\n transition_time(year) +\n ease_aes('linear')\n\nanimate(p, renderer = gifski_renderer())\n```\n\n## Key Parameters\n- `size`: Maps `pop` to the size aesthetic\n- `color`: Maps `continent` to the color aesthetic\n- `colour`: Maps `country` to the colour aesthetic\n- `x`: Maps `group` to the x aesthetic\n- `y`: Maps `values` to the y aesthetic\n- `fill`: Maps `group` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Animation/Animation.html\n", - "source_file": "Animation/Animation.qmd", - "skill_file": "skills/Animation/Animation_skill.md" - }, - { - "name": "Interactivity", - "category": "Animation", - "language": "R", - "packages": [ - "chorddiag", - "d3heatmap", - "dygraphs", - "gapminder", - "ggiraph", - "htmlwidgets", - "patchwork", - "plotly", - "streamgraph", - "tidyverse", - "webshot", - "xts" - ], - "use_when": "Interactive charts allow users to perform actions: zoom, hover the mouse over markers for tooltips, select variables to display, and so on. R provides a set of packages called HTML widgets: these allow you to build interactive data visualizations directly from R.", - "tutorial_url": "https://openbiox.github.io/Bizard/Animation/Interactivity.html", - "skill": "# Skill: Interactivity (R)\n\n## Category\nAnimation\n\n## When to Use\nInteractive charts allow users to perform actions: zoom, hover the mouse over markers for tooltips, select variables to display, and so on. R provides a set of packages called HTML widgets: these allow you to build interactive data visualizations directly from R.\n\n## Required R Packages\n- chorddiag\n- d3heatmap\n- dygraphs\n- gapminder\n- ggiraph\n- htmlwidgets\n- patchwork\n- plotly\n- streamgraph\n- tidyverse\n- webshot\n- xts\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(chorddiag)\nlibrary(d3heatmap)\nlibrary(dygraphs)\nlibrary(gapminder)\nlibrary(ggiraph)\nlibrary(htmlwidgets)\n\n# Prepare data\nhead(gapminder)\n\n# Create visualization\nplot1 <- gapminder %>%\n filter(year==1977) %>%\n ggplot(aes(gdpPercap, lifeExp, size = pop, color=continent))+\n geom_point() +\n theme_bw()\nggplotly(plot1)\n```\n\n## Key Parameters\n- `size`: Maps `pop` to the size aesthetic\n- `color`: Maps `continent` to the color aesthetic\n- `x`: Maps `Sample` to the x aesthetic\n- `y`: Maps `Composite` to the y aesthetic\n- `fill`: Maps `Standardized_Level` to the fill aesthetic\n- `width`: Controls element width\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Use `coord_flip()` for horizontal orientation when labels are long\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Animation/Interactivity.html\n", - "source_file": "Animation/Interactivity.qmd", - "skill_file": "skills/Animation/Interactivity_skill.md" - }, - { - "name": "Kaplan Meier Plot", - "category": "Clinics", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "patchwork", - "survival", - "survminer", - "tidyr", - "zoo" - ], - "use_when": "Create a Kaplan Meier Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/KaplanMeierPlot.html", - "skill": "# Skill: Kaplan Meier Plot (R)\n\n## Category\nClinics\n\n## When to Use\nCreate a Kaplan Meier Plot visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- dplyr\n- ggplot2\n- patchwork\n- survival\n- survminer\n- tidyr\n- zoo\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(patchwork)\nlibrary(survival)\nlibrary(survminer)\nlibrary(tidyr)\n\n# Prepare data\n# Using the built-in lung dataset (from the survival package)\ndata(\"lung\")\n# Data preprocessing\nsurv_data <- lung %>%\n mutate(\n status = ifelse(status == 2, 1, 0), # Transition state code (1=event)\n sex = factor(sex, labels = c(\"Male\", \"Female\")),\n group = sample(c(\"Treatment\", \"Placebo\"), n(), replace = TRUE)\n )\n\n# View data structure\nglimpse(surv_data)\n\n# Survival time distribution\nsummary(surv_data$time)\n\n# Fitting survival curves\nfit <- survfit(Surv(time, status) ~ group, data = surv_data)\n\n# Extract curve data\nsurv_curve <- surv_summary(fit) \n\n\n# Calculate the log-rank test P value\ndiff <- survdiff(Surv(time, status) ~ group, data = surv_data)\np_value <- signif(1 - pchisq(diff$chisq, length(diff$n)-1), 3)\n\n# Create visualization\n# Basic survival curve\np1 <- ggplot(surv_curve, aes(x = time, y = surv, color = strata)) +\n geom_step(linewidth = 1) +\n labs(x = \"Time (Months)\", y = \"Survival Probability\") +\n scale_y_continuous(labels = scales::percent)\np1\n```\n\n## Key Parameters\n- `x`: Maps `time` to the x aesthetic\n- `y`: Maps `surv` to the y aesthetic\n- `color`: Maps `group` to the color aesthetic\n- `fill`: Maps `group` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- The tutorial includes a '2. More advanced plot' section with advanced styling options\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Clinics/KaplanMeierPlot.html\n", - "source_file": "Clinics/KaplanMeierPlot.qmd", - "skill_file": "skills/Clinics/KaplanMeierPlot_skill.md" - }, - { - "name": "Lollipop Plot", - "category": "Clinics", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "ggpubr", - "patchwork" - ], - "use_when": "Create a Lollipop Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/LollipopPlot.html", - "skill": "# Skill: Lollipop Plot (R)\n\n## Category\nClinics\n\n## When to Use\nCreate a Lollipop Plot visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- dplyr\n- ggplot2\n- ggpubr\n- patchwork\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(ggpubr)\nlibrary(patchwork)\n\n# Prepare data\n# Loading data\ndata <- read.csv('https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/lollipop_1.csv', row.names = 1) # Correlation analysis data reading\n# View the dataset\nhead(data)\n\n# Create visualization\n# Basic Lollipop Plot\n# Convert correlation coefficients and p-values to categorical variables\ndata$pvalue_group <- cut(data$pvalue,\n breaks = c(0, 0.2, 0.4, 0.6,0.8, 1),\n labels = c(\"< 0.2\",\"< 0.4\",\"< 0.6\",\"< 0.8\",\"<1\"),\n right=FALSE)# right=FALSE表示表示区间为左闭右开\ndata$cor_group_size <- cut(abs(data$cor),# 绝对值\n breaks = c(0, 0.1, 0.2, 0.3, 0.4, 0.5),\n labels = c(\"0.1\",\"0.2\",\"0.3\",\"0.4\",\"0.5\"),\n right=FALSE) \n# Order\ndata = data[order(data$cor),]\ndata$cell = factor(data$cell, levels = data$cell)\n\np = ggplot(data, \n aes(x = cor, y = cell, color = pvalue_group)) +\n scale_color_manual(name=\"pvalue\",\n values = c(\"#146432\", \n \"#4DB748\", \n #\"#FAA519\", # Since there is no data in this interval, comment it out.\n \"#FABECD\" #,\n #\"#FAD700\" #Since there is no data in this interval, comment it out.\n ))+ # Color selection of candies in lollipops\n geom_segment(aes(x = 0, y = cell, xend = cor, yend = cell),\n color = 'black', # Drawing of the stick in a lollipop\n linewidth = 0.5) +\n geom_point(aes(size = cor_group_size))+ # Drawing of candy in lollipop\n labs(title = \"COL17A1\", # Image title\n size = \"abs(cor)\") + # legend name\n guides(color = \"none\")+ # Hide redundant legends\n theme_bw()+ \n theme(plot.title=element_text(size=8, # title size\n hjust=0.5 ), # title position\n legend.position = \"bottom\", # legend position\n text = element_text(family = \"serif\"), # Set the font to Times New Roman\n panel.grid = element_line(linetype = \"dotted\",color='grey')) \np\n```\n\n## Key Parameters\n- `x`: Maps `0` to the x aesthetic\n- `y`: Maps `cell` to the y aesthetic\n- `color`: Maps `pvalue_group` to the color aesthetic\n- `size`: Maps `cor_group_size` to the size aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- The tutorial includes a '3. Beautify Plot' section with advanced styling options\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Clinics/LollipopPlot.html\n", - "source_file": "Clinics/LollipopPlot.qmd", - "skill_file": "skills/Clinics/LollipopPlot_skill.md" - }, - { - "name": "Meta-Analysis Forest Plot", - "category": "Clinics", - "language": "R", - "packages": [ - "dplyr", - "forestplot", - "ggplot2", - "grid", - "meta", - "metafor", - "tidyr" - ], - "use_when": "Create a Meta-Analysis Forest Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/MetaForestPlot.html", - "skill": "# Skill: Meta-Analysis Forest Plot (R)\n\n## Category\nClinics\n\n## When to Use\nCreate a Meta-Analysis Forest Plot visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- dplyr\n- forestplot\n- ggplot2\n- grid\n- meta\n- metafor\n- tidyr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(forestplot)\nlibrary(ggplot2)\nlibrary(grid)\nlibrary(meta)\nlibrary(metafor)\n\n# Prepare data\n# Generate simulated data\nset.seed(2023)\nn_studies <- 15\nmeta_data <- tibble(\n `Study Name` = paste(\"Study\", LETTERS[1:n_studies]),\n `Odds Ratio` = exp(rnorm(n_studies, mean = 0.2, sd = 0.4)),\n `Lower 95% CI` = exp(rnorm(n_studies, mean = 0.1, sd = 0.35)),\n `Upper 95% CI` = exp(rnorm(n_studies, mean = 0.3, sd = 0.45)),\n `Weight (%)` = runif(n_studies, 0.5, 3),\n `Treatment Group` = sample(c(\"DrugA\", \"DrugB\"), n_studies, replace = TRUE)\n) %>% \n mutate(\n across(c(`Odds Ratio`, `Lower 95% CI`, `Upper 95% CI`), ~round(., 2)),\n `Weight (%)` = round(`Weight (%)`/sum(`Weight (%)`)*100, 1),\n `Study Name` = factor(`Study Name`, levels = rev(`Study Name`))\n ) \n\n# View the final merged dataset\nhead(meta_data)\n\n# Create visualization\n# Basic forest plot\np <-\n ggplot(meta_data, aes(x = `Odds Ratio`, y = `Study Name`)) +\n geom_vline(xintercept = 1, linetype = \"dashed\", color = \"grey50\") +\n geom_errorbarh(aes(xmin = `Lower 95% CI`, xmax = `Upper 95% CI`), \n height = 0.15, color = \"#2c7fb8\", linewidth = 0.8) +\n geom_point(aes(size = `Weight (%)`), shape = 18, color = \"#d95f00\") +\n scale_x_continuous(trans = \"log\", \n breaks = c(0.25, 0.5, 1, 2, 4),\n limits = c(0.2, 5)) +\n labs(x = \"Odds Ratio (95% CI)\", \n y = \"\",\n title = \"Meta-Analysis Forest Plot\",\n subtitle = \"Random Effects Model\") +\n theme_minimal(base_size = 12) +\n theme(\n panel.grid.major.y = element_blank(),\n panel.grid.minor.x = element_blank(),\n plot.title = element_text(face = \"bold\", hjust = 0.5),\n plot.subtitle = element_text(hjust = 0.5, color = \"grey50\"),\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `y`: Maps `Study_Name` to the y aesthetic\n- `x`: Maps `log_OR` to the x aesthetic\n- `size`: Maps `Sample_Size` to the size aesthetic\n- `fill`: Maps `Effect_Type` to the fill aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Clinics/MetaForestPlot.html\n", - "source_file": "Clinics/MetaForestPlot.qmd", - "skill_file": "skills/Clinics/MetaForestPlot_skill.md" - }, - { - "name": "Mosaic Plot", - "category": "Clinics", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "plyr", - "reshape2", - "tidyr", - "vcd", - "wesanderson" - ], - "use_when": "Create a Mosaic Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/MosaicPlot.html", - "skill": "# Skill: Mosaic Plot (R)\n\n## Category\nClinics\n\n## When to Use\nCreate a Mosaic Plot visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- dplyr\n- ggplot2\n- plyr\n- reshape2\n- tidyr\n- vcd\n- wesanderson\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(plyr)\nlibrary(reshape2)\nlibrary(tidyr)\nlibrary(vcd)\n\n# Prepare data\n# Generate simulated data\ndf <- data.frame(segment = c(\"Patient1\", \"Patient2\", \"Patient3\",\"Patient4\"),\n \"Macrophage\" = c(2400\t,1200,\t600\t,250),\n \"Epithelial\" = c(1000\t,900,\t600,\t250),\n \"T cells\" = c(400,\t600\t,400,\t250),\n \"B cells\" = c(200,\t300\t,400,\t250))\n\nmelt_df<-melt(df,id=\"segment\")\n# Convert numbers to percentages\nsegpct<-rowSums(df[,2:ncol(df)])\nfor (i in 1:nrow(df)){\n for (j in 2:ncol(df)){\n df[i,j]<-df[i,j]/segpct[i]*100 \n }\n}\n\nsegpct<-segpct/sum(segpct)*100\ndf$xmax <- cumsum(segpct)\ndf$xmin <- (df$xmax - segpct)\n\ndfm <- melt(df, id = c(\"segment\", \"xmin\", \"xmax\"),value.name=\"percentage\")\ncolnames(dfm)[ncol(dfm)]<-\"percentage\"\n\n# The ddply() function uses a custom statistical function to group and calculate data.frame\ndfm1 <- ddply(dfm, .(segment), transform, ymax = cumsum(percentage))\ndfm1 <- ddply(dfm1, .(segment), transform,ymin = ymax - percentage)\ndfm1$xtext <- with(dfm1, xmin + (xmax - xmin)/2)\ndfm1$ytext <- with(dfm1, ymin + (ymax - ymin)/2)\n\n# join() function, connects two tables data.frame\ndfm2<-join(melt_df, dfm1, by = c(\"segment\", \"variable\"), type = \"left\", match = \"all\")\n\n# View the final merged dataset\nhead(dfm2)\n\n# Create visualization\n# Basic Plot\np <- ggplot() +\n geom_rect(aes(ymin = ymin, ymax = ymax, xmin = xmin, xmax = xmax, fill = variable),dfm2,colour = \"black\") +\n geom_text(aes(x = xtext, y = ytext, label = value),dfm2 ,size = 4)+\n geom_text(aes(x = xtext, y = 103, label = paste(segment)),dfm2 ,size = 4)+\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `fill`: Maps `variable` to the fill aesthetic\n- `x`: Maps `116` to the x aesthetic\n- `y`: Maps `seq` to the y aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- The tutorial includes a '2. Advanced Plot' section with advanced styling options\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Clinics/MosaicPlot.html\n", - "source_file": "Clinics/MosaicPlot.qmd", - "skill_file": "skills/Clinics/MosaicPlot_skill.md" - }, - { - "name": "Nomogram", - "category": "Clinics", - "language": "R", - "packages": [ - "readr", - "regplot", - "rms", - "survival" - ], - "use_when": "Simply put, a nomogram graphically displays the results of logistic regression or Cox regression. It uses the regression coefficient of each independent variable to develop a scoring criteria, assigning a score to each independent variable value. A total score is then calculated for each patient, and a conversion function is used to convert this score into the probability of a specific outcome for that patient.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/Nomogram.html", - "skill": "# Skill: Nomogram (R)\n\n## Category\nClinics\n\n## When to Use\nSimply put, a nomogram graphically displays the results of logistic regression or Cox regression. It uses the regression coefficient of each independent variable to develop a scoring criteria, assigning a score to each independent variable value. A total score is then calculated for each patient, and a conversion function is used to convert this score into the probability of a specific outcome for that patient.\n\n## Required R Packages\n- readr\n- regplot\n- rms\n- survival\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(readr)\nlibrary(regplot)\nlibrary(rms)\nlibrary(survival)\n\n# Prepare data\n## Loading data\nclinical <- readr::read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-LIHC.clinical.tsv\")\nLIHC <- cbind(clinical$sample,clinical[,c('gender.demographic',\n 'vital_status.demographic',\n 'days_to_death.demographic',\n 'age_at_index.demographic',\n 'ajcc_pathologic_stage.diagnoses')])\ncolnames(LIHC) <- c('bcr_patient_barcode','gender','status','time','age','stage')\ntable(LIHC$status)\nLIHC <- LIHC[LIHC$status != 'Not Reported',]\nLIHC$status <- as.numeric(ifelse(LIHC$status=='Dead','2','1') ) # Death is 2 in nomogram\n\n# Create visualization\n# Basic Nomogram\ndd=datadist(LIHC)\noptions(datadist=\"dd\")\n## Build a logist model and draw a nomogram\nf1 <- lrm(status ~ age + gender + stage , data = LIHC)\nnom <- nomogram(f1, fun=plogis, lp=F, funlabel=\"Risk\")\nplot(nom)\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- The tutorial includes a '2. Beautify Nomogram' section with advanced styling options\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Clinics/Nomogram.html\n", - "source_file": "Clinics/Nomogram.qmd", - "skill_file": "skills/Clinics/Nomogram_skill.md" - }, - { - "name": "Regression Analysis Table", - "category": "Clinics", - "language": "R", - "packages": [ - "broom.helpers", - "datawizard", - "dplyr", - "gtsummary", - "survival" - ], - "use_when": "The regression analysis table is used to display the results of the regression model. It provides statistical information about the variables in the model and helps explain the relationship between the variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/RegressionTable.html", - "skill": "# Skill: Regression Analysis Table (R)\n\n## Category\nClinics\n\n## When to Use\nThe regression analysis table is used to display the results of the regression model. It provides statistical information about the variables in the model and helps explain the relationship between the variables.\n\n## Required R Packages\n- broom.helpers\n- datawizard\n- dplyr\n- gtsummary\n- survival\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(broom.helpers)\nlibrary(datawizard)\nlibrary(dplyr)\nlibrary(gtsummary)\nlibrary(survival)\n\n# Prepare data\ndf <- pbc %>%\n filter(status != 1) %>%\n mutate(status = ifelse(status == 2, 1, 0)) %>%\n select(2:13) %>%\n na.omit() %>% \n # Divide `albumin` into 3 groups\n mutate(albumin3cat = categorize(albumin, split = \"quantile\", n_groups = 3))\n\nhead(df[,1:6])\n\n# Create visualization\n# Basic regression analysis table\nt1 <- coxph(Surv(time, status) ~ albumin + sex + age,\n data = df\n) %>%\n tbl_regression()\n\nt1\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Follow CONSORT or STROBE guidelines for clinical data visualization where applicable\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Clinics/RegressionTable.html\n", - "source_file": "Clinics/RegressionTable.qmd", - "skill_file": "skills/Clinics/RegressionTable_skill.md" - }, - { - "name": "Circular Packing Chart", - "category": "Composition", - "language": "R", - "packages": [ - "circlepackeR", - "cowplot", - "data.tree", - "dplyr", - "flare", - "ggiraph", - "ggplot2", - "ggraph", - "htmlwidgets", - "igraph", - "packcircles", - "tidyr", - "tidyverse", - "viridis" - ], - "use_when": "Circular Packing can be viewed as a special type of classification tree diagram, which is particularly suitable for displaying classification data with hierarchical relationships.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/CircularPacking.html", - "skill": "# Skill: Circular Packing Chart (R)\n\n## Category\nComposition\n\n## When to Use\nCircular Packing can be viewed as a special type of classification tree diagram, which is particularly suitable for displaying classification data with hierarchical relationships.\n\n## Required R Packages\n- circlepackeR\n- cowplot\n- data.tree\n- dplyr\n- flare\n- ggiraph\n- ggplot2\n- ggraph\n- htmlwidgets\n- igraph\n- packcircles\n- tidyr\n- tidyverse\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(circlepackeR)\nlibrary(cowplot)\nlibrary(data.tree)\nlibrary(dplyr)\nlibrary(flare)\nlibrary(ggiraph)\n\n# Prepare data\n#GO BP\ndata_BP <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_BP.csv\")\n\n#flare\ndata_edges <- flare$edges\ndata_vertices <- flare$vertices\n\n#KEGG\ndata_KEGG <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_KEGG.csv\")\n\n#KEGG_type\ndata_KEGG_type <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_KEGG_type.csv\")\ndata_KEGG_type$pvalue_log <- -log10(data_KEGG_type$pvalue)\nsummary(data_KEGG_type)\ndata_KEGG_type1 <- data_KEGG_type %>%\n dplyr::select(type, subtype, PW, pvalue_log, NES) %>%\n arrange(type, subtype)\n\n# Create visualization\n## color\ndata_BP1 <- data_BP\ndata_BP1$pvalue_log <- -log10(data_BP1$pvalue)\npacking_BP <- circleProgressiveLayout(data_BP1$pvalue_log, sizetype='area' )\n\n\n# Merging plotting data\ndata_BUBBLE_BP <- cbind(data_BP1, packing_BP)\n\n# Generate the coordinates of each vertex of the circle, where npoint is the number of vertices.\ndat.gg_BP <- circleLayoutVertices(packing_BP, npoints=50)\n\n# plot\np <- ggplot() + \n geom_polygon(data = dat.gg_BP, \n aes(x, y, group = id, fill=as.factor(id)), \n colour = \"black\", alpha = 0.6) +\n scale_fill_manual(values = magma(nrow(data_BUBBLE_BP))) + # change color\n geom_text(data = data_BUBBLE_BP,\n aes(x, y, size=pvalue_log, label = str_wrap(BP,width = 10)),\n show.legend = FALSE) +\n scale_size_continuous(range = c(0.5,1.5)) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `group`: Maps `id` to the group aesthetic\n- `fill`: Maps `NES` to the fill aesthetic\n- `size`: Maps `pvalue_log` to the size aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Ensure proportions sum to 100% and consider using a colorblind-friendly palette\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Composition/CircularPacking.html\n", - "source_file": "Composition/CircularPacking.qmd", - "skill_file": "skills/Composition/CircularPacking_skill.md" - }, - { - "name": "Dendrogram", - "category": "Composition", - "language": "R", - "packages": [ - "collapsibleTree", - "dendextend", - "ggraph", - "igraph", - "tidyverse" - ], - "use_when": "A dendrogram is a graphical representation of hierarchical relationships between objects. It is widely used in cluster analysis, especially hierarchical clustering, to visualize the similarity or distance between data points.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/Dendrogram.html", - "skill": "# Skill: Dendrogram (R)\n\n## Category\nComposition\n\n## When to Use\nA dendrogram is a graphical representation of hierarchical relationships between objects. It is widely used in cluster analysis, especially hierarchical clustering, to visualize the similarity or distance between data points.\n\n## Required R Packages\n- collapsibleTree\n- dendextend\n- ggraph\n- igraph\n- tidyverse\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(collapsibleTree)\nlibrary(dendextend)\nlibrary(ggraph)\nlibrary(igraph)\nlibrary(tidyverse)\n\n# Prepare data\n# warpbreaks\ndata(\"warpbreaks\")\nwarpbreaks <- warpbreaks %>%\n mutate(breaks = as.character(breaks))\n\n# Convert nested dataframe data to side list data and then draw a tree diagram.\nedges_level1_2 <- warpbreaks %>%\n select(wool, tension) %>%\n distinct() %>%\n rename(from = wool, to = tension)\n\nedges_level2_3 <- warpbreaks %>%\n select(tension, breaks) %>%\n distinct() %>%\n rename(from = tension, to = breaks)\n\nedge_list <- bind_rows(edges_level1_2, edges_level2_3) # merge\nedge_list_unique <- edge_list[edge_list$from != \"B\",]\nedge_list_unique$to <- make.unique(edge_list_unique$to)\n\n\n# Create a graph object\nmygraph_unique <- graph_from_data_frame(edge_list_unique)\n\n# Hierarchical grouping\nV(mygraph_unique)$group <- case_when(\n V(mygraph_unique)$name %in% unique(warpbreaks$wool) ~ \"Group 1\", # root node wool\n str_detect(V(mygraph_unique)$name, \"^[LMH]\") ~ \"Group 2\", # First layer of tension\n str_detect(V(mygraph_unique)$name, \"^[0-9]\") ~ \"Group 3\", # Second layer breaks\n TRUE ~ \"Group 4\" # Additional correction layer\n)\nV(mygraph_unique)$color <- case_when(\n V(mygraph_unique)$group == \"Group 1\" ~ \"red\",\n V(mygraph_unique)$group == \"Group 2\" ~ \"yellow\",\n V(mygraph_unique)$group == \"Group 3\" ~ \"green\",\n V(mygraph_unique)$group == \"Group 4\" ~ \"blue\"\n)\n\n# mtcars\nmtcars %>% \n select(mpg, cyl, disp) %>% \n dist() %>% \n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `color`: Maps `color` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Ensure proportions sum to 100% and consider using a colorblind-friendly palette\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Composition/Dendrogram.html\n", - "source_file": "Composition/Dendrogram.qmd", - "skill_file": "skills/Composition/Dendrogram_skill.md" - }, - { - "name": "Donut Chart", - "category": "Composition", - "language": "R", - "packages": [ - "ggplot2" - ], - "use_when": "A donut chart is a circular plot divided into sectors, each sector representing a part of the whole. It is very similar to a pie chart and can be constructed in ggplot2 and basic R.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/Donut.html", - "skill": "# Skill: Donut Chart (R)\n\n## Category\nComposition\n\n## When to Use\nA donut chart is a circular plot divided into sectors, each sector representing a part of the whole. It is very similar to a pie chart and can be constructed in ggplot2 and basic R.\n\n## Required R Packages\n- ggplot2\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ggplot2)\n\n# Prepare data\n# 1.TCGA database (clinical data on lung cancer in 2020)\nTCGA_cli_df <- readr::read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/raponi2006_public_raponi2006_public_clinicalMatrix.gz\")\n\n# 2.R built-in data - mtcars\nhead(mtcars)\n\n# Create visualization\n# Data Preparation\ncounts <- table(TCGA_cli_df$T)\ncounts <- as.data.frame(counts)\nnames(counts)[names(counts) == \"Var1\"] <- \"T\"\n# Calculate percentage\ncounts$fraction = counts$Freq / sum(counts$Freq)\n# Calculate the cumulative percentage (the value at the top of each rectangle).\ncounts$ymax = cumsum(counts$fraction)\n# Calculate the bottom of each rectangle to determine the starting position\ncounts$ymin = c(0, head(counts$ymax, n=-1))\n# Plot\np <- ggplot(counts, aes(ymax=ymax, ymin=ymin, xmax=4, xmin=3, fill=T)) +\n geom_rect() +\n coord_polar(theta=\"y\") + \n xlim(c(2, 4)) \n\np\n```\n\n## Key Parameters\n- `fill`: Maps `cyl` to the fill aesthetic\n- `y`: Maps `labelPosition` to the y aesthetic\n- `color`: Maps `cyl` to the color aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Ensure proportions sum to 100% and consider using a colorblind-friendly palette\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Composition/Donut.html\n", - "source_file": "Composition/Donut.qmd", - "skill_file": "skills/Composition/Donut_skill.md" - }, - { - "name": "Grouped and Stacked Barplot", - "category": "Composition", - "language": "R", - "packages": [ - "RColorBrewer", - "dplyr", - "ggplot2", - "hrbrthemes", - "streamgraph", - "tibble", - "tidyr", - "viridis" - ], - "use_when": "Grouped bar charts, or clustered bar charts, extend the functionality of univariate or single-category bar charts to multivariate bar charts. In these charts, bars are grouped according to their categories, and colors represent distinguishing factors for other categorical variables. The bars are positioned to cater to a group or primary group, with colors representing secondary categories. Grouped bar charts are particularly suitable for displaying the distribution of multiple groups of categ...", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/GroupedBarplot.html", - "skill": "# Skill: Grouped and Stacked Barplot (R)\n\n## Category\nComposition\n\n## When to Use\nGrouped bar charts, or clustered bar charts, extend the functionality of univariate or single-category bar charts to multivariate bar charts. In these charts, bars are grouped according to their categories, and colors represent distinguishing factors for other categorical variables. The bars are positioned to cater to a group or primary group, with colors representing secondary categories. Grouped bar charts are particularly suitable for displaying the distribution of multiple groups of categ...\n\n## Required R Packages\n- RColorBrewer\n- dplyr\n- ggplot2\n- hrbrthemes\n- streamgraph\n- tibble\n- tidyr\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(hrbrthemes)\nlibrary(streamgraph)\nlibrary(tibble)\n\n# Prepare data\n# iris\niris_means <- iris %>%\n group_by(Species) %>%\n summarise(\n mean_sepal_length = mean(Sepal.Length),\n mean_sepal_width = mean(Sepal.Width),\n mean_petal_length = mean(Petal.Length),\n mean_petal_width = mean(Petal.Width)\n ) # Calculate the mean of the four columns for each species.\n\niris_means_long <- iris_means %>%\n pivot_longer(\n cols = starts_with(\"mean\"),\n names_to = \"Measurement\",\n values_to = \"Value\"\n )\n\niris_means_df <- as.data.frame(iris_means) %>%\n column_to_rownames(var = \"Species\")\niris_matrix <- as.matrix(iris_means_df)\niris_percentage <- apply(iris_matrix, 2, function(x) { x * 100 / sum(x, na.rm = TRUE) })\n\n# TCGA-CHOL.methylation450\nTCGA_methylation <- readr::read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-CHOL.methylation450_.tsv\")\n\nmethylation_subset <- TCGA_methylation[c(5:9),c(4:13)]\nmethylation_subset <- as.data.frame(methylation_subset)\nrownames(methylation_subset) <- c(\"cg236\", \"cg289\", \"cg292\", \"cg321\", \"cg363\")\ncolnames(methylation_subset) <- substr(colnames(methylation_subset), 9, 12)\n\nmethylation_long <- methylation_subset %>%\n rownames_to_column(var = \"Composite\") %>%\n pivot_longer(cols = -Composite, names_to = \"sample\", values_to = \"value\")\n\nmethylation_long$sample <- as.numeric(factor(methylation_long$sample, levels = unique(methylation_long$sample))) # Convert the sample column to ordered values.\n\n# TCGA-STAD.star_counts\nTCGA_star <- readr::read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-STAD.star_counts.tsv\")\n\nselected_rows <- TCGA_star[TCGA_star$Ensembl_ID %in% c(\"ENSG00000141510.18\", \n \"ENSG00000141736.14\", \n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `fill`: Maps `Measurement` to the fill aesthetic\n- `y`: Maps `Mean_Value` to the y aesthetic\n- `x`: Maps `Gene` to the x aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- Ensure proportions sum to 100% and consider using a colorblind-friendly palette\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Composition/GroupedBarplot.html\n", - "source_file": "Composition/GroupedBarplot.qmd", - "skill_file": "skills/Composition/GroupedBarplot_skill.md" - }, - { - "name": "Part highlights the pie chart", - "category": "Composition", - "language": "R", - "packages": [ - "dplyr", - "ggforce", - "ggplot2", - "ggpubr", - "patchwork", - "plotrix" - ], - "use_when": "Create a Part highlights the pie chart visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/PartPieChart.html", - "skill": "# Skill: Part highlights the pie chart (R)\n\n## Category\nComposition\n\n## When to Use\nCreate a Part highlights the pie chart visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- dplyr\n- ggforce\n- ggplot2\n- ggpubr\n- patchwork\n- plotrix\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggforce)\nlibrary(ggplot2)\nlibrary(ggpubr)\nlibrary(patchwork)\nlibrary(plotrix)\n\n# Prepare data\n# Generate simulated data\ncount.data <- data.frame(\n class = c(\"1st\", \"2nd\", \"3rd\", \"Crew\"),\n n = c(325, 285, 706, 885),\n prop = c(14.8, 12.9, 32.1, 40.2)\n)\n# Add label position\ncount.data <- count.data %>%\n arrange(desc(class)) %>%\n mutate(lab.ypos = cumsum(prop) - 0.5*prop)\n# View the final merged dataset\nhead(count.data)\n\n# Create visualization\n# Basic pie chart\nmycols <- c(\"#0073C2FF\", \"#EFC000FF\", \"#868686FF\", \"#CD534CFF\")\np <- \n ggplot(count.data, aes(x = \"\", y = prop, fill = class)) +\n geom_bar(width = 1, stat = \"identity\", color = \"white\") +\n coord_polar(\"y\", start = 0)+\n geom_text(aes(y = lab.ypos, label = prop), color = \"white\")+\n scale_fill_manual(values = mycols) +\n theme_void()\n\np\n```\n\n## Key Parameters\n- `y`: Maps `lab` to the y aesthetic\n- `fill`: Maps `gene` to the fill aesthetic\n- `x`: Maps `2` to the x aesthetic\n- `color`: Maps `gene` to the color aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- The tutorial includes a '2. Advanced Plot' section with advanced styling options\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Ensure proportions sum to 100% and consider using a colorblind-friendly palette\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Composition/PartPieChart.html\n", - "source_file": "Composition/PartPieChart.qmd", - "skill_file": "skills/Composition/PartPieChart_skill.md" - }, - { - "name": "Pie Chart", - "category": "Composition", - "language": "R", - "packages": [ - "ggplot2" - ], - "use_when": "A pie chart is a basic chart in statistics, using sectors of different sizes to represent the magnitude of each item. A pie chart provides a visual understanding of the proportion of each data point within the overall data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/PieChart.html", - "skill": "# Skill: Pie Chart (R)\n\n## Category\nComposition\n\n## When to Use\nA pie chart is a basic chart in statistics, using sectors of different sizes to represent the magnitude of each item. A pie chart provides a visual understanding of the proportion of each data point within the overall data.\n\n## Required R Packages\n- ggplot2\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ggplot2)\n\n# Prepare data\n# Data writing: one column for grouping, one column for values.\ndata <- data.frame(\n group = c(\"I\", \"II\", \"III\", \"IV\", \"NA\"),\n value = c(402, 955, 1252, 3343, 3567)\n)\n\nhead(data)\n\n# Create visualization\n# Basic drawing - bar chart\np <- ggplot(data, aes(x = \"\", y = value, fill = group)) +\n geom_col() # First, draw a bar chart, then transform it into a pie chart using coord_polar().\n\np\n```\n\n## Key Parameters\n- `y`: Maps `value` to the y aesthetic\n- `fill`: Maps `group` to the fill aesthetic\n- `x`: Maps `rep_len` to the x aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Ensure proportions sum to 100% and consider using a colorblind-friendly palette\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Composition/PieChart.html\n", - "source_file": "Composition/PieChart.qmd", - "skill_file": "skills/Composition/PieChart_skill.md" - }, - { - "name": "Treemap", - "category": "Composition", - "language": "R", - "packages": [ - "DOSE", - "palmerpenguins", - "tidyverse", - "treemap" - ], - "use_when": "A treemap, also known as a rectangular tree structure diagram, is composed of multiple nested rectangles of varying areas. The sum of the areas of all rectangles represents the overall data. The area of each smaller rectangle represents the proportion of each sub-item; the larger the rectangle's area, the larger the proportion of that sub-item within the whole.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/Treemap.html", - "skill": "# Skill: Treemap (R)\n\n## Category\nComposition\n\n## When to Use\nA treemap, also known as a rectangular tree structure diagram, is composed of multiple nested rectangles of varying areas. The sum of the areas of all rectangles represents the overall data. The area of each smaller rectangle represents the proportion of each sub-item; the larger the rectangle's area, the larger the proportion of that sub-item within the whole.\n\n## Required R Packages\n- DOSE\n- palmerpenguins\n- tidyverse\n- treemap\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(DOSE)\nlibrary(palmerpenguins)\nlibrary(tidyverse)\nlibrary(treemap)\n\n# Prepare data\ndata_USArrests <- rownames_to_column(USArrests[1:8,], \"State\")\n\ndata_swiss <- swiss\n\ndata_countsub <- aggregate(penguins, by=list(penguins$species, penguins$sex),length)\ndata_countsub <- data_countsub[ ,1:3]\ncolnames(data_countsub) <- c(\"species\", \"sex\", \"count\")\n\ndata_BP <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_BP.csv\")\ndata_BP <- data_BP[order(abs(data_BP$NES), decreasing = T),]\ndata_BP <- data_BP[1:13,]\n\ndata_KEGG_type <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_KEGG.csv\")\ndata_KEGG_type$pvalue_log <- -log10(data_KEGG_type$pvalue)\n\n# Create visualization\ntreemap(data_USArrests, # data\n index = \"State\", # Categorical variables\n vSize = \"Murder\", # Categorical variable corresponding data values\n vColor=\"State\", # The corresponding columns of color depth, here the data size is used as the corresponding\n type = \"index\", # Color mapping method, including \"index\", \"value\", \"comp\", \"dens\", \"depth\", \"categorical\", \"color\", and \"manual\".\n title = 'Murder', # title\n border.col = \"grey\", # Border color\n border.lwds = 4, # Border line width\n fontsize.labels = 12, # Label size\n fontcolor.labels = 'red', # Label color\n align.labels = list(c(\"center\", \"center\")), # Tag location\n fontface.labels = 2) # Tag fonts: 1, 2, 3, 4 represent normal, bold, italic, and bold italic fonts, respectively.\n```\n\n## Key Parameters\n- `width`: Controls element width\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Ensure proportions sum to 100% and consider using a colorblind-friendly palette\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Composition/Treemap.html\n", - "source_file": "Composition/Treemap.qmd", - "skill_file": "skills/Composition/Treemap_skill.md" - }, - { - "name": "Waffle Chart", - "category": "Composition", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "waffle" - ], - "use_when": "A waffle chart visually represents categorical data using a grid of small squares that resemble waffles. Each category is assigned a unique color, and the number of squares assigned to each category corresponds to its proportion in the total data count.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/Waffle.html", - "skill": "# Skill: Waffle Chart (R)\n\n## Category\nComposition\n\n## When to Use\nA waffle chart visually represents categorical data using a grid of small squares that resemble waffles. Each category is assigned a unique color, and the number of squares assigned to each category corresponds to its proportion in the total data count.\n\n## Required R Packages\n- dplyr\n- ggplot2\n- waffle\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(waffle)\n\n# Prepare data\n# 1.TCGA database (clinical data on lung cancer in 2020)\nTCGA_cli_df <- readr::read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/raponi2006_public_raponi2006_public_clinicalMatrix.gz\")\n# Data Preparation\ncounts <- table(TCGA_cli_df$T)\ncounts <- as.data.frame(counts)\nnames(counts)[names(counts) == \"Var1\"] <- \"T\"\n\n# 2.R built-in data - mtcars\ncounts1 <- table(mtcars$cyl)\ncounts1 <- as.data.frame(counts1)\nnames(counts1)[names(counts1) == \"Var1\"] <- \"cyl\"\n\n# 3.Self-created dataset\ndata <- data.frame(\n group = c(\"First group\", \"First group\", \"First group\", \"First group\",\n \"First group\", \"First group\", \"Second group\", \"Second group\",\n \"Second group\", \"Second group\", \"Third group\", \"Third group\"),\n subgroup = c(\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"A\", \"B\", \"C\", \"D\", \"A\", \"B\"),\n value = c(10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120)\n)\n\n# Create visualization\nwaffle(counts)\n```\n\n## Key Parameters\n- `fill`: Maps `subgroup` to the fill aesthetic\n- `theme`: Plot theme; tutorial uses `theme_void()`\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- Ensure proportions sum to 100% and consider using a colorblind-friendly palette\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Composition/Waffle.html\n", - "source_file": "Composition/Waffle.qmd", - "skill_file": "skills/Composition/Waffle_skill.md" - }, - { - "name": "Biplot", - "category": "Correlation", - "language": "R", - "packages": [ - "dplyr", - "ggbiplot" - ], - "use_when": "Create a Biplot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Biplot.html", - "skill": "# Skill: Biplot (R)\n\n## Category\nCorrelation\n\n## When to Use\nCreate a Biplot visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- dplyr\n- ggbiplot\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggbiplot)\n\n# Prepare data\ndata(\"iris\")\nhead(iris)\n\n# Create visualization\niris.gg <-\n ggbiplot(iris.pca, obs.scale = 1, var.scale = 1,\n groups = iris$Species, point.size=2,\n varname.size = 3, \n varname.color = \"black\",\n varname.adjust = 1.2,\n ellipse = TRUE, \n circle = TRUE) +\n labs(fill = \"Species\", color = \"Species\") +\n theme_minimal(base_size = 14) +\n theme(legend.direction = 'horizontal', legend.position = 'top')\n\niris.gg\n```\n\n## Key Parameters\n- `x`: Maps `xvar` to the x aesthetic\n- `y`: Maps `yvar` to the y aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Always check and report the correlation coefficient and p-value alongside visual patterns\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Correlation/Biplot.html\n", - "source_file": "Correlation/Biplot.qmd", - "skill_file": "skills/Correlation/Biplot_skill.md" - }, - { - "name": "Bubble Plot", - "category": "Correlation", - "language": "R", - "packages": [ - "dplyr", - "gapminder", - "ggplot2", - "hrbrthemes", - "viridis" - ], - "use_when": "A bubble plot is a scatter plot in which a third numeric variable is mapped to the size of the circles. This article shows several ways to build bubble charts using R.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Bubble.html", - "skill": "# Skill: Bubble Plot (R)\n\n## Category\nCorrelation\n\n## When to Use\nA bubble plot is a scatter plot in which a third numeric variable is mapped to the size of the circles. This article shows several ways to build bubble charts using R.\n\n## Required R Packages\n- dplyr\n- gapminder\n- ggplot2\n- hrbrthemes\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(gapminder)\nlibrary(ggplot2)\nlibrary(hrbrthemes)\nlibrary(viridis)\n\n# Prepare data\n# R built-in data - iris\nhead(iris)\n\n# TCGA database (using clinical data on lung cancer in 2020)\nTCGA_clinic <- readr::read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/raponi2006_public_raponi2006_public_clinicalMatrix.gz\")\nTCGA_clinic$T <- as.factor(TCGA_clinic$T)\n\n# gapminder package\ndata <- gapminder %>% \n filter(year==\"2007\") %>% \n dplyr::select(-year)\n\n# Create visualization\n# Taking iris data as an example\np <- ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, size = Species)) +\n geom_point(alpha=0.4)\n\np\n```\n\n## Key Parameters\n- `x`: Maps `Sepal` to the x aesthetic\n- `y`: Maps `Sepal` to the y aesthetic\n- `size`: Maps `Species` to the size aesthetic\n- `color`: Maps `Species` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_ipsum()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Always check and report the correlation coefficient and p-value alongside visual patterns\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Correlation/Bubble.html\n", - "source_file": "Correlation/Bubble.qmd", - "skill_file": "skills/Correlation/Bubble_skill.md" - }, - { - "name": "ComplexHeatmap", - "category": "Correlation", - "language": "R", - "packages": [ - "ComplexHeatmap", - "circlize", - "dendextend", - "gridExtra", - "pheatmap", - "tidyr" - ], - "use_when": "Create a ComplexHeatmap visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/ComplexHeatmap.html", - "skill": "# Skill: ComplexHeatmap (R)\n\n## Category\nCorrelation\n\n## When to Use\nCreate a ComplexHeatmap visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- ComplexHeatmap\n- circlize\n- dendextend\n- gridExtra\n- pheatmap\n- tidyr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ComplexHeatmap)\nlibrary(circlize)\nlibrary(dendextend)\nlibrary(gridExtra)\nlibrary(pheatmap)\nlibrary(tidyr)\n\n# Prepare data\n# data_mat (continuous)\ndata <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA.BRCA.sampleMap_HumanMethylation27_ch.csv\")\n\ndata <- as.data.frame(data)\nrownames(data) <- data[,1]\ndata <- data[,-1]\n\ndata_TCGA <- na.omit(data[1:20,1:20])\n\ndata_TCGA <- as.matrix(data_TCGA) \n\n# Discrete\ndiscrete_mat = matrix(sample(1:5, 100, replace = TRUE), 10, 10)\n\n# Create visualization\n# Continuous variables\nHeatmap(data_TCGA , name = \"Methylation\")\n```\n\n## Key Parameters\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- The tutorial includes a '2. Customization' section with advanced styling options\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Always check and report the correlation coefficient and p-value alongside visual patterns\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Correlation/ComplexHeatmap.html\n", - "source_file": "Correlation/ComplexHeatmap.qmd", - "skill_file": "skills/Correlation/ComplexHeatmap_skill.md" - }, - { - "name": "Connected Scatter", - "category": "Correlation", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "stringr" - ], - "use_when": "Connected scatter is a type of chart that builds upon scatter by adding lines to connect the data points in a certain order. It allows us to discern not only the correlation between independent variable and dependent variable but also the trend in the data points.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/ConnectedScatter.html", - "skill": "# Skill: Connected Scatter (R)\n\n## Category\nCorrelation\n\n## When to Use\nConnected scatter is a type of chart that builds upon scatter by adding lines to connect the data points in a certain order. It allows us to discern not only the correlation between independent variable and dependent variable but also the trend in the data points.\n\n## Required R Packages\n- dplyr\n- ggplot2\n- stringr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(stringr)\n\n# Prepare data\n# 1.Load iris data\ndata(\"iris\", package = \"datasets\")\ndata <- iris\n\n# 2. Load and filter time series data\n# To simplify the plotting process, only the data from December is selected to represent the entire year\ndata_economics <- economics %>%\n select(date, psavert, uempmed) %>%\n filter(str_detect(date, \"-12-01\")) %>%\n slice_head(n = 25) %>%\n mutate(date = str_extract(date, \"^\\\\d{4}\")) %>% #extracts the 4-digit year from the beginning of each date string.\n select(date, psavert, uempmed)\n\n# 3.Load gene expression data (first two rows)\ndata_counts <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/GSE243555_all_genes_with_counts.txt\", sep = \"\\t\", header = TRUE, nrows = 10)\n\naxis_names <- data_counts[c(1, 2), 1] # Save names\n\ndata_counts <- data_counts %>% \n select(-1) %>% # Remove first column\n slice(1:2) %>% # remain the first two rows\n t() %>% # Transpose\n as.data.frame() %>%\n setNames(c(\"V1\", \"V2\")) # Set column names\n\nhead(data_counts)\n\n# Create visualization\n# Basic plotting, only adding `geom_line`\np <- ggplot(data[data$Species == \"setosa\", ], aes(x = Sepal.Width, y = Sepal.Length)) +\n geom_point(shape = 17, size = 1.5, color = \"blue\") +\n geom_line()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `Sepal` to the x aesthetic\n- `y`: Maps `Sepal` to the y aesthetic\n- `color`: Maps `Species` to the color aesthetic\n- `shape`: Maps `Species` to the shape aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Always check and report the correlation coefficient and p-value alongside visual patterns\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Correlation/ConnectedScatter.html\n", - "source_file": "Correlation/ConnectedScatter.qmd", - "skill_file": "skills/Correlation/ConnectedScatter_skill.md" - }, - { - "name": "Correlogram", - "category": "Correlation", - "language": "R", - "packages": [ - "GGally", - "corrgram", - "corrplot", - "ggcorrplot" - ], - "use_when": "Correlogram or Correlation diagrams are often used to summarize the correlation information of various groups of data in the entire dataset.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Correlogram.html", - "skill": "# Skill: Correlogram (R)\n\n## Category\nCorrelation\n\n## When to Use\nCorrelogram or Correlation diagrams are often used to summarize the correlation information of various groups of data in the entire dataset.\n\n## Required R Packages\n- GGally\n- corrgram\n- corrplot\n- ggcorrplot\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(GGally)\nlibrary(corrgram)\nlibrary(corrplot)\nlibrary(ggcorrplot)\n\n# Prepare data\ndata(\"flea\", package = \"GGally\")\ndata_flea <- flea\n\ndata(\"mtcars\", package = \"datasets\")\ndata_mtcars <- mtcars\n\ndata(\"tips\", package = \"GGally\")\ndata_tips <- tips\n```\n\n## Key Parameters\n- `colour`: Maps `species` to the colour aesthetic\n- `alpha`: Maps `0` to the alpha aesthetic\n- `stat`: Statistical transformation to use\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Always check and report the correlation coefficient and p-value alongside visual patterns\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Correlation/Correlogram.html\n", - "source_file": "Correlation/Correlogram.qmd", - "skill_file": "skills/Correlation/Correlogram_skill.md" - }, - { - "name": "2D Density", - "category": "Correlation", - "language": "R", - "packages": [ - "MASS", - "RColorBrewer", - "ggplot2", - "hexbin", - "mvtnorm", - "patchwork", - "plotly" - ], - "use_when": "A 2D density plot shows the distribution of a combination of two numerical variables, using color gradients (or contour lines) to indicate the number of observations within an area. This can be used to identify trends in a dataset and analyze relationships between two variables. Scatter plots can be difficult to interpret when displaying large datasets because the points overlap and cannot be individually distinguished. In these cases, a two-dimensional density plot is useful.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Density2D.html", - "skill": "# Skill: 2D Density (R)\n\n## Category\nCorrelation\n\n## When to Use\nA 2D density plot shows the distribution of a combination of two numerical variables, using color gradients (or contour lines) to indicate the number of observations within an area. This can be used to identify trends in a dataset and analyze relationships between two variables. Scatter plots can be difficult to interpret when displaying large datasets because the points overlap and cannot be individually distinguished. In these cases, a two-dimensional density plot is useful.\n\n## Required R Packages\n- MASS\n- RColorBrewer\n- ggplot2\n- hexbin\n- mvtnorm\n- patchwork\n- plotly\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(MASS)\nlibrary(RColorBrewer)\nlibrary(ggplot2)\nlibrary(hexbin)\nlibrary(mvtnorm)\nlibrary(patchwork)\n\n# Prepare data\n# mtcars\ndata_mtcars <- mtcars[, c(\"mpg\", \"hp\")]\n\n# TCGA-BRCA.star_counts\ntcga_raw <- readr::read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.star_counts.tsv\")\n\ntcga_tp53_mdm2 <- tcga_raw[tcga_raw$Ensembl_ID %in% c(\"ENSG00000141510.18\", \"ENSG00000131747.15\"), ]\nTP53_values <- tcga_tp53_mdm2[1, -1]\nMDM2_values <- tcga_tp53_mdm2[2, -1]\n\ndata_tcga <- data.frame(TP53 = as.numeric(TP53_values),\n MDM2 = as.numeric(MDM2_values))\n\n# Create visualization\n# 2D Histogram\np <- ggplot(data_tcga, aes(x = TP53, y = MDM2)) +\n geom_bin2d() +\n labs(fill = \"Gene_expression\\n(STAR_counts)\") + \n theme_bw()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `TP53` to the x aesthetic\n- `y`: Maps `MDM2` to the y aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Always check and report the correlation coefficient and p-value alongside visual patterns\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Correlation/Density2D.html\n", - "source_file": "Correlation/Density2D.qmd", - "skill_file": "skills/Correlation/Density2D_skill.md" - }, - { - "name": "Heatmap", - "category": "Correlation", - "language": "R", - "packages": [ - "ComplexHeatmap", - "RColorBrewer", - "circlize", - "cowplot", - "d3heatmap", - "dplyr", - "ggplot2", - "gridExtra", - "heatmaply", - "hrbrthemes", - "htmlwidgets", - "lattice", - "pheatmap", - "plotly", - "readr", - "tibble", - "tidyr", - "tidyverse", - "viridis" - ], - "use_when": "A heatmap is a powerful visualization tool that represents matrix values through color gradients. It is widely used to illustrate gene expression differences across sample groups, variations in compound concentrations, and pairwise sample similarities. More broadly, any tabular dataset can be structured into a heatmap to enhance interpretability.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Heatmap.html", - "skill": "# Skill: Heatmap (R)\n\n## Category\nCorrelation\n\n## When to Use\nA heatmap is a powerful visualization tool that represents matrix values through color gradients. It is widely used to illustrate gene expression differences across sample groups, variations in compound concentrations, and pairwise sample similarities. More broadly, any tabular dataset can be structured into a heatmap to enhance interpretability.\n\n## Required R Packages\n- ComplexHeatmap\n- RColorBrewer\n- circlize\n- cowplot\n- d3heatmap\n- dplyr\n- ggplot2\n- gridExtra\n- heatmaply\n- hrbrthemes\n- htmlwidgets\n- lattice\n- pheatmap\n- plotly\n- readr\n- tibble\n- tidyr\n- tidyverse\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ComplexHeatmap)\nlibrary(RColorBrewer)\nlibrary(circlize)\nlibrary(cowplot)\nlibrary(d3heatmap)\nlibrary(dplyr)\n\n# Prepare data\n# load built-in R datasets `mtcars`\ndata(\"mtcars\", package = \"datasets\")\nmtcars_matrix <- as.matrix(mtcars)\n\n# Load and process methylation data\nraw_methylation_data <- readr::read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-CHOL.methylation450.tsv\")\n\n# Convert to matrix and clean up row/column names\nmethylation_matrix <- raw_methylation_data[, -1] %>%\n as.data.frame() %>%\n `rownames<-`(raw_methylation_data$Composite)\n\n# Tidy to long format\nmethylation_long <- methylation_matrix %>%\n rownames_to_column(\"Composite\") %>%\n pivot_longer(cols = -Composite, names_to = \"Sample\", values_to = \"Methylation_Level\") %>%\n mutate(\n Methylation_Level = as.numeric(Methylation_Level),\n Composite = gsub(\"^cg0+\", \"cg\", Composite),\n Sample = substr(Sample, 9, 12)\n )\n\n# Standardize methylation values\nmethylation_long_standardized <- methylation_long %>%\n group_by(Composite) %>%\n mutate(Standardized_Level = scale(Methylation_Level)[,1]) %>%\n ungroup()\n\n# Convert back to wide format matrix\nstandardized_methylation_matrix <- methylation_long_standardized %>%\n select(Composite, Sample, Standardized_Level) %>%\n pivot_wider(names_from = Sample, values_from = Standardized_Level) %>%\n column_to_rownames(\"Composite\") %>%\n as.matrix()\n\n\n# Clean up raw methylation matrix (numerical version for raw heatmap)\nmethylation_matrix_num <- methylation_matrix %>%\n mutate(across(everything(), ~ as.numeric(as.character(.)))) %>%\n `rownames<-`(gsub(\"^cg0+\", \"cg\", rownames(.))) %>%\n { `colnames<-`(., substr(colnames(.), 9, 12)) } %>%\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `Sample` to the x aesthetic\n- `y`: Maps `Composite` to the y aesthetic\n- `fill`: Maps `Standardized_Level` to the fill aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_ipsum()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Always check and report the correlation coefficient and p-value alongside visual patterns\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Correlation/Heatmap.html\n", - "source_file": "Correlation/Heatmap.qmd", - "skill_file": "skills/Correlation/Heatmap_skill.md" - }, - { - "name": "PCA Plot", - "category": "Correlation", - "language": "R", - "packages": [ - "FactoMineR", - "dplyr", - "factoextra", - "ggfortify", - "ggplot2" - ], - "use_when": "Create a PCA Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/PCAplot.html", - "skill": "# Skill: PCA Plot (R)\n\n## Category\nCorrelation\n\n## When to Use\nCreate a PCA Plot visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- FactoMineR\n- dplyr\n- factoextra\n- ggfortify\n- ggplot2\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(FactoMineR)\nlibrary(dplyr)\nlibrary(factoextra)\nlibrary(ggfortify)\nlibrary(ggplot2)\n\n# Prepare data\ndata(\"iris\")\nhead(iris)\n\n# Create visualization\nfviz_eig(iris.pca, \n addlabels = TRUE, \n ylim = c(0, 85),\n main = \"PCA variance explained proportion\",\n xlab = \"PC\",\n ylab = \"Percentage of variance explained\")\n```\n\n## Key Parameters\n- `x`: Maps `PC1` to the x aesthetic\n- `y`: Maps `PC2` to the y aesthetic\n- `color`: Maps `Species` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Always check and report the correlation coefficient and p-value alongside visual patterns\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Correlation/PCAplot.html\n", - "source_file": "Correlation/PCAplot.qmd", - "skill_file": "skills/Correlation/PCAplot_skill.md" - }, - { - "name": "Scatter Plot", - "category": "Correlation", - "language": "R", - "packages": [ - "dplyr", - "geomtextpath", - "ggExtra", - "ggplot2", - "ggpmisc", - "ggpubr", - "plotly" - ], - "use_when": "A scatter plot is a basic visualization chart used to represent the general trend of the dependent variable changing with the independent variable.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Scatter.html", - "skill": "# Skill: Scatter Plot (R)\n\n## Category\nCorrelation\n\n## When to Use\nA scatter plot is a basic visualization chart used to represent the general trend of the dependent variable changing with the independent variable.\n\n## Required R Packages\n- dplyr\n- geomtextpath\n- ggExtra\n- ggplot2\n- ggpmisc\n- ggpubr\n- plotly\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(geomtextpath)\nlibrary(ggExtra)\nlibrary(ggplot2)\nlibrary(ggpmisc)\nlibrary(ggpubr)\n\n# Prepare data\n# 1.Load iris data\ndata <- iris\n\n# 2.Load gene expression data (first two rows)\ndata_counts <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/GSE243555_all_genes_with_counts.txt\", sep = \"\\t\", header = TRUE, nrows = 10) \n\naxis_names <- data_counts[c(1, 2), 1] # Save names\ndata_counts <- data_counts %>% \n select(-1) %>% # Remove first column\n slice(1:2) %>% # remain the first two rows\n t() %>% # Transpose\n as.data.frame() %>%\n setNames(c(\"V1\", \"V2\")) # Set column names\n\nhead(data_counts)\n\n# Create visualization\n# Basic plotting\np <- ggplot(data, aes(x = Sepal.Width, y = Sepal.Length)) +\n geom_point()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `Sepal` to the x aesthetic\n- `y`: Maps `Sepal` to the y aesthetic\n- `color`: Maps `Species` to the color aesthetic\n- `shape`: Maps `Species` to the shape aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Always check and report the correlation coefficient and p-value alongside visual patterns\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Correlation/Scatter.html\n", - "source_file": "Correlation/Scatter.qmd", - "skill_file": "skills/Correlation/Scatter_skill.md" - }, - { - "name": "Ternary chart", - "category": "Correlation", - "language": "R", - "packages": [ - "ggtern", - "ggthemes" - ], - "use_when": "A ternary chart is a type of chart used to display the proportional relationship between three variables. These three variables typically represent a certain component (such as chemical composition, species ratio, nutritional structure, etc.), and their sum is a constant, with the most common being 1 or 100%. A ternary chart uses an equilateral triangle to represent the proportional relationship between these three variables, with each point's position reflecting the relative proportion of th...", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/TernaryPlot.html", - "skill": "# Skill: Ternary chart (R)\n\n## Category\nCorrelation\n\n## When to Use\nA ternary chart is a type of chart used to display the proportional relationship between three variables. These three variables typically represent a certain component (such as chemical composition, species ratio, nutritional structure, etc.), and their sum is a constant, with the most common being 1 or 100%. A ternary chart uses an equilateral triangle to represent the proportional relationship between these three variables, with each point's position reflecting the relative proportion of th...\n\n## Required R Packages\n- ggtern\n- ggthemes\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ggtern)\nlibrary(ggthemes)\n\n# Prepare data\n# Load data\ndata <- read.table(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/Tern_data.txt\", header=T, row.names=1, sep=\"\\t\", comment.char = \"\")\n# View data\nhead(data[,1:5])\n\n# Create visualization\n# Basic Ternary Chart\np1_1 <- ggtern(data=data, aes(x=CK, y=NPK, z=NPKM)) +\n geom_mask() +\n geom_point(aes(size=size,color=Genus),alpha=0.8)\np1_1\n```\n\n## Key Parameters\n- `x`: Maps `CK` to the x aesthetic\n- `y`: Maps `NPK` to the y aesthetic\n- `size`: Maps `size` to the size aesthetic\n- `color`: Maps `Genus` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `theme`: Plot theme; tutorial uses `theme_tropical()`\n\n## Tips\n- The tutorial includes a '3. Beautify plots' section with advanced styling options\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Always check and report the correlation coefficient and p-value alongside visual patterns\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Correlation/TernaryPlot.html\n", - "source_file": "Correlation/TernaryPlot.qmd", - "skill_file": "skills/Correlation/TernaryPlot_skill.md" - }, - { - "name": "UMAP Plot", - "category": "Correlation", - "language": "R", - "packages": [ - "RColorBrewer", - "Seurat", - "SeuratData", - "dplyr", - "ggplot2", - "mlbench", - "patchwork", - "umap" - ], - "use_when": "Create a UMAP Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/UMAPplot.html", - "skill": "# Skill: UMAP Plot (R)\n\n## Category\nCorrelation\n\n## When to Use\nCreate a UMAP Plot visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- RColorBrewer\n- Seurat\n- SeuratData\n- dplyr\n- ggplot2\n- mlbench\n- patchwork\n- umap\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(Seurat)\nlibrary(SeuratData)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(mlbench)\n\n# Prepare data\ndata(BreastCancer)\nwdbc_data <- BreastCancer[, -1] # Remove the ID column\nwdbc_data <- na.omit(wdbc_data)\nfeatures <- wdbc_data[, 1:9] # Using the first 9 features\nfeatures <- as.data.frame(lapply(features, function(x) as.numeric(as.character(x))))\ndiagnosis <- wdbc_data$Class\nhead(features)\n\n# Create visualization\nset.seed(123)\nwdbc_umap <- umap(features, \n n_neighbors = 15, \n min_dist = 0.2,\n metric = \"euclidean\")\n\nggplot(data.frame(wdbc_umap$layout, Diagnosis = diagnosis),\n aes(X1, X2, color = Diagnosis)) +\n geom_point(size = 3, alpha = 0.8) +\n stat_ellipse(level = 0.9) +\n theme_minimal() +\n labs(title = \"UMAP of Wisconsin Breast Cancer Dataset\",\n x = \"UMAP1\", y = \"UMAP2\",\n subtitle = \"n_neighbors=15, min_dist=0.2\") +\n scale_color_manual(values = c(\"benign\" = \"#1b9e77\", \"malignant\" = \"#d95f02\"))\n```\n\n## Key Parameters\n- `color`: Maps `CellType` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Always check and report the correlation coefficient and p-value alongside visual patterns\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Correlation/UMAPplot.html\n", - "source_file": "Correlation/UMAPplot.qmd", - "skill_file": "skills/Correlation/UMAPplot_skill.md" - }, - { - "name": "Area Chart", - "category": "DataOverTime", - "language": "R", - "packages": [ - "dygraphs", - "ggpattern", - "hrbrthemes", - "tidyverse", - "viridis", - "xts" - ], - "use_when": "An area chart is a line chart in which the area below the line is filled with color. It is mainly used to display values at continuous intervals or over a time span.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/AreaChart.html", - "skill": "# Skill: Area Chart (R)\n\n## Category\nDataOverTime\n\n## When to Use\nAn area chart is a line chart in which the area below the line is filled with color. It is mainly used to display values at continuous intervals or over a time span.\n\n## Required R Packages\n- dygraphs\n- ggpattern\n- hrbrthemes\n- tidyverse\n- viridis\n- xts\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dygraphs)\nlibrary(ggpattern)\nlibrary(hrbrthemes)\nlibrary(tidyverse)\nlibrary(viridis)\nlibrary(xts)\n\n# Prepare data\n# TCGA-BRCA.survival.tsv\ntcga_brca_survival <- readr::read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.survival.tsv\")\n\ntcga_brca_filtered <- tcga_brca_survival %>%\n filter(OS.time <= 2000) %>%\n mutate(month = floor(OS.time / 30))\n\nmonthly_death_counts <- tcga_brca_filtered %>%\n filter(OS == 1) %>%\n group_by(month) %>%\n summarise(deaths = n())\n\n# AirPassengers\ndata(\"AirPassengers\")\nair_passenger_data <- as.data.frame(AirPassengers)\n\nair_passenger_data$Month <- rep(month.name, 12)\nair_passenger_data$Year <- rep(1949:1960, each=12)\nair_passenger_data$x <- as.numeric(air_passenger_data$x)\n\nair_passenger_long <- air_passenger_data %>%\n gather(key = \"Variable\", value = \"Value\", -Year, -Month)\n\nair_passenger_percentage <- air_passenger_long %>%\n group_by(Year) %>%\n mutate(Percentage = Value / sum(Value) * 100) # Calculate the percentage for each month\n\nair_passenger_time_series <- data.frame(datetime = time(AirPassengers), count = as.vector(AirPassengers))\n\nair_passenger_time_series$datetime <- as.Date(air_passenger_time_series$datetime)\nair_passenger_xts <- xts(x = air_passenger_time_series$count, order.by = air_passenger_time_series$datetime) # Creating an XTS object\n\n# Create visualization\n# Basic area plot\np <- ggplot(monthly_death_counts, aes(x = month, y = deaths)) +\n geom_area() +\n labs(title = \"Cumulative Deaths Over Time\",\n x = \"Months\",\n y = \"Number of Deaths\")\n\np\n```\n\n## Key Parameters\n- `x`: Maps `Year` to the x aesthetic\n- `y`: Maps `Percentage` to the y aesthetic\n- `fill`: Maps `Month` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `theme`: Plot theme; tutorial uses `theme_ipsum()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Highlight key time points or events with vertical reference lines or annotations\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/DataOverTime/AreaChart.html\n", - "source_file": "DataOverTime/AreaChart.qmd", - "skill_file": "skills/DataOverTime/AreaChart_skill.md" - }, - { - "name": "Calend Highlight", - "category": "DataOverTime", - "language": "R", - "packages": [ - "calendR" - ], - "use_when": "Date highlighting marks are mainly used to display changes in data within certain specific date ranges in time series data, and can be used for an overview of activity frequencies and marking of special dates.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/CalendHighlight.html", - "skill": "# Skill: Calend Highlight (R)\n\n## Category\nDataOverTime\n\n## When to Use\nDate highlighting marks are mainly used to display changes in data within certain specific date ranges in time series data, and can be used for an overview of activity frequencies and marking of special dates.\n\n## Required R Packages\n- calendR\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(calendR)\n\n# Prepare data\n# Construct data\nset.seed(1)\ndata <- rnorm(365)\n\n# View data\nhead(data)\n\n# Create visualization\n# Chinese Calendar\np <- calendR(\n\tyear = 2025,\n\tmonth = NULL,\n\tfrom = NULL,\n\tto = NULL,\n\tstart = \"M\",\n\tmbg.col = 2,\n\t# orientation = \"portrait\",\n\tmonths.col = \"white\",\n\tmonths.pos = 0.5,\n\tmonthnames = c(\n\t\t\"一月\",\n\t\t\"二月\",\n\t\t\"三月\",\n\t\t\"四月\",\n\t\t\"五月\",\n\t\t\"六月\",\n\t\t\"七月\",\n\t\t\"八月\",\n\t\t\"九月\",\n\t\t\"十月\",\n\t\t\"十一月\",\n\t\t\"十二月\"\n\t),\n\tweeknames = c(\"一\", \"二\", \"三\", \"四\", \"五\", \"六\", \"日\"),\n\tspecial.days = data,\n\tspecial.col = \"#00338888\",\n\tgradient = TRUE,\n\tlow.col = \"#FFFFFF88\",\n\tfont.family = \"sans\",\n\tfont.style = \"plain\",\n\tday.size = 2,\n\t# ncol = 2,\n\tlunar = FALSE,\n\tpdf = FALSE\n)\n\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Highlight key time points or events with vertical reference lines or annotations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/DataOverTime/CalendHighlight.html\n", - "source_file": "DataOverTime/CalendHighlight.qmd", - "skill_file": "skills/DataOverTime/CalendHighlight_skill.md" - }, - { - "name": "Line Chart", - "category": "DataOverTime", - "language": "R", - "packages": [ - "dplyr", - "gghighlight", - "ggplot2", - "ggpmisc", - "patchwork", - "viridis" - ], - "use_when": "Drawing line segments in various charts is common, and this module will draw all kinds of line segments that may be used.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/LineChart.html", - "skill": "# Skill: Line Chart (R)\n\n## Category\nDataOverTime\n\n## When to Use\nDrawing line segments in various charts is common, and this module will draw all kinds of line segments that may be used.\n\n## Required R Packages\n- dplyr\n- gghighlight\n- ggplot2\n- ggpmisc\n- patchwork\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(gghighlight)\nlibrary(ggplot2)\nlibrary(ggpmisc)\nlibrary(patchwork)\nlibrary(viridis)\n\n# Prepare data\n# 1.iris data\ndata <- iris\n\nhead(data)\n\n# 2.economics data\n# (1) Using economics data directly to draw graphs\n# (2) Processing economics data to draw time series graphs\ndata_economics <- economics[,c(1, 4, 5)] %>%\n filter(grepl(\"-12-01\", date)) %>% # Select only December data for plotting\n mutate(date = gsub(\"-.*\", \"\", date)) %>% # Only keep the year\n slice(1:25) %>% # Choose the first 25 years\n arrange(date) # Sort\n\nhead(data_economics)\n\n# 3.Automatically generate data (for log transformation of the y-axis).\ndata_create <- data.frame(\n x = seq(11, 100),\n y = seq(11, 100) / 2 + rnorm(90)\n)\n\nhead(data_create)\n\n# 4.Glucose level (used to emphasize specific line segments)\ndata_glucose <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/Dexcom_001.csv\", header = T)\n\n# Glucose value data processing\ndata_glucose <- data_glucose[,c(2, 8)] %>%\n slice(1:102) %>%\n setNames(c(\"V1\", \"V2\")) %>%\n filter(!is.na(V2) & V1 != \"\") %>% # Remove na\n mutate(V3 = rep(1:30, times = 3), # Divided into 3 stages\n group = rep(c(\"stage one\", \"stage two\", \"stage three\"), each = 30))\n\nhead(data_glucose)\n\n# Create visualization\n# Basic Plotting\np <- ggplot(data, aes(x = Sepal.Length, y = Sepal.Width)) +\n geom_line()\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `date` to the x aesthetic\n- `y`: Maps `uempmed` to the y aesthetic\n- `color`: Maps `group` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Highlight key time points or events with vertical reference lines or annotations\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/DataOverTime/LineChart.html\n", - "source_file": "DataOverTime/LineChart.qmd", - "skill_file": "skills/DataOverTime/LineChart_skill.md" - }, - { - "name": "Stacked Area Chart", - "category": "DataOverTime", - "language": "R", - "packages": [ - "babynames", - "dplyr", - "ggplot2", - "hrbrthemes", - "plotly", - "tidyverse", - "viridis" - ], - "use_when": "Stacked area charts are similar to basic area charts, except that each dataset in the chart starts from the previous dataset and is used to show the trend line of how the size of each value changes over time or category, demonstrating the relationship between the part and the whole.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/StackedArea.html", - "skill": "# Skill: Stacked Area Chart (R)\n\n## Category\nDataOverTime\n\n## When to Use\nStacked area charts are similar to basic area charts, except that each dataset in the chart starts from the previous dataset and is used to show the trend line of how the size of each value changes over time or category, demonstrating the relationship between the part and the whole.\n\n## Required R Packages\n- babynames\n- dplyr\n- ggplot2\n- hrbrthemes\n- plotly\n- tidyverse\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(babynames)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(hrbrthemes)\nlibrary(plotly)\nlibrary(tidyverse)\n\n# Prepare data\n# data_WorldPhones\ndata_WorldPhones <- as.data.frame(WorldPhones)\ndata_WorldPhones <- rownames_to_column(data_WorldPhones,\"year\")\ndata_WorldPhones <- data_WorldPhones %>%\n gather(key = \"area\",value = \"Phones\",-\"year\" )\ndata_WorldPhones$year <- as.numeric(data_WorldPhones$year)\n\n# data_USPersonalExpenditure\ndata_USPersonalExpenditure <- USPersonalExpenditure\ndata_USPersonalExpenditure <- as.data.frame(data_USPersonalExpenditure)\ndata_USPersonalExpenditure <- rownames_to_column(data_USPersonalExpenditure,\"type\")\ndata_USPersonalExpenditure <- data_USPersonalExpenditure %>%\n gather(key = \"year\",value = \"expense\",-\"type\" )\ndata_USPersonalExpenditure$year <- as.numeric(data_USPersonalExpenditure$year)\n\n# data_baby\ndata_baby <- babynames %>% \n filter(name %in% c(\"Ashley\", \"Amanda\", \"Jessica\", \"Patricia\", \"Linda\", \"Deborah\", \"Dorothy\", \"Betty\", \"Helen\")) %>%\n filter(sex==\"F\")\n\n# data_covi19\ndata_covi19 <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_covi19.csv\")\ndata_covi19$date <- c(6:12)\ndata_covi19 <- gather(data_covi19, key = \"area\", value = \"cases\", 2:7)\n\n# Create visualization\n# Basic stacked area diagram----\noptions(scipen = 20) # Do not use scientific notation\np <- ggplot(data_WorldPhones, aes(x=year, y=Phones, fill=area)) + \n geom_area()+\n scale_y_continuous(limits = c(0, 150000),\n breaks = seq(0, 150000,50000))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `year` to the x aesthetic\n- `y`: Maps `n` to the y aesthetic\n- `fill`: Maps `name` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_ipsum()`\n\n## Tips\n- The tutorial includes a '3. Customization' section with advanced styling options\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Highlight key time points or events with vertical reference lines or annotations\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/DataOverTime/StackedArea.html\n", - "source_file": "DataOverTime/StackedArea.qmd", - "skill_file": "skills/DataOverTime/StackedArea_skill.md" - }, - { - "name": "Streamgraph", - "category": "DataOverTime", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "ggstream", - "htmlwidgets", - "streamgraph" - ], - "use_when": "A Streamgraph is a stacked area diagram. It represents the evolution of numerical variables across multiple groups. Typically, it displays areas around a central axis with rounded edges to create a flowing shape.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/Streamgraph.html", - "skill": "# Skill: Streamgraph (R)\n\n## Category\nDataOverTime\n\n## When to Use\nA Streamgraph is a stacked area diagram. It represents the evolution of numerical variables across multiple groups. Typically, it displays areas around a central axis with rounded edges to create a flowing shape.\n\n## Required R Packages\n- dplyr\n- ggplot2\n- ggstream\n- htmlwidgets\n- streamgraph\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(ggstream)\nlibrary(htmlwidgets)\nlibrary(streamgraph)\n\n# Prepare data\n# 1.R's built-in data - ChickWeight\n## This dataset contains 50 samples in total. The dataset chick_new_2 below selects 5 representative samples with a Diet value of 1.\nchick_new_1 <- subset(ChickWeight,Diet==\"1\")\nchick_new_2 <- chick_new_1[c(1:12,144:155,73:95,156:167),]\n\n# 2.Data on COVID-19 infections in 2020 (data source: GISAID database)\n## The following data was obtained through data processing, where covid_all represents the total number of people infected with COVID-19 in different regions each month.\ncovid_all <- readr::read_csv(\n\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/covid_all.csv\")\nhead(covid_all)\ncovid_month <- readr::read_csv(\n\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/covid_month.csv\")\nhead(covid_month)\n\n# Create visualization\nstreamgraph(covid_all, key = \"location\",\n value = \"count\",date = \"time\",\n height=\"300px\", width=\"1000px\")\n```\n\n## Key Parameters\n- `fill`: Maps `Chick` to the fill aesthetic\n- `color`: Maps `Chick` to the color aesthetic\n- `width`: Controls element width\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Highlight key time points or events with vertical reference lines or annotations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/DataOverTime/Streamgraph.html\n", - "source_file": "DataOverTime/Streamgraph.qmd", - "skill_file": "skills/DataOverTime/Streamgraph_skill.md" - }, - { - "name": "Timeseries", - "category": "DataOverTime", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "patchwork" - ], - "use_when": "A time series graph is a statistical chart with time on the horizontal axis and the observed variable on the vertical axis, reflecting the trend of the observed variable over time.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/Timeseries.html", - "skill": "# Skill: Timeseries (R)\n\n## Category\nDataOverTime\n\n## When to Use\nA time series graph is a statistical chart with time on the horizontal axis and the observed variable on the vertical axis, reflecting the trend of the observed variable over time.\n\n## Required R Packages\n- dplyr\n- ggplot2\n- patchwork\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(patchwork)\n\n# Prepare data\n# 1.economics dataset\ndata <- economics[1:60, c(1, 4)]\n\nhead(data)\n\ndata_double <- economics[1:60, c(1, 4, 5)] # This data is used for subplot merging and dual y-axis.\n\nhead(data_double)\n\n# 2.Quantitative dehydration estimation data\ndata_water <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/dehydration_estimation.csv\", header = T)\n\naxis_name <- colnames(data_water)[c(5, 8)] # Record column names\ndata_water <- data_water %>% # Select 2 sets of data\n slice(c(19:27, 46:54)) %>%\n select(c(1, 5, 8)) %>% \n setNames(c(\"V1\", \"V2\", \"V3\")) %>% # Change column name\n mutate(V4 = case_when(V1 == 3 ~ \"people1\", # Column V4 serves as category labels.\n V1 == 6 ~ \"people2\"))\n\nhead(data_water)\n\n# Create visualization\n# Basic plot\np <- ggplot(data, aes(x = date, y = psavert)) +\n geom_line() +\n xlab(\"\")\n\np\n```\n\n## Key Parameters\n- `x`: Maps `V2` to the x aesthetic\n- `y`: Maps `V3` to the y aesthetic\n- `group`: Maps `V4` to the group aesthetic\n- `color`: Maps `V4` to the color aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Highlight key time points or events with vertical reference lines or annotations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/DataOverTime/Timeseries.html\n", - "source_file": "DataOverTime/Timeseries.qmd", - "skill_file": "skills/DataOverTime/Timeseries_skill.md" - }, - { - "name": "Beeswarm Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "beeswarm", - "ggbeeswarm", - "ggsignif", - "plyr", - "readr", - "tidyverse" - ], - "use_when": "A beeswarm plot disperses data points slightly to prevent overlap, making distribution density and trends clearer. It is especially useful for visualizing categorical data in small datasets. This section presents examples using R and the `beeswarm` and `ggbeeswarm` packages.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/Beeswarm.html", - "skill": "# Skill: Beeswarm Plot (R)\n\n## Category\nDistribution\n\n## When to Use\nA beeswarm plot disperses data points slightly to prevent overlap, making distribution density and trends clearer. It is especially useful for visualizing categorical data in small datasets. This section presents examples using R and the `beeswarm` and `ggbeeswarm` packages.\n\n## Required R Packages\n- beeswarm\n- ggbeeswarm\n- ggsignif\n- plyr\n- readr\n- tidyverse\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(beeswarm)\nlibrary(ggbeeswarm)\nlibrary(ggsignif)\nlibrary(plyr)\nlibrary(readr)\nlibrary(tidyverse)\n\n# Prepare data\n# Load iris dataset\ndata(\"iris\")\n\n# Load the TCGA-LIHC gene expression dataset from a processed CSV file \nTCGA_gene_expression <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-LIHC.star_fpkm_processed.csv\")\n\n# Load the TCGA-LIHC clinical info dataset\nTCGA_clinic <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA.LIHC.clinicalMatrix.csv\") %>%\n mutate(T = as.factor(T))\n\n#Prepare Statistics data\ndata_summary <- function(data, varname, groupnames) {\n summary_func <- function(x, col) {\n c(mean = mean(x[[col]], na.rm = TRUE),\n sd = sd(x[[col]], na.rm = TRUE))\n }\n data_sum <- ddply(data, groupnames, .fun = summary_func, varname)\n \n data_sum <- rename_with(data_sum, ~ varname, \"mean\")\n \n return(data_sum)\n}\niris_sum <- data_summary(iris, varname=\"Sepal.Length\", groupnames=\"Species\")\nTCGA_gene_sum <- data_summary(TCGA_gene_expression, varname=\"gene_expression\", groupnames=\"sample\")\n\n# Create visualization\np1 <- beeswarm(iris$Sepal.Length)\n```\n\n## Key Parameters\n- `y`: Maps `Sepal` to the y aesthetic\n- `x`: Maps `Species` to the x aesthetic\n- `colour`: Maps `T` to the colour aesthetic\n- `fill`: Maps `Species` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- The tutorial includes a '8. Customization of the Beeswarm Plot (`ggbeeswarm` package)' section with advanced styling options\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Distribution/Beeswarm.html\n", - "source_file": "Distribution/Beeswarm.qmd", - "skill_file": "skills/Distribution/Beeswarm_skill.md" - }, - { - "name": "Box Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "dplyr", - "ggExtra", - "ggplot2", - "ggpmisc", - "ggpubr", - "ggtext", - "hrbrthemes", - "readr", - "rstatix", - "viridis" - ], - "use_when": "Boxplots visualize the central tendency and dispersion of one or more sets of continuous quantitative data. They incorporate statistical measures that not only compare differences across categories but also reveal dispersion, outliers, and distribution patterns.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/BoxPlot.html", - "skill": "# Skill: Box Plot (R)\n\n## Category\nDistribution\n\n## When to Use\nBoxplots visualize the central tendency and dispersion of one or more sets of continuous quantitative data. They incorporate statistical measures that not only compare differences across categories but also reveal dispersion, outliers, and distribution patterns.\n\n## Required R Packages\n- dplyr\n- ggExtra\n- ggplot2\n- ggpmisc\n- ggpubr\n- ggtext\n- hrbrthemes\n- readr\n- rstatix\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggExtra)\nlibrary(ggplot2)\nlibrary(ggpmisc)\nlibrary(ggpubr)\nlibrary(ggtext)\n\n# Prepare data\n# Load mtcars dataset\ndata(\"mtcars\")\ndata_mtcars <- mtcars\n\n# Load mpg dataset from ggplot2 package\ndata_mpg <- ggplot2::mpg\n\n# Load diamonds dataset from ggplot2 package\ndata_diamonds <- ggplot2::diamonds\n\n# Load the TCGA-BRCA gene expression dataset from a processed CSV file \ndata_TCGA <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.htseq_counts_processed.csv\")\ndata_TCGA1 <- data_TCGA[1:5,] %>%\n gather(key = \"sample\",value = \"gene_expression\",3:1219)\n```\n\n## Key Parameters\n- `x`: Maps `class` to the x aesthetic\n- `y`: Maps `hwy` to the y aesthetic\n- `fill`: Maps `type` to the fill aesthetic\n- `alpha`: Maps `type` to the alpha aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_ipsum()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Distribution/BoxPlot.html\n", - "source_file": "Distribution/BoxPlot.qmd", - "skill_file": "skills/Distribution/BoxPlot_skill.md" - }, - { - "name": "Break Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "RColorBrewer", - "dplyr", - "ggbreak", - "ggplot2", - "ggpubr", - "rstatix" - ], - "use_when": "Create a Break Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/BreakPlot.html", - "skill": "# Skill: Break Plot (R)\n\n## Category\nDistribution\n\n## When to Use\nCreate a Break Plot visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- RColorBrewer\n- dplyr\n- ggbreak\n- ggplot2\n- ggpubr\n- rstatix\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(dplyr)\nlibrary(ggbreak)\nlibrary(ggplot2)\nlibrary(ggpubr)\nlibrary(rstatix)\n\n# Prepare data\n# Data Preparation\ndf <- ToothGrowth %>%\n group_by(supp, dose) %>%\n summarise(\n mean_len = mean(len),\n sd_len = sd(len),\n n = n(),\n se_len = sd_len/sqrt(n),\n .groups = 'drop')\n\n\n# Statistical tests (key repair points)\nstat.test <- ToothGrowth %>%\n group_by(dose) %>%\n t_test(len ~ supp) %>%\n add_xy_position(x = \"dose\", dodge = 0.8)\n\nhead(df)\n\n# Create visualization\n# Basic BarPlot\np1 <- ggplot(df, aes(x=dose, y=mean_len, fill=supp)) +\n geom_col(position=position_dodge(0.4), width=0.2) +\n geom_errorbar(aes(ymin=mean_len-sd_len, ymax=mean_len+sd_len),\n width=0.1, position=position_dodge(0.4)) +\n scale_y_continuous(breaks = seq(0, 30, 5)) +\n scale_y_cut(breaks=c(15), which=1, scales=1.5) +\n labs(x=\"Dose (mg/day)\", y=\"Tooth Length (mm)\") +\n theme_classic()\n\np1\n```\n\n## Key Parameters\n- `x`: Maps `dose` to the x aesthetic\n- `y`: Maps `len` to the y aesthetic\n- `fill`: Maps `supp` to the fill aesthetic\n- `color`: Maps `supp` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- The tutorial includes a '4. More advanced charts' section with advanced styling options\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Distribution/BreakPlot.html\n", - "source_file": "Distribution/BreakPlot.qmd", - "skill_file": "skills/Distribution/BreakPlot_skill.md" - }, - { - "name": "Density Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "cowplot", - "dplyr", - "geomtextpath", - "ggExtra", - "ggplot2", - "ggpmisc", - "ggpubr", - "hrbrthemes", - "readr", - "tidyr", - "viridis" - ], - "use_when": "A density plot represents the distribution of a numerical variable using kernel density estimation to display the probability density function. It is a smoothed version of a histogram, sharing the same concept but providing a clearer representation of the overall trend and shape of the data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/Density.html", - "skill": "# Skill: Density Plot (R)\n\n## Category\nDistribution\n\n## When to Use\nA density plot represents the distribution of a numerical variable using kernel density estimation to display the probability density function. It is a smoothed version of a histogram, sharing the same concept but providing a clearer representation of the overall trend and shape of the data.\n\n## Required R Packages\n- cowplot\n- dplyr\n- geomtextpath\n- ggExtra\n- ggplot2\n- ggpmisc\n- ggpubr\n- hrbrthemes\n- readr\n- tidyr\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(dplyr)\nlibrary(geomtextpath)\nlibrary(ggExtra)\nlibrary(ggplot2)\nlibrary(ggpmisc)\n\n# Prepare data\n# Read the TSV data \ndata <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-LIHC.htseq_counts.csv.gz\")\n\n# Filter and reshape data for the first gene TSPAN6 (Ensembl ID: ENSG00000000003.13)\ndata1 <- data %>% \n filter(Ensembl_ID == \"ENSG00000000003.13\") %>% \n pivot_longer( \n cols = -Ensembl_ID, \n names_to = \"sample\", \n values_to = \"expression\" \n ) %>% \n mutate(var = \"var1\") # Add a column to differentiate the variables \n\n# Filter and reshape data for the second gene SCYL3 (Ensembl ID: ENSG00000000457.12)\ndata2 <- data %>% \n filter(Ensembl_ID == \"ENSG00000000457.12\") %>% \n pivot_longer( \n cols = -Ensembl_ID, \n names_to = \"sample\", \n values_to = \"expression\" \n ) %>% \n mutate(var = \"var2\") # Add a column to differentiate the variables \n\n# Combine the two datasets \ndata12 <- bind_rows(data1, data2) \n\n# View the final combined dataset \nhead(data12)\n\n# Create visualization\n# Basic Density Plot \np1 <- ggplot(data1, aes(x = expression)) + \n geom_density(fill = \"#69b3a2\", color = \"#e9ecef\", alpha = 0.8) + \n labs(title = \"Density Plot of TSPAN6 Expression Levels\", \n x = \"Expression\", \n y = \"Density\") + \n theme_minimal() \np1\n```\n\n## Key Parameters\n- `x`: Maps `Petal` to the x aesthetic\n- `fill`: Maps `Species` to the fill aesthetic\n- `group`: Maps `cut` to the group aesthetic\n- `color`: Maps `Species` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Distribution/Density.html\n", - "source_file": "Distribution/Density.qmd", - "skill_file": "skills/Distribution/Density_skill.md" - }, - { - "name": "Histogram", - "category": "Distribution", - "language": "R", - "packages": [ - "cowplot", - "ggExtra", - "ggplot2", - "ggpmisc", - "ggpubr", - "readr", - "tidyverse", - "viridis" - ], - "use_when": "A histogram uses rectangular bars to represent the frequency of data within specific intervals, where the total area of the bars corresponds to the total frequency. It is primarily used to visualize the distribution of continuous variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/Histogram.html", - "skill": "# Skill: Histogram (R)\n\n## Category\nDistribution\n\n## When to Use\nA histogram uses rectangular bars to represent the frequency of data within specific intervals, where the total area of the bars corresponds to the total frequency. It is primarily used to visualize the distribution of continuous variables.\n\n## Required R Packages\n- cowplot\n- ggExtra\n- ggplot2\n- ggpmisc\n- ggpubr\n- readr\n- tidyverse\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(ggExtra)\nlibrary(ggplot2)\nlibrary(ggpmisc)\nlibrary(ggpubr)\nlibrary(readr)\n\n# Prepare data\n# Read the TSV data\ndata <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-LIHC.htseq_counts.csv.gz\")\n\n# Filter and reshape data for the first gene TSPAN6 (Ensembl ID: ENSG00000000003.13)\ndata1 <- data %>%\n filter(Ensembl_ID == \"ENSG00000000003.13\") %>%\n pivot_longer(\n cols = -Ensembl_ID, \n names_to = \"sample\", \n values_to = \"expression\"\n ) %>%\n mutate(var = \"var1\") # Add a column to differentiate the variables\n\n# Filter and reshape data for the second gene SCYL3 (Ensembl ID: ENSG00000000457.12)\ndata2 <- data %>%\n filter(Ensembl_ID == \"ENSG00000000457.12\") %>%\n pivot_longer(\n cols = -Ensembl_ID, \n names_to = \"sample\", \n values_to = \"expression\"\n ) %>%\n mutate(var = \"var2\") # Add a column to differentiate the variables\n\n# Combine the two datasets\ndata12 <- bind_rows(data1, data2)\n\n# View the final combined dataset\nhead(data12)\n\n# Create visualization\n# Basic Histogram\np1 <- ggplot(data1, aes(x = expression)) +\n geom_histogram() + \n labs(x = \"Gene Expression\", y = \"Count\")\n\np1\n```\n\n## Key Parameters\n- `x`: Maps `value` to the x aesthetic\n- `y`: Maps `after_stat` to the y aesthetic\n- `fill`: Maps `Species` to the fill aesthetic\n- `color`: Maps `Species` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Distribution/Histogram.html\n", - "source_file": "Distribution/Histogram.qmd", - "skill_file": "skills/Distribution/Histogram_skill.md" - }, - { - "name": "Radial Column Chart", - "category": "Distribution", - "language": "R", - "packages": [ - "dplyr", - "ggforce", - "ggplot2", - "scales" - ], - "use_when": "Create a Radial Column Chart visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/RadialColumnChart.html", - "skill": "# Skill: Radial Column Chart (R)\n\n## Category\nDistribution\n\n## When to Use\nCreate a Radial Column Chart visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- dplyr\n- ggforce\n- ggplot2\n- scales\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggforce)\nlibrary(ggplot2)\nlibrary(scales)\n\n# Prepare data\n# Data reading and processing code can be displayed freely------\n# Generate simulated clinical data\nset.seed(123)\nn <- 12 # Sample size\n\ndf <- data.frame(\n id = 1:n,\n patient = paste0(\"P-\", sprintf(\"%02d\", 1:n)),\n value = c(rnorm(6, 80, 15), rnorm(6, 120, 20)), # Control group and treatment group\n group = rep(c(\"Control\", \"Treatment\"), each = 6)\n) %>%\n mutate(\n angle = 90 - 360 * (id - 0.5)/n,\n hjust = ifelse(angle < -90, 1, 0),\n angle = ifelse(angle < -90, angle + 180, angle)\n )\n\n# Adding built-in datasets\ndata(\"iris\")\n\n# Create visualization\n# Basic histogram\np1 <- ggplot(df, aes(x = factor(id), y = value)) +\n geom_col(aes(fill = group), width = 0.8, alpha = 0.8) +\n coord_radial(inner.radius = 0.3) +\n scale_fill_manual(values = c(\"#1E88E5\", \"#D81B60\")) +\n theme_void() +\n labs(title = \"Comparison of indicators between the treatment group and the control group\")\np1\n```\n\n## Key Parameters\n- `x`: Maps `id` to the x aesthetic\n- `fill`: Maps `group` to the fill aesthetic\n- `y`: Maps `value` to the y aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- The tutorial includes a '2. More advanced charts' section with advanced styling options\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Distribution/RadialColumnChart.html\n", - "source_file": "Distribution/RadialColumnChart.qmd", - "skill_file": "skills/Distribution/RadialColumnChart_skill.md" - }, - { - "name": "Ridgeline Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "ggridges", - "hrbrthemes", - "readr", - "viridis" - ], - "use_when": "A ridgeline plot, also known as a joyplot, visualizes the distribution of multiple numeric variables across different categories. This method is useful for comparing density distributions while preserving an overall view of trends and variations.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/Ridgeline.html", - "skill": "# Skill: Ridgeline Plot (R)\n\n## Category\nDistribution\n\n## When to Use\nA ridgeline plot, also known as a joyplot, visualizes the distribution of multiple numeric variables across different categories. This method is useful for comparing density distributions while preserving an overall view of trends and variations.\n\n## Required R Packages\n- dplyr\n- ggplot2\n- ggridges\n- hrbrthemes\n- readr\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(ggridges)\nlibrary(hrbrthemes)\nlibrary(readr)\nlibrary(viridis)\n\n# Prepare data\n# Load iris dataset\ndata(\"iris\")\n\n# Load Lung Cancer (Raponi 2006) clinical data\nTCGA_clinic <- readr::read_tsv(\"https://ucsc-public-main-xena-hub.s3.us-east-1.amazonaws.com/download/raponi2006_public%2Fraponi2006_public_clinicalMatrix.gz\") %>%\n mutate(T = as.factor(T))\nhead(TCGA_clinic)\n\n# Create visualization\n# Basic Ridgeline plot\np1_1 <- ggplot(iris, aes(x = Sepal.Length, y = Species, fill = Species)) +\n geom_density_ridges(alpha = 0.5) +\n theme_ridges(font_size = 16, grid = TRUE) +\n theme(legend.position = \"right\")\n\np1_1\n```\n\n## Key Parameters\n- `x`: Maps `OS` to the x aesthetic\n- `y`: Maps `T` to the y aesthetic\n- `fill`: Maps `T` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_ipsum()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Distribution/Ridgeline.html\n", - "source_file": "Distribution/Ridgeline.qmd", - "skill_file": "skills/Distribution/Ridgeline_skill.md" - }, - { - "name": "Violin Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "dplyr", - "forcats", - "gghalves", - "ggplot2", - "ggpubr", - "ggstatsplot", - "hrbrthemes", - "palmerpenguins", - "readr", - "tidyr", - "viridis" - ], - "use_when": "A violin plot combines elements of a density plot and a box plot to visualize data distribution. It displays key statistical information, including the median, quartiles, minimum, and maximum values. Violin plots are particularly useful for comparing distributions across different groups, offering a more intuitive representation than traditional box plots by revealing the shape of the data distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/ViolinPlot.html", - "skill": "# Skill: Violin Plot (R)\n\n## Category\nDistribution\n\n## When to Use\nA violin plot combines elements of a density plot and a box plot to visualize data distribution. It displays key statistical information, including the median, quartiles, minimum, and maximum values. Violin plots are particularly useful for comparing distributions across different groups, offering a more intuitive representation than traditional box plots by revealing the shape of the data distribution.\n\n## Required R Packages\n- dplyr\n- forcats\n- gghalves\n- ggplot2\n- ggpubr\n- ggstatsplot\n- hrbrthemes\n- palmerpenguins\n- readr\n- tidyr\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(forcats)\nlibrary(gghalves)\nlibrary(ggplot2)\nlibrary(ggpubr)\nlibrary(ggstatsplot)\n\n# Prepare data\n# Load the TCGA-BRCA gene expression dataset from a processed CSV file \ndata_counts <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.htseq_counts_processed.csv\")\n\n# Load built-in R dataset iris\ndata_wide <- iris[ , 1:4] # Take the data in columns 1-4 of the iris database as an example\n\n# Load built-in R dataset penguins\ndata(\"penguins\", package = \"palmerpenguins\")\ndata_penguins <- drop_na(penguins) # Remove missing values\n\n# Manually create a demonstration dataset with grouped values \ndata <- data.frame(\n name=c( rep(\"A\",500), rep(\"B\",500), rep(\"B\",500), rep(\"C\",20), rep('D', 100) ),\n value=c( rnorm(500, 10, 5), rnorm(500, 13, 1), rnorm(500, 18, 1), rnorm(20, 25, 4), rnorm(100, 12, 1) )\n )\nsample_size <- data %>% \n group_by(name) %>% \n summarize(num=n()) # Compute the sample size for each group\n\n# Create visualization\n# Basic Violin Plot\np <- ggplot(data, aes(x=name, y=value, fill=name)) + \n geom_violin()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `gene_name` to the x aesthetic\n- `y`: Maps `gene_expression` to the y aesthetic\n- `fill`: Maps `gene_name` to the fill aesthetic\n- `color`: Maps `gene_name` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Use `coord_flip()` for horizontal orientation when labels are long\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Consider adding `geom_jitter()` or raw data points alongside distribution plots for small sample sizes\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Distribution/ViolinPlot.html\n", - "source_file": "Distribution/ViolinPlot.qmd", - "skill_file": "skills/Distribution/ViolinPlot_skill.md" - }, - { - "name": "Area Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The area chart displays graphically quantitative data. It is based on the line chart. The area between axis and line are commonly emphasized with colors, textures and hatchings.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/001-area.html", - "skill": "# Skill: Area Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nThe area chart displays graphically quantitative data. It is based on the line chart. The area between axis and line are commonly emphasized with colors, textures and hatchings.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/area/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Area Plot\np <- ggplot(data, aes(x = xaxis.value, y = yaxis.value, fill = group)) +\n geom_area(alpha = 1) +\n ylab(\"yaxis.value\") +\n xlab(\"xaxis.value\") +\n ggtitle(\"Area Plot\") +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\")) +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `xaxis` to the x aesthetic\n- `y`: Maps `yaxis` to the y aesthetic\n- `fill`: Maps `group` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/001-area.html\n", - "source_file": "Hiplot/001-area.qmd", - "skill_file": "skills/Hiplot/001-area_skill.md" - }, - { - "name": "Barcode Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Barcode Plot is Suitable for displaying the distribution of large amounts of data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/002-barcode-plot.html", - "skill": "# Skill: Barcode Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nBarcode Plot is Suitable for displaying the distribution of large amounts of data.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/barcode-plot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Barcode Plot\np <- ggplot(data, aes(x = sales, y = region)) +\n geom_tile(width = 0.01, height = 0.9, fill = \"#606fcc\") + # Control the width and height of the Barcode\n theme_bw() +\n labs(title = \"Sales report\", x = \"Sales\", y = \"Region\") +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `sales` to the x aesthetic\n- `y`: Maps `region` to the y aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/002-barcode-plot.html\n", - "source_file": "Hiplot/002-barcode-plot.qmd", - "skill_file": "skills/Hiplot/002-barcode-plot_skill.md" - }, - { - "name": "3D Barplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "plot3D" - ], - "use_when": "3D bar charts are used to provide a 3D look and feel for the data. The third dimension is often used for aesthetic reasons, but it does not improve data reading. Still intended to show comparisons between discrete categories.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/003-barplot-3d.html", - "skill": "# Skill: 3D Barplot (R)\n\n## Category\nHiplot\n\n## When to Use\n3D bar charts are used to provide a 3D look and feel for the data. The third dimension is often used for aesthetic reasons, but it does not improve data reading. Still intended to show comparisons between discrete categories.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- plot3D\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(plot3D)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/barplot-3d/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data vector to a matrix\nmat <- matrix(rep(1, nrow(data)), nrow = length(unique(data[, 2])))\nrownames(mat) <- unique(data[, 2])\ncolnames(mat) <- unique(data[, 3])\nfor (i in 1:nrow(mat)) {\n for (j in seq_len(ncol(mat))) {\n mat[i, j] <- data[, 1][data[, 2] == rownames(mat)[i] &\n data[, 3] == colnames(mat)[j]]\n }\n}\n\n# View data\nmat\n\n# Create visualization\n# 3D Barplot\np <- as.ggplot(function() {\n hist3D(\n x = 1:nrow(mat), y = seq_len(ncol(mat)), z = mat,\n bty = \"g\", phi = 20,\n theta = -55,\n xlab = colnames(data)[2],\n ylab = colnames(data)[3], zlab = colnames(data)[1],\n main = \"3D Bar Plot\", colkey = F,\n border = \"black\", shade = 0.8, axes = T,\n ticktype = \"detailed\", space = 0.3, d = 2, cex.axis = 0.3,\n colvar = as.numeric(as.factor(data[, 2])), alpha = 1,\n col = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\")\n )\n\n # Use text3D to label x axis\n text3D(\n x = 1:nrow(mat), y = rep(0.5, nrow(mat)), z = rep(3, nrow(mat)),\n labels = rownames(mat),\n add = TRUE, adj = 0, cex = 0.8\n )\n # Use text3D to label y axis\n text3D(\n x = rep(1, ncol(mat)), y = seq_len(ncol(mat)), z = rep(0, ncol(mat)),\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/003-barplot-3d.html\n", - "source_file": "Hiplot/003-barplot-3d.qmd", - "skill_file": "skills/Hiplot/003-barplot-3d_skill.md" - }, - { - "name": "Barplot Color Group", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "stringr" - ], - "use_when": "The color group barplot can be used to display data values in groups, and to label different colors in sequence.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/004-barplot-color-group.html", - "skill": "# Skill: Barplot Color Group (R)\n\n## Category\nHiplot\n\n## When to Use\nThe color group barplot can be used to display data values in groups, and to label different colors in sequence.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n- stringr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(stringr)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/barplot-color-group/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ncolnames(data) <- c(\"term\", \"count\", \"type\")\ndata[,\"term\"] <- str_to_sentence(str_remove(data[,\"term\"], pattern = \"\\\\w+:\\\\d+\\\\W\"))\ndata[,\"term\"] <- factor(data[,\"term\"], \n levels = data[,\"term\"][length(data[,\"term\"]):1])\ndata[,\"type\"] <- factor(data[,\"type\"], \n levels = data[!duplicated(data[,\"type\"]), \"type\"])\n\n# View data\ndata\n\n# Create visualization\n# Barplot Color Group\np <- ggplot(data = data, aes(x = term, y = count, fill = type)) +\n geom_bar(stat = \"identity\", width = 0.8) + \n theme_bw() +\n xlab(\"Count\") +\n ylab(\"Term\") +\n guides(fill = guide_legend(title=\"Type\")) +\n ggtitle(\"Barplot Color Group\") + \n coord_flip() +\n theme_classic() +\n scale_fill_manual(values = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\")) +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `term` to the x aesthetic\n- `y`: Maps `count` to the y aesthetic\n- `fill`: Maps `type` to the fill aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Use `coord_flip()` for horizontal orientation when labels are long\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/004-barplot-color-group.html\n", - "source_file": "Hiplot/004-barplot-color-group.qmd", - "skill_file": "skills/Hiplot/004-barplot-color-group_skill.md" - }, - { - "name": "Barplot (errorbar)", - "category": "Hiplot", - "language": "R", - "packages": [ - "Rmisc", - "data.table", - "ggplot2", - "ggpubr", - "jsonlite" - ], - "use_when": "Bar plot with error-lines and groups.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/005-barplot-errorbar.html", - "skill": "# Skill: Barplot (errorbar) (R)\n\n## Category\nHiplot\n\n## When to Use\nBar plot with error-lines and groups.\n\n## Required R Packages\n- Rmisc\n- data.table\n- ggplot2\n- ggpubr\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(Rmisc)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggpubr)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/barplot-errorbar/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata[, 2] <- factor(data[, 2], levels = unique(data[, 2]))\ndata_sd <- summarySE(data, measurevar = colnames(data)[1], groupvars = colnames(data)[2])\n\n# View data\nhead(data_sd)\n\n# Create visualization\n# Barplot (errorbar)\np <- ggplot(data_sd, aes(x = data_sd[, 1], y = data_sd[, 3], fill = data_sd[, 1])) +\n geom_bar(stat = \"identity\", color = \"black\", \n position = position_dodge(), alpha = 1) +\n geom_errorbar(aes(ymin = data_sd[, 3] - sd, ymax = data_sd[, 3] + sd),\n width = 0.2,\n position = position_dodge(0.9)) +\n labs(title = \"Barplot (errorbar)\", x = colnames(data_sd)[1], \n y = colnames(data_sd)[3], fill = colnames(data_sd)[1]) +\n geom_jitter(data = data, aes(data[, 2], data[, 1], fill = data[, 2]), size = 2, fill = \"black\", pch = 19, width = 0.2) +\n stat_compare_means(data = data, aes(data[, 2], data[, 1], fill = data[, 2]),\n label = \"p.format\", ref.group = \".all.\", vjust = 1, \n method = \"t.test\") +\n scale_fill_manual(values = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\")) +\n theme_bw() +\n ylim(0,100) +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `data_sd` to the x aesthetic\n- `y`: Maps `data_sd` to the y aesthetic\n- `fill`: Maps `data` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/005-barplot-errorbar.html\n", - "source_file": "Hiplot/005-barplot-errorbar.qmd", - "skill_file": "skills/Hiplot/005-barplot-errorbar_skill.md" - }, - { - "name": "Barplot (errorbar2)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggpubr", - "grafify", - "jsonlite" - ], - "use_when": "Bar plot with error-lines and groups.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/006-barplot-errorbar2.html", - "skill": "# Skill: Barplot (errorbar2) (R)\n\n## Category\nHiplot\n\n## When to Use\nBar plot with error-lines and groups.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggpubr\n- grafify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggpubr)\nlibrary(grafify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/barplot-errorbar2/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata[, 2] <- factor(data[, 2], levels = unique(data[, 2]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Barplot (errorbar2)\np <- plot_scatterbar_sd(\n data, ycol = get(colnames(data)[1]), xcol = get(colnames(data)[2]),\n b_alpha = 1, ewid = 0.2, jitter = 0.1) +\n stat_compare_means(data = data, aes(data[, 2], data[, 1], fill = data[, 2]),\n label = \"p.format\", ref.group = \".all.\", vjust = -2, \n method = \"t.test\") +\n guides(fill=guide_legend(title=colnames(data)[2])) +\n scale_y_continuous(expand = expansion(mult = c(0, 0.2))) +\n labs(x=\"class\", y=\"score\") +\n scale_fill_manual(values = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\")) +\n theme_classic2() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5, vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `fill`: Maps `data` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_classic2()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/006-barplot-errorbar2.html\n", - "source_file": "Hiplot/006-barplot-errorbar2.qmd", - "skill_file": "skills/Hiplot/006-barplot-errorbar2_skill.md" - }, - { - "name": "Barplot Gradient", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "stringr" - ], - "use_when": "It is similar to the bubble chart, but on the basis of the histogram, a color gradient rectangle is used to simultaneously display the visualization of two variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/008-barplot-gradient.html", - "skill": "# Skill: Barplot Gradient (R)\n\n## Category\nHiplot\n\n## When to Use\nIt is similar to the bubble chart, but on the basis of the histogram, a color gradient rectangle is used to simultaneously display the visualization of two variables.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n- stringr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(stringr)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/barplot-gradient/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata[, 1] <- str_to_sentence(str_remove(data[, 1], pattern = \"\\\\w+:\\\\d+\\\\W\"))\ntopnum <- 7\ndata <- data[1:topnum, ]\ndata[, 1] <- factor(data[, 1], level = rev(unique(data[, 1])))\n\n# View data\nhead(data)\n\n# Create visualization\n# Barplot Gradient\np <- ggplot(data, aes(x = Term, y = Count, fill = -log10(PValue))) +\n geom_bar(stat = \"identity\") +\n ggtitle(\"GO BarPlot\") +\n scale_fill_continuous(low = \"#00438E\", high = \"#E43535\") +\n scale_x_discrete(labels = function(x) {str_wrap(x, width = 65)}) +\n labs(fill = \"-log10 (PValue)\", y = \"Term\", x = \"Count\") +\n coord_flip() +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `Term` to the x aesthetic\n- `y`: Maps `Count` to the y aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Use `coord_flip()` for horizontal orientation when labels are long\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/008-barplot-gradient.html\n", - "source_file": "Hiplot/008-barplot-gradient.qmd", - "skill_file": "skills/Hiplot/008-barplot-gradient_skill.md" - }, - { - "name": "Multiple Barplot&Line", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite", - "reshape2" - ], - "use_when": "Displaying multiple bar or line plot in one diagram.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/009-barplot-line-multiple.html", - "skill": "# Skill: Multiple Barplot&Line (R)\n\n## Category\nHiplot\n\n## When to Use\nDisplaying multiple bar or line plot in one diagram.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggthemes\n- jsonlite\n- reshape2\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggthemes)\nlibrary(jsonlite)\nlibrary(reshape2)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/barplot-line-multiple/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata_melt <- melt(data, id.vars = colnames(data)[1])\ndata_melt[, 1] <- factor(data_melt[, 1], level = unique(data_melt[, 1]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Multiple Line\np <- ggplot(data = data_melt, aes(x = age, y = value, group = variable,\n colour = variable)) +\n geom_line(alpha = 1, size = 1) +\n geom_point(aes(shape = variable), alpha = 1, size = 3) +\n labs(title = \"Line (Multiple)\", x = \"X Lable\", y = \"Value\") +\n scale_color_manual(values = c(\"#3B4992FF\",\"#EE0000FF\",\"#008B45FF\",\"#631879FF\",\n \"#008280FF\",\"#BB0021FF\")) +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `age` to the x aesthetic\n- `y`: Maps `value` to the y aesthetic\n- `group`: Maps `variable` to the group aesthetic\n- `colour`: Maps `variable` to the colour aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/009-barplot-line-multiple.html\n", - "source_file": "Hiplot/009-barplot-line-multiple.qmd", - "skill_file": "skills/Hiplot/009-barplot-line-multiple_skill.md" - }, - { - "name": "Barplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "Bar charts are used to display category data with rectangular bars whose height or length is proportional to the value they represent. Bar charts can be drawn vertically or horizontally. The bar chart shows the comparison between the discrete categories. One axis of the chart shows the specific categories to be compared, and the other axis represents the measurements. Some bar charts show bars that can also show the values of multiple measurement variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/010-barplot.html", - "skill": "# Skill: Barplot (R)\n\n## Category\nHiplot\n\n## When to Use\nBar charts are used to display category data with rectangular bars whose height or length is proportional to the value they represent. Bar charts can be drawn vertically or horizontally. The bar chart shows the comparison between the discrete categories. One axis of the chart shows the specific categories to be compared, and the other axis represents the measurements. Some bar charts show bars that can also show the values of multiple measurement variables.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/barplot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata[, 2] <- factor(data[, 2], levels = unique(data[, 2]))\ndata[, 3] <- factor(data[, 3], levels = unique(data[, 3]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Barplot\np <- ggplot(data, aes(x = dose, y = value, fill = treat)) +\n geom_bar(position = position_dodge(0.9), stat = \"identity\") +\n ggtitle(\"Bar Plot\") +\n geom_text(aes(label = value), position = position_dodge(0.9), vjust = 1.5, color = \"white\", size = 3.5) +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\",\"#3c5488ff\")) +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `dose` to the x aesthetic\n- `y`: Maps `value` to the y aesthetic\n- `fill`: Maps `treat` to the fill aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/010-barplot.html\n", - "source_file": "Hiplot/010-barplot.qmd", - "skill_file": "skills/Hiplot/010-barplot_skill.md" - }, - { - "name": "Beanplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "beanplot", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The beanplot is a method of visualizing the distribution characteristics.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/011-beanplot.html", - "skill": "# Skill: Beanplot (R)\n\n## Category\nHiplot\n\n## When to Use\nThe beanplot is a method of visualizing the distribution characteristics.\n\n## Required R Packages\n- beanplot\n- data.table\n- ggplotify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(beanplot)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/beanplot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\nGroupOrder <- as.numeric(factor(data[, 2], levels = unique(data[, 2])))\ndata[, 2] <- paste0(data[,2], \" \", as.numeric(factor(data[, 3])))\ndata <- cbind(data, GroupOrder)\n\n# View data\nhead(data)\n\n# Create visualization\n# Beanplot\np <- as.ggplot(function() {\n beanplot(Y ~ reorder(X, GroupOrder, mean), data = data, ll = 0.04,\n main = \"Bean Plot\", ylab = \"Y\", xlab = \"X\", side = \"both\",\n border = NA, horizontal = F, \n col = list(c(\"#2b70c4\", \"#2b70c4\"),c(\"#e9c216\", \"#e9c216\")),\n beanlines = \"mean\", overallline = \"mean\", kernel = \"gaussian\")\n \n legend(\"bottomright\", fill = c(\"#2b70c4\", \"#e9c216\"),\n legend = levels(factor(data[, 3])))\n})\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/011-beanplot.html\n", - "source_file": "Hiplot/011-beanplot.qmd", - "skill_file": "skills/Hiplot/011-beanplot_skill.md" - }, - { - "name": "Beeswarm", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggbeeswarm", - "ggthemes", - "jsonlite" - ], - "use_when": "The beeswarm is a noninterference scatter plot which is similar to a bee colony.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/012-beeswarm.html", - "skill": "# Skill: Beeswarm (R)\n\n## Category\nHiplot\n\n## When to Use\nThe beeswarm is a noninterference scatter plot which is similar to a bee colony.\n\n## Required R Packages\n- data.table\n- ggbeeswarm\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggbeeswarm)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/beeswarm/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata[, 1] <- factor(data[, 1], levels = unique(data[, 1]))\ncolnames(data) <- c(\"Group\", \"y\")\n\n# View data\nhead(data)\n\n# Create visualization\n# Beeswarm\np <- ggplot(data, aes(Group, y, color = Group)) +\n geom_beeswarm(alpha = 1, size = 0.8) +\n labs(x = NULL, y = \"value\") +\n ggtitle(\"BeeSwarm Plot\") +\n scale_color_manual(values = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\")) +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `color`: Maps `Group` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/012-beeswarm.html\n", - "source_file": "Hiplot/012-beeswarm.qmd", - "skill_file": "skills/Hiplot/012-beeswarm_skill.md" - }, - { - "name": "Corrplot Big Data", - "category": "Hiplot", - "language": "R", - "packages": [ - "ComplexHeatmap", - "data.table", - "jsonlite" - ], - "use_when": "The correlation heat map is a graph that analyzes the correlation between two or more variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/013-big-corrplot.html", - "skill": "# Skill: Corrplot Big Data (R)\n\n## Category\nHiplot\n\n## When to Use\nThe correlation heat map is a graph that analyzes the correlation between two or more variables.\n\n## Required R Packages\n- ComplexHeatmap\n- data.table\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ComplexHeatmap)\nlibrary(data.table)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/big-corrplot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata <- data[!is.na(data[, 1]), ]\nidx <- duplicated(data[, 1])\ndata[idx, 1] <- paste0(data[idx, 1], \"--dup-\", cumsum(idx)[idx])\nrownames(data) <- data[, 1]\ndata <- data[, -1]\nstr2num_df <- function(x) {\n x[] <- lapply(x, function(l) as.numeric(l))\n x\n}\ntmp <- t(str2num_df(data))\ncorr <- round(cor(tmp, use = \"na.or.complete\", method = \"pearson\"), 3)\n\n# View data\nhead(corr[,1:5])\n\n# Create visualization\n# Corrplot Big Data\np <- ComplexHeatmap::Heatmap(\n corr, col = colorRampPalette(c(\"#4477AA\",\"#FFFFFF\",\"#BB4444\"))(50),\n clustering_distance_rows = \"euclidean\",\n clustering_method_rows = \"ward.D2\",\n clustering_distance_columns = \"euclidean\",\n clustering_method_columns = \"ward.D2\",\n show_column_dend = FALSE, show_row_dend = FALSE,\n column_names_gp = gpar(fontsize = 8),\n row_names_gp = gpar(fontsize = 8)\n)\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/013-big-corrplot.html\n", - "source_file": "Hiplot/013-big-corrplot.qmd", - "skill_file": "skills/Hiplot/013-big-corrplot_skill.md" - }, - { - "name": "Bivariate Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "GGally", - "data.table", - "jsonlite" - ], - "use_when": "Display the bivariate.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/014-bivariate.html", - "skill": "# Skill: Bivariate Chart (R)\n\n## Category\nHiplot\n\n## When to Use\nDisplay the bivariate.\n\n## Required R Packages\n- GGally\n- data.table\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(GGally)\nlibrary(data.table)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/bivariate/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Bivariate Chart\np <- ggbivariate(data, outcome = \"smoker\", \n explanatory = c(\"day\",\"time\",\"gender\",\"tip\")) +\n ggtitle(\"Bivariate\") +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\")) +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/014-bivariate.html\n", - "source_file": "Hiplot/014-bivariate.qmd", - "skill_file": "skills/Hiplot/014-bivariate_skill.md" - }, - { - "name": "Boxplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "ggthemes", - "jsonlite" - ], - "use_when": "The box plot is a method of visualizing the distribution characteristics of a set of data by means of a quartile graph.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/015-boxplot.html", - "skill": "# Skill: Boxplot (R)\n\n## Category\nHiplot\n\n## When to Use\nThe box plot is a method of visualizing the distribution characteristics of a set of data by means of a quartile graph.\n\n## Required R Packages\n- data.table\n- ggpubr\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggpubr)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/boxplot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ngroups <- unique(data[, 2])\nmy_comparisons <- combn(groups, 2, simplify = FALSE)\nmy_comparisons <- lapply(my_comparisons, as.character)\n\n# View data\nhead(data)\n\n# Create visualization\n# Boxplot\np <- ggboxplot(data, x = \"Group1\", y = \"Value\", notch = F, facet.by = \"Group2\",\n add = \"point\", color = \"Group1\", xlab = \"Group2\", ylab = \"Value\",\n palette = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\"),\n title = \"Box Plot\") +\n stat_compare_means(comparisons = my_comparisons, label = \"p.format\", \n method = \"t.test\") +\n scale_y_continuous(expand = expansion(mult = c(0.1, 0.1))) +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/015-boxplot.html\n", - "source_file": "Hiplot/015-boxplot.qmd", - "skill_file": "skills/Hiplot/015-boxplot_skill.md" - }, - { - "name": "Bubble", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "stringr" - ], - "use_when": "The bubble chart is a statistical chart that shows the third variable by the size of the bubble on the basis of the scatter chart, so that the three variables can be compared and analyzed simultaneously.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/016-bubble.html", - "skill": "# Skill: Bubble (R)\n\n## Category\nHiplot\n\n## When to Use\nThe bubble chart is a statistical chart that shows the third variable by the size of the bubble on the basis of the scatter chart, so that the three variables can be compared and analyzed simultaneously.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n- stringr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(stringr)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/bubble/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata[, 1] <- str_to_sentence(str_remove(data[, 1], pattern = \"\\\\w+:\\\\d+\\\\W\"))\ntopnum <- 7\ndata <- data[1:topnum, ]\ndata[, 1] <- factor(data[, 1], level = rev(unique(data[, 1])))\n\n# View data\nhead(data)\n\n# Create visualization\n# Bubble\np <- ggplot(data, aes(Ratio, Term)) +\n geom_point(aes(size = Count, colour = -log10(PValue))) +\n scale_colour_gradient(low = \"#00438E\", high = \"#E43535\") +\n labs(colour = \"-log10 (PValue)\", size = \"Count\", x = \"Ratio\", y = \"Term\", \n title = \"Bubble Plot\") +\n scale_x_continuous(limits = c(0, max(data$Ratio) * 1.2)) +\n guides(color = guide_colorbar(order = 1), size = guide_legend(order = 2)) +\n scale_y_discrete(labels = function(x) {str_wrap(x, width = 65)}) +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `size`: Maps `Count` to the size aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/016-bubble.html\n", - "source_file": "Hiplot/016-bubble.qmd", - "skill_file": "skills/Hiplot/016-bubble_skill.md" - }, - { - "name": "Bumpchart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggbump", - "ggplot2", - "jsonlite" - ], - "use_when": "Bump chart can be used to display the change of grouped values.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/017-bumpchart.html", - "skill": "# Skill: Bumpchart (R)\n\n## Category\nHiplot\n\n## When to Use\nBump chart can be used to display the change of grouped values.\n\n## Required R Packages\n- data.table\n- dplyr\n- ggbump\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(ggbump)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/bumpchart/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Bumpchart\np <- ggplot(data, aes(x = x, y = y, color = group)) +\n geom_bump(size = 1.5) +\n geom_point(size = 5) +\n geom_text(data = data %>% filter(x == min(x)),\n aes(x = x - 0.1, label = group),\n size = 5, hjust = 1) +\n geom_text(data = data %>% filter(x == max(x)),\n aes(x = x + 0.1, label = group),\n size = 5, hjust = 0) +\n theme_void() +\n theme(legend.position = \"none\") +\n scale_color_manual(values = c(\"#0571B0\",\"#92C5DE\",\"#F4A582\",\"#CA0020\"))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `x` to the x aesthetic\n- `y`: Maps `y` to the y aesthetic\n- `color`: Maps `group` to the color aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/017-bumpchart.html\n", - "source_file": "Hiplot/017-bumpchart.qmd", - "skill_file": "skills/Hiplot/017-bumpchart_skill.md" - }, - { - "name": "Calibration Curve", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "rms", - "survival" - ], - "use_when": "The calibration curve is used to evaluate the consistency / calibration, i.e. the difference between the predicted value and the real value.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/018-calibration-curve.html", - "skill": "# Skill: Calibration Curve (R)\n\n## Category\nHiplot\n\n## When to Use\nThe calibration curve is used to evaluate the consistency / calibration, i.e. the difference between the predicted value and the real value.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- rms\n- survival\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(rms)\nlibrary(survival)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/calibration-curve/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\nres.lrm <- lrm(as.formula(paste(\n \"status ~ \", \n paste(colnames(data)[3:length(colnames(data))], collapse = \"+\"))),\n data = data, x = TRUE, y = TRUE)\n\nlrm.cal <- calibrate(res.lrm, method = \"boot\", B = length(rownames(data)))\n\n# View data\nhead(data)\n\n# Create visualization\n# Calibration Curve\np <- as.ggplot(function() {\n plot(lrm.cal,\n xlab = \"Nomogram Predicted Survival\",\n ylab = \"Actual Survival\",\n main = \"Calibration Curve\"\n )\n})\n\np\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/018-calibration-curve.html\n", - "source_file": "Hiplot/018-calibration-curve.qmd", - "skill_file": "skills/Hiplot/018-calibration-curve_skill.md" - }, - { - "name": "Chi-square-fisher Test", - "category": "Hiplot", - "language": "R", - "packages": [ - "aplot", - "data.table", - "ggplot2", - "jsonlite", - "visdat" - ], - "use_when": "Chi-square and Fisher test can be used to test the frequency difference of categorical variables. The tool will automatically select the statistical method of Chi-square and Fisher exact test.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/019-chi-square-fisher.html", - "skill": "# Skill: Chi-square-fisher Test (R)\n\n## Category\nHiplot\n\n## When to Use\nChi-square and Fisher test can be used to test the frequency difference of categorical variables. The tool will automatically select the statistical method of Chi-square and Fisher exact test.\n\n## Required R Packages\n- aplot\n- data.table\n- ggplot2\n- jsonlite\n- visdat\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(aplot)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(visdat)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/chi-square-fisher/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\nrownames(data) <- data[,1]\ndata <- data[,-1]\ncb <- combn(nrow(data), 2)\nfinal <- data.frame()\nfor (i in 1:ncol(cb)) {\n tmp <- data[cb[,i],]\n groups <- paste0(rownames(data)[cb[,i]], collapse = \" | \")\n \n res <- tryCatch({\n chisq.test(tmp)\n }, warning = function(w) {\n tryCatch({fisher.test(tmp)}, error = function(e) {\n return(fisher.test(tmp, simulate.p.value = TRUE))\n })\n })\n val_percent <- apply(tmp, 1, function(x) {\n sprintf(\"%s (%s%%)\", x, round(x / sum(x), 2) * 100)\n })\n val_percent1 <- paste0(colnames(tmp), \":\", val_percent[,1])\n val_percent1 <- paste0(val_percent1, collapse = \" | \")\n val_percent2 <- paste0(colnames(tmp), \":\", val_percent[,2])\n val_percent2 <- paste0(val_percent2, collapse = \" | \")\n tmp <- data.frame(\n groups = groups,\n val_percent_left = val_percent1,\n val_percent_right = val_percent2,\n statistic = ifelse(is.null(res$statistic), NA,\n as.numeric(res$statistic)),\n pvalue = as.numeric(res$p.value),\n method = res$method\n )\n final <- rbind(final, tmp)\n}\nfinal <- as.data.frame(final)\nfinal$pvalue < as.numeric(final$pvalue)\nfinal$statistic < as.numeric(final$statistic)\n\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/019-chi-square-fisher.html\n", - "source_file": "Hiplot/019-chi-square-fisher.qmd", - "skill_file": "skills/Hiplot/019-chi-square-fisher_skill.md" - }, - { - "name": "Chord Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "circlize", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The complex interaction is visualized in the form of chord graph.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/020-chord.html", - "skill": "# Skill: Chord Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nThe complex interaction is visualized in the form of chord graph.\n\n## Required R Packages\n- circlize\n- data.table\n- ggplotify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(circlize)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/chord/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\nrow.names(data) <- data[, 1]\ndata <- data[, -1]\ndata <- as.matrix(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Chord Plot\nPalette <- c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\",\"#F39B7FFF\",\n \"#8491B4FF\",\"#91D1C2FF\",\"#DC0000FF\",\"#7E6148FF\",\"#B09C85FF\")\ngrid.col <- c(Palette, Palette, Palette[1:5])\np <- as.ggplot(function() {\n chordDiagram(\n data, grid.col = grid.col, grid.border = NULL, transparency = 0.5,\n row.col = NULL, column.col = NULL, order = NULL,\n directional = 0, # 1, -1, 0, 2\n direction.type = \"diffHeight\", # diffHeight and arrows\n diffHeight = convert_height(2, \"mm\"), reduce = 1e-5, xmax = NULL, \n self.link = 2, symmetric = FALSE, keep.diagonal = FALSE, \n preAllocateTracks = NULL,\n annotationTrack = c(\"name\", \"grid\", \"axis\"),\n annotationTrackHeight = convert_height(c(3, 3), \"mm\"),\n link.border = NA, link.lwd = par(\"lwd\"), link.lty = par(\"lty\"), \n link.sort = FALSE, link.decreasing = TRUE, link.largest.ontop = FALSE,\n link.visible = T, link.rank = NULL, link.overlap = FALSE,\n scale = F, group = NULL, big.gap = 10, small.gap = 1\n )\n })\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/020-chord.html\n", - "source_file": "Hiplot/020-chord.qmd", - "skill_file": "skills/Hiplot/020-chord_skill.md" - }, - { - "name": "Circle Packing", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "packcircles", - "viridis" - ], - "use_when": "Circle packing is a visualization method used to display the differences in quantity among different categories.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/021-circle-packing.html", - "skill": "# Skill: Circle Packing (R)\n\n## Category\nHiplot\n\n## When to Use\nCircle packing is a visualization method used to display the differences in quantity among different categories.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n- packcircles\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(packcircles)\nlibrary(viridis)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/circle-packing/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\npacking <- circleProgressiveLayout(data[[\"v\"]], sizetype = \"area\")\ndata <- cbind(data, packing)\ndat_gg <- circleLayoutVertices(packing, npoints = 50)\ncolors <- c(\"#E57164\",\"#F8ECA7\",\"#9389C1\",\"#3F9C78\",\"#769F8D\",\"#E5F9A9\",\"#7CE9A4\",\n \"#CE9FCA\",\"#78F197\",\"#8BB085\",\"#D88880\",\"#A6E4C3\",\"#F7F6B1\",\"#C5E69A\",\n \"#F45FDE\",\"#5CF371\",\"#9259CF\",\"#2B6D9B\",\"#F3C096\",\"#EEADBE\")\ndat_gg$value <- rep(colors, each = 51)\n\n# View data\nhead(data)\n\n# Create visualization\n# Circle Packing\np <- ggplot() +\n geom_polygon(data = dat_gg, aes(x, y, group = id, fill = value), colour = \"black\", alpha = 0.4) +\n scale_fill_manual(values = magma(nrow(data))) +\n theme_void() +\n theme(legend.position = \"none\") +\n coord_equal() +\n scale_size_continuous(range = c(2.3, 4.5)) +\n geom_text(data = data, aes(x, y, size = v, label = g), vjust = 0) +\n geom_text(data = data, aes(x, y, label = v, size = v), vjust = 1.2)\n\np\n```\n\n## Key Parameters\n- `group`: Maps `id` to the group aesthetic\n- `fill`: Maps `value` to the fill aesthetic\n- `size`: Maps `v` to the size aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/021-circle-packing.html\n", - "source_file": "Hiplot/021-circle-packing.qmd", - "skill_file": "skills/Hiplot/021-circle-packing_skill.md" - }, - { - "name": "Circular Barplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "jsonlite" - ], - "use_when": "Drawing circular barplot", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/023-circular-barplot.html", - "skill": "# Skill: Circular Barplot (R)\n\n## Category\nHiplot\n\n## When to Use\nDrawing circular barplot\n\n## Required R Packages\n- data.table\n- dplyr\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/circular-barplot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata$group <- as.factor(data$group)\nempty_bar <- 2\nto_add <- data.frame(matrix(NA, empty_bar*nlevels(data$group), ncol(data)))\ncolnames(to_add) <- colnames(data)\nto_add$group <- rep(levels(data$group), each=empty_bar)\ndata <- rbind(data, to_add)\ndata <- data %>% arrange(group)\ndata$id <- seq(1, nrow(data))\n\nlabel_data <- data\nnumber_of_bar <- nrow(label_data)\nangle <- 90 - 360 * (label_data$id-0.5) /number_of_bar\nlabel_data$hjust <- ifelse( angle < -90, 1, 0)\nlabel_data$angle <- ifelse(angle < -90, angle+180, angle)\n\nbase_data <- data %>% \n group_by(group) %>% \n dplyr::summarize(start=min(id), end=max(id) - empty_bar) %>% \n rowwise() %>% \n mutate(title=mean(c(start, end)))\n\n# View data\nhead(data)\n\n# Create visualization\n# Circular Barplot\np <- ggplot(data, aes(x=as.factor(id), y=value, fill=group)) +\n geom_bar(aes(x=as.factor(id), y=value, fill=group), stat=\"identity\", alpha=0.5) +\n ylim(-50,max(na.omit(data$value))+30) +\n geom_segment(data=base_data, aes(x = start, y = -5, xend = end, yend = -5), colour = \"black\", alpha=0.8, size=0.8 , inherit.aes = FALSE ) +\n geom_text(data=base_data, aes(x = title, y = -12, label=group), colour = \"black\", alpha=0.8, size=4, fontface=\"bold\", inherit.aes = FALSE) +\n geom_text(data=label_data, aes(x=id, y=value+8, label=individual, hjust=hjust), color=\"black\", fontface=\"bold\",alpha=0.6, size=3, angle= label_data$angle, inherit.aes = FALSE ) +\n geom_text(data=label_data, aes(x=id, y=value-10, label=value, hjust=hjust), color=\"black\", fontface=\"bold\",alpha=0.6, size=3, angle= label_data$angle, inherit.aes = FALSE ) +\n coord_polar() + \n scale_fill_manual(values = c(\"#3b4992ff\",\"#ee0000ff\",\"#008b45ff\",\"#631879ff\")) +\n theme_minimal() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `id` to the x aesthetic\n- `y`: Maps `value` to the y aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/023-circular-barplot.html\n", - "source_file": "Hiplot/023-circular-barplot.qmd", - "skill_file": "skills/Hiplot/023-circular-barplot_skill.md" - }, - { - "name": "Circular Pie Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Another form of the pie chart.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/024-circular-pie-chart.html", - "skill": "# Skill: Circular Pie Chart (R)\n\n## Category\nHiplot\n\n## When to Use\nAnother form of the pie chart.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/circular-pie-chart/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata$draw_percent <- data[[\"values\"]] / sum(data[[\"values\"]]) * 100\ndata$draw_class <- 1\ndata2 <- data\ndata2[[\"values\"]] <- 0\ndata2$draw_class <- 0\ndata <- rbind(data, data2)\nfiltered_data <- data[data[[\"values\"]] > 0,]\n\n# View data\nhead(data)\n\n# Create visualization\n# Circular Pie Chart\np <- ggplot(data, aes(x = draw_class, y = values, fill = labels)) +\n geom_bar(position = \"stack\", stat = \"identity\", width = 0.7) +\n geom_text(data = filtered_data, aes(label = sprintf(\"%.2f%%\", draw_percent)),\n position = position_stack(vjust = 0.5), size = 3) +\n coord_polar(theta = \"y\") +\n xlab(\"\") +\n ylab(\"Pie Chart\") +\n scale_fill_manual(values = c(\"#e64b35ff\",\"#4dbbd5ff\",\"#00a087ff\",\"#3c5488ff\",\"#f39b7fff\")) +\n theme_minimal() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(color = \"black\"),\n axis.text.y = element_blank(),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank())\n\np\n```\n\n## Key Parameters\n- `x`: Maps `draw_class` to the x aesthetic\n- `y`: Maps `values` to the y aesthetic\n- `fill`: Maps `labels` to the fill aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/024-circular-pie-chart.html\n", - "source_file": "Hiplot/024-circular-pie-chart.qmd", - "skill_file": "skills/Hiplot/024-circular-pie-chart_skill.md" - }, - { - "name": "Complex Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "ComplexHeatmap", - "circlize", - "cowplot", - "data.table", - "ggplotify", - "hiplotlib", - "jsonlite", - "randomcoloR", - "stringr" - ], - "use_when": "A multi-omics plugins to draw heatmap, meta annotation, and mutations.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/025-complex-heatmap.html", - "skill": "# Skill: Complex Heatmap (R)\n\n## Category\nHiplot\n\n## When to Use\nA multi-omics plugins to draw heatmap, meta annotation, and mutations.\n\n## Required R Packages\n- ComplexHeatmap\n- circlize\n- cowplot\n- data.table\n- ggplotify\n- hiplotlib\n- jsonlite\n- randomcoloR\n- stringr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ComplexHeatmap)\nlibrary(circlize)\nlibrary(cowplot)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(hiplotlib)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/complex-heatmap/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\ndata2 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/complex-heatmap/data.json\")$exampleData[[1]]$textarea[[2]])\ndata2 <- as.data.frame(data2)\n\n# convert data structure\nkeep_vars_ref <- ls() \nrow.names(data) <- data[, 1]\ndata <- data[, -1]\naxis_raw <- c(\"KRAS\",\"GBP4\")\nexp_start_col <- which(colnames(data) == axis_raw[2])\nmut_start_col <- which(colnames(data) == axis_raw[1])\nheat_mat <- as.matrix(t(data[, exp_start_col:ncol(data)]))\nmut_mat <- as.matrix(t(data[, mut_start_col:(exp_start_col - 1)]))\nmut_mat[is.na(mut_mat)] <- \"\"\n\ncolor_key <- c(\"#196ABD\", \"#3399FF\", \"#3399FF\", \"#f4f4f4\", \"#f4f4f4\", \"#f4f4f4\", \"#FF3333\", \"#FF3333\", \"#C20B01\")\n\ncols <- c()\nfor (i in 1:nrow(data2)) {\n cols[data2[i,1]] <- data2[i,2]\n}\ncol_meta <- list()\ncol_meta_pre <- list()\nitems <- c()\nfor (i in 1:(mut_start_col - 1)) {\n ref <- unique(data[, i])\n ref <- ref[!is.na(ref) & ref != \"\"]\n if (any(is.numeric(ref)) & length(ref) > 2) {\n col_meta_pre[[colnames(data)[i]]] <- hiplotlib::col_fun_cont(data[,i])\n } else if (length(ref) == 2 & any(is.numeric(ref))) {\n col_meta_pre[[colnames(data)[i]]] <- c(\"#f4f4f4\", \"#5a5a5a\")\n items <- c(items, ref)\n } else if (length(ref) == 2 & any(is.character(ref))) {\n col_meta_pre[[colnames(data)[i]]] <- c(\"#196ABD\", \"#C20B01\")\n items <- c(items, unique(data[, i]))\n } else if (length(unique(data[, i])) > 2) {\n col_meta_pre[[colnames(data)[i]]] <- distinctColorPalette(\n length(unique(data[, i]))\n )\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `width`: Controls element width\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/025-complex-heatmap.html\n", - "source_file": "Hiplot/025-complex-heatmap.qmd", - "skill_file": "skills/Hiplot/025-complex-heatmap_skill.md" - }, - { - "name": "Connected Scatterplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "ggrepel", - "jsonlite" - ], - "use_when": "Connected scatterplot", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/026-connected-scatterplot.html", - "skill": "# Skill: Connected Scatterplot (R)\n\n## Category\nHiplot\n\n## When to Use\nConnected scatterplot\n\n## Required R Packages\n- data.table\n- dplyr\n- ggplot2\n- ggrepel\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(ggrepel)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/connected-scatterplot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Connected Scatterplot\nconnected_scatterplot <- function(data, x, y, label, label_ratio, line_color, arrow_size, label_size) {\n\n draw_data <- data.frame(\n x = data[[x]],\n y = data[[y]],\n label = data[[label]]\n )\n\n add_label_data <- draw_data %>% sample_frac(label_ratio)\n rm(data)\n\n p <- ggplot(draw_data, aes(x = x, y = y, label = label)) +\n geom_point(color = line_color) +\n geom_text_repel(data = add_label_data, size = label_size) +\n geom_segment(\n color = line_color,\n aes(\n xend = c(tail(x, n = -1), NA),\n yend = c(tail(y, n = -1), NA)\n ),\n arrow = arrow(length = unit(arrow_size, \"mm\"))\n )\n\n return(p)\n}\n\np <- connected_scatterplot(\n data = if (exists(\"data\") && is.data.frame(data)) data else \"\",\n x = \"Alice\",\n y = \"Anna\",\n label = \"year\",\n label_ratio = 0.5,\n line_color = \"#1A237E\",\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `x` to the x aesthetic\n- `y`: Maps `y` to the y aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/026-connected-scatterplot.html\n", - "source_file": "Hiplot/026-connected-scatterplot.qmd", - "skill_file": "skills/Hiplot/026-connected-scatterplot_skill.md" - }, - { - "name": "Contour (Matrix)", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggisoband", - "ggplot2", - "jsonlite", - "reshape2" - ], - "use_when": "The contour map (matrix) is a graph that displays three-dimensional data in a two-dimensional form", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/027-contour-matrix.html", - "skill": "# Skill: Contour (Matrix) (R)\n\n## Category\nHiplot\n\n## When to Use\nThe contour map (matrix) is a graph that displays three-dimensional data in a two-dimensional form\n\n## Required R Packages\n- cowplot\n- data.table\n- ggisoband\n- ggplot2\n- jsonlite\n- reshape2\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(data.table)\nlibrary(ggisoband)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(reshape2)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/contour-matrix/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata <- as.matrix(data)\ncolnames(data) <- NULL\ndata3d <- reshape2::melt(data)\nnames(data3d) <- c(\"x\", \"y\", \"z\")\n\n# View data\nhead(data3d)\n\n# Create visualization\n# Contour (Matrix)\ncomplex_general_theme <- \n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np1 <- ggplot(data3d, aes(x, y, z = z)) +\n geom_isobands(\n alpha = 1,\n aes(color = stat(zmin)), fill = NA\n ) +\n scale_color_viridis_c() +\n coord_cartesian(expand = FALSE) +\n theme_bw() +\n complex_general_theme\n\np2 <- ggplot(data3d, aes(x, y, z = z)) +\n geom_isobands(\n alpha = 1,\n aes(fill = stat(zmin)), color = NA\n ) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `color`: Maps `stat` to the color aesthetic\n- `fill`: Maps `stat` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/027-contour-matrix.html\n", - "source_file": "Hiplot/027-contour-matrix.qmd", - "skill_file": "skills/Hiplot/027-contour-matrix_skill.md" - }, - { - "name": "Contour (XY)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggisoband", - "ggplot2", - "jsonlite" - ], - "use_when": "Contour plot (XY) is a data processing method that reflects data density through contour line.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/028-contour-xy.html", - "skill": "# Skill: Contour (XY) (R)\n\n## Category\nHiplot\n\n## When to Use\nContour plot (XY) is a data processing method that reflects data density through contour line.\n\n## Required R Packages\n- data.table\n- ggisoband\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggisoband)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/contour-xy/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ncolnames(data) <- c(\"xvalue\", \"yvalue\")\n\n# View data\nhead(data)\n\n# Create visualization\n# Contour (XY)\np <- ggplot(data, aes(xvalue, yvalue)) +\n geom_density_bands(\n alpha = 1,\n aes(fill = stat(density)), color = \"gray40\", size = 0.2\n ) +\n geom_point(alpha = 1, shape = 21, fill = \"white\") +\n scale_fill_viridis_c(guide = \"legend\") +\n ylab(\"value2\") +\n xlab(\"value1\") +\n ggtitle(\"Contour-XY Plot\") +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `fill`: Maps `stat` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/028-contour-xy.html\n", - "source_file": "Hiplot/028-contour-xy.qmd", - "skill_file": "skills/Hiplot/028-contour-xy_skill.md" - }, - { - "name": "Simplified Correlation Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "sigminer" - ], - "use_when": "Simplified variables correlation heatmap", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/029-cor-heatmap-simple.html", - "skill": "# Skill: Simplified Correlation Heatmap (R)\n\n## Category\nHiplot\n\n## When to Use\nSimplified variables correlation heatmap\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n- sigminer\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(sigminer)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/cor-heatmap-simple/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Simplified Correlation Heatmap\np <- show_cor(\n data = data,\n x_vars = c(\"mpg\",\"cyl\",\"disp\"),\n y_vars = c(\"wt\",\"hp\",\"drat\"),\n cor_method = \"pearson\",\n vis_method = \"square\",\n lab = T,\n test = T,\n hc_order = F,\n legend.title = \"Corr\"\n ) +\n ggtitle(\"\") +\n labs(x=\"\", y=\"\") +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/029-cor-heatmap-simple.html\n", - "source_file": "Hiplot/029-cor-heatmap-simple.qmd", - "skill_file": "skills/Hiplot/029-cor-heatmap-simple_skill.md" - }, - { - "name": "Correlation Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggcorrplot", - "jsonlite" - ], - "use_when": "The correlation heat map is a graph that analyzes the correlation between two or more variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/030-cor-heatmap.html", - "skill": "# Skill: Correlation Heatmap (R)\n\n## Category\nHiplot\n\n## When to Use\nThe correlation heat map is a graph that analyzes the correlation between two or more variables.\n\n## Required R Packages\n- data.table\n- ggcorrplot\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggcorrplot)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/cor-heatmap/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata <- data[!is.na(data[, 1]), ]\nidx <- duplicated(data[, 1])\ndata[idx, 1] <- paste0(data[idx, 1], \"--dup-\", cumsum(idx)[idx])\nrownames(data) <- data[, 1]\ndata <- data[, -1]\nstr2num_df <- function(x) {\n final <- NULL\n for (i in seq_len(ncol(x))) {\n final <- cbind(final, as.numeric(x[, i]))\n }\n colnames(final) <- colnames(x)\n return(final)\n}\ntmp <- str2num_df(t(data))\ncorr <- round(cor(tmp, use = \"na.or.complete\", method = \"pearson\"), 3)\np_mat <- round(cor_pmat(tmp, method = \"pearson\"), 3)\n\n# View data\nhead(data)\n\n# Create visualization\n# Correlation Heatmap\np <- ggcorrplot(\n corr,\n colors = c(\"#4477AA\", \"#FFFFFF\", \"#BB4444\"),\n method = \"circle\",\n hc.order = T,\n hc.method = \"ward.D2\",\n outline.col = \"white\",\n ggtheme = theme_bw(),\n type = \"upper\",\n lab = F,\n lab_size = 3,\n legend.title = \"Correlation\"\n ) +\n ggtitle(\"Cor Heatmap Plot\") +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/030-cor-heatmap.html\n", - "source_file": "Hiplot/030-cor-heatmap.qmd", - "skill_file": "skills/Hiplot/030-cor-heatmap_skill.md" - }, - { - "name": "Corrplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "corrplot", - "data.table", - "ggcorrplot", - "ggplotify", - "jsonlite" - ], - "use_when": "The correlation heat map is a graph that analyzes the correlation between two or more variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/033-corrplot.html", - "skill": "# Skill: Corrplot (R)\n\n## Category\nHiplot\n\n## When to Use\nThe correlation heat map is a graph that analyzes the correlation between two or more variables.\n\n## Required R Packages\n- corrplot\n- data.table\n- ggcorrplot\n- ggplotify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(corrplot)\nlibrary(data.table)\nlibrary(ggcorrplot)\nlibrary(ggplotify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/corrplot/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata <- data[!is.na(data[, 1]), ]\nidx <- duplicated(data[, 1])\ndata[idx, 1] <- paste0(data[idx, 1], \"--dup-\", cumsum(idx)[idx])\nrownames(data) <- data[, 1]\ndata <- data[, -1]\nstr2num_df <- function(x) {\n final <- NULL\n for (i in seq_len(ncol(x))) {\n final <- cbind(final, as.numeric(x[, i]))\n }\n colnames(final) <- colnames(x)\n return(final)\n}\ntmp <- str2num_df(t(data))\ncorr <- round(cor(tmp, use = \"na.or.complete\", method = \"pearson\"), 3)\np_mat <- round(cor_pmat(tmp, method = \"pearson\"), 3)\n\n# View data\nhead(data)\n\n# Create visualization\n# Corrplot\np <- as.ggplot(function(){\n corrplot(\n corr, \n method = \"circle\", \n type = \"upper\",\n tl.col = \"black\", \n diag = F,\n col = colorRampPalette(c(\"#4477AA\", \"#FFFFFF\", \"#BB4444\"))(200),\n order = \"hclust\",\n hclust.method = \"ward.D2\")\n }) +\n xlab(\"\") + ylab(\"\") +\n ggtitle(\"Cor Heatmap Plot\") +\n theme_void() +\n theme(text = element_text(family = \"Arial\"),\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_void()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/033-corrplot.html\n", - "source_file": "Hiplot/033-corrplot.qmd", - "skill_file": "skills/Hiplot/033-corrplot_skill.md" - }, - { - "name": "Custom Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Custom Heatmap, directly plot a heatmap based on the given data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/034-custom-heat-map.html", - "skill": "# Skill: Custom Heatmap (R)\n\n## Category\nHiplot\n\n## When to Use\nCustom Heatmap, directly plot a heatmap based on the given data.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/custom-heat-map/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndraw_data <- as.matrix(data[, 2:ncol(data)])\nrow_num <- nrow(draw_data)\ncol_num <- ncol(draw_data)\ncol_labels <- colnames(data)\ncol_labels <- col_labels[2:ncol(data)]\nrow_labels <- data$name\nrm(data)\ndf <- expand.grid(row = 1:row_num, col = 1:col_num)\ndf$value <- c(draw_data)\n\n# View data\nhead(df)\n\n# Create visualization\n# Custom Heatmap\np <- ggplot(df, aes(x = col, y = row, fill = value)) +\n geom_point(shape = 21, size = 8, aes(fill = value), color = \"white\") +\n scale_fill_gradient(low = \"#DDDDDD\", high = \"#0000F5\") +\n guides(fill = guide_colorbar(title = \"Value\")) +\n theme(\n panel.background = element_rect(fill = \"white\"),\n panel.grid = element_blank(),\n axis.text = element_text(size = 10),\n axis.ticks = element_blank(),\n axis.title = element_blank()\n ) +\n scale_x_continuous(breaks = 1:col_num, labels = col_labels, position = \"top\") +\n scale_y_reverse(breaks = 1:row_num, labels = row_labels, position = \"left\")\n\np\n```\n\n## Key Parameters\n- `x`: Maps `col` to the x aesthetic\n- `y`: Maps `row` to the y aesthetic\n- `fill`: Maps `value` to the fill aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/034-custom-heat-map.html\n", - "source_file": "Hiplot/034-custom-heat-map.qmd", - "skill_file": "skills/Hiplot/034-custom-heat-map_skill.md" - }, - { - "name": "Custom Icon Scatter", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "echarts4r", - "echarts4r.assets", - "jsonlite" - ], - "use_when": "A scatter plot with customizable icons.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/035-custom-icon-scatter.html", - "skill": "# Skill: Custom Icon Scatter (R)\n\n## Category\nHiplot\n\n## When to Use\nA scatter plot with customizable icons.\n\n## Required R Packages\n- data.table\n- echarts4r\n- echarts4r.assets\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(echarts4r)\nlibrary(echarts4r.assets)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/custom-icon-scatter/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndraw_data <- data.frame(\n x = data[[\"mpg\"]],\n y = data[[\"wt\"]],\n size = data[[\"qsec\"]]\n )\nrm(data)\n\n# View data\nhead(draw_data)\n\n# Create visualization\n# Custom Icon Scatter\np <- draw_data |>\n e_charts(x) |>\n e_scatter(\n y,\n size,\n symbol = ea_icons(\"warning\"),\n name = \"warning\"\n )\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/035-custom-icon-scatter.html\n", - "source_file": "Hiplot/035-custom-icon-scatter.qmd", - "skill_file": "skills/Hiplot/035-custom-icon-scatter_skill.md" - }, - { - "name": "D3 Wordcloud", - "category": "Hiplot", - "language": "R", - "packages": [ - "d3wordcloud", - "data.table", - "jsonlite" - ], - "use_when": "Display the wordcloud。", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/036-d3-wordcloud.html", - "skill": "# Skill: D3 Wordcloud (R)\n\n## Category\nHiplot\n\n## When to Use\nDisplay the wordcloud。\n\n## Required R Packages\n- d3wordcloud\n- data.table\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(d3wordcloud)\nlibrary(data.table)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/d3-wordcloud/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\nrow.names(data) <- data[, 1]\n\n# View data\nhead(data)\n\n# Create visualization\n# D3 Wordcloud\np <- d3wordcloud(\n words = data[, 1], \n freqs = data[, 2],\n padding = 0,\n rotate.min = 0,\n rotate.max = 0,\n size.scale = \"linear\",\n color.scale = \"linear\",\n spiral = \"archimedean\",\n font = \"Arial\",\n rangesizefont = c(10, 90)\n)\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/036-d3-wordcloud.html\n", - "source_file": "Hiplot/036-d3-wordcloud.qmd", - "skill_file": "skills/Hiplot/036-d3-wordcloud_skill.md" - }, - { - "name": "Dendrogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "ape", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The dendrogram is a diagram representing a tree. This diagrammatic representation is frequently used in different contexts:In hierarchical clustering, it illustrates the arrangement of the clusters produced by the corresponding analyses.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/037-dendrogram.html", - "skill": "# Skill: Dendrogram (R)\n\n## Category\nHiplot\n\n## When to Use\nThe dendrogram is a diagram representing a tree. This diagrammatic representation is frequently used in different contexts:In hierarchical clustering, it illustrates the arrangement of the clusters produced by the corresponding analyses.\n\n## Required R Packages\n- ape\n- data.table\n- ggplotify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ape)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/dendrogram/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata <- data[, -1]\n\n# View data\nhead(data)\n\n# Create visualization\n# Dendrogram\nd <- dist(t(data), method = \"euclidean\")\nhc <- hclust(d, method = \"complete\")\nclus <- cutree(hc, 4)\n\np <- as.ggplot(function() {\n par(mar = c(5, 5, 10, 5), mgp = c(2.5, 1, 0))\n plot(as.phylo(hc),\n type = \"phylogram\",\n tip.color = c(\"#00468bff\",\"#ed0000ff\",\"#42b540ff\",\"#0099b4ff\")[clus], \n label.offset = 1,\n cex = 1, font = 2, use.edge.length = T\n )\n title(\"Dendrogram Plot\", line = 1)\n })\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/037-dendrogram.html\n", - "source_file": "Hiplot/037-dendrogram.qmd", - "skill_file": "skills/Hiplot/037-dendrogram_skill.md" - }, - { - "name": "Mirror Density & Histogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The mirror density & histogram is a graph used to observe the distribution of continuous variables in two side view: top and bottom.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/038-density-hist-mirror.html", - "skill": "# Skill: Mirror Density & Histogram (R)\n\n## Category\nHiplot\n\n## When to Use\nThe mirror density & histogram is a graph used to observe the distribution of continuous variables in two side view: top and bottom.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/density-hist-mirror/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\nsides <- data[1,]\ndata <- data[-1,]\nfor (i in 1:ncol(data)) {\n data[,i] <- as.numeric(data[,i])\n}\n\n# View data\nhead(data)\n\n# Create visualization\n# Mirror Density\np <- ggplot(data, aes(x=x))\ncolrs <- c(\"#e64b35ff\",\"#4dbbd5ff\",\"#00a087ff\",\"#3c5488ff\",\"#f39b7fff\",\"#8491b4ff\")\ncolrs2 <- colnames(data)\nfor (i in seq_len(length(sides))) {\n eval(parse(\n text = sprintf(\"p <- p + geom_density(aes(x = %s, y = %s..density.., color = '%s', fill = '%s'), kernel = '%s')\", \n colnames(data)[i], ifelse(sides[i] == \"top\", \"\", \"-\"), colnames(data)[i],\n colnames(data)[i], \"gaussian\")\n ))\n names(colrs)[i] <- colnames(data)[i]\n names(colrs2)[i] <- colrs[i]\n}\np <- p + \n ggtitle(\"\") +\n scale_fill_manual(values=colrs, name=\"Densities\") +\n scale_color_manual(values=colrs, name=\"Densities\") +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `x` to the x aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/038-density-hist-mirror.html\n", - "source_file": "Hiplot/038-density-hist-mirror.qmd", - "skill_file": "skills/Hiplot/038-density-hist-mirror_skill.md" - }, - { - "name": "Density-Histogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "grafify", - "jsonlite" - ], - "use_when": "Use density plots or histograms to show data distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/039-density-histogram.html", - "skill": "# Skill: Density-Histogram (R)\n\n## Category\nHiplot\n\n## When to Use\nUse density plots or histograms to show data distribution.\n\n## Required R Packages\n- data.table\n- dplyr\n- grafify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(grafify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/density-histogram/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ny <- \"Doubling_time\"\ngroup <- \"Student\"\ndata[, group] <- factor(data[, group], levels = unique(data[, group]))\ndata <- data %>% \n mutate(median = median(get(y), na.rm = TRUE),\n mean = mean(get(y), na.rm = TRUE))\n\n# View data\nhead(data)\n\n# Create visualization\n# Density Plot\np <- plot_density(\n data = data, \n ycol = get(y), \n group = get(group),\n linethick = 0.5,\n c_alpha = 0.6) + \n ggtitle(\"Density Plot\") + \n geom_vline(aes_string(xintercept = \"median\"),\n colour = 'black', linetype = 2, size = 0.5) + \n xlab(y) + \n ylab(\"density\") + \n guides(fill = guide_legend(title = group), color = FALSE) +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"bottom\",\n legend.direction = \"horizontal\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/039-density-histogram.html\n", - "source_file": "Hiplot/039-density-histogram.qmd", - "skill_file": "skills/Hiplot/039-density-histogram_skill.md" - }, - { - "name": "Density", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The kernel density map is a graph used to observe the distribution of continuous variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/040-density.html", - "skill": "# Skill: Density (R)\n\n## Category\nHiplot\n\n## When to Use\nThe kernel density map is a graph used to observe the distribution of continuous variables.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/density/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata[,2] <- factor(data[,2], levels = unique(data[,2]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Density\ndata[\"group_add_by_code\"] <- \"g1\"\n\np <- ggplot(data, aes_(as.name(colnames(data[1])))) +\n geom_density(col = \"white\", alpha = 0.85,\n aes_(fill = as.name(colnames(data[2])))) +\n ggtitle(\"\") +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\")) +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/040-density.html\n", - "source_file": "Hiplot/040-density.qmd", - "skill_file": "skills/Hiplot/040-density_skill.md" - }, - { - "name": "Deviation Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "jsonlite" - ], - "use_when": "Deviation plot provides a visual representation of the differences between data points.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/041-deviation-plot.html", - "skill": "# Skill: Deviation Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nDeviation plot provides a visual representation of the differences between data points.\n\n## Required R Packages\n- data.table\n- ggpubr\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggpubr)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/deviation-plot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata[[\"z_score\"]] <- (data[[\"mpg\"]] - mean(data[[\"mpg\"]])) / sd(data[[\"mpg\"]])\ndata[[\"Group\"]] <- factor(ifelse(data[[\"z_score\"]] < 0, \"low\", \"high\"),\n levels = c(\"low\", \"high\")\n )\n\n# View data\nhead(data)\n\n# Create visualization\n# Deviation Plot\np <- ggbarplot(data,\n x = \"name\",\n y = \"z_score\",\n fill = \"Group\",\n color = \"white\",\n sort.val = \"desc\",\n sort.by.groups = FALSE,\n x.text.angle = 90,\n xlab = \"name\",\n ylab = \"mpg\",\n rotate = TRUE\n ) +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\")) +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/041-deviation-plot.html\n", - "source_file": "Hiplot/041-deviation-plot.qmd", - "skill_file": "skills/Hiplot/041-deviation-plot_skill.md" - }, - { - "name": "Diffusion Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "BiocManager", - "data.table", - "destiny", - "ggplotify", - "ggpubr", - "jsonlite", - "scatterplot3d", - "smoother" - ], - "use_when": "Diffusion Map is a nonlinear dimensionality reduction algorithm that can be used to visualize developmental trajectories.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/042-diffusion-map.html", - "skill": "# Skill: Diffusion Map (R)\n\n## Category\nHiplot\n\n## When to Use\nDiffusion Map is a nonlinear dimensionality reduction algorithm that can be used to visualize developmental trajectories.\n\n## Required R Packages\n- BiocManager\n- data.table\n- destiny\n- ggplotify\n- ggpubr\n- jsonlite\n- scatterplot3d\n- smoother\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(BiocManager)\nlibrary(data.table)\nlibrary(destiny)\nlibrary(ggplotify)\nlibrary(ggpubr)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata1 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/diffusion-map/data.json\")$exampleData[[1]]$textarea[[1]])\ndata1 <- as.data.frame(data1)\ndata2 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/diffusion-map/data.json\")$exampleData[[1]]$textarea[[2]])\ndata2 <- as.data.frame(data2)\n\n# convert data structure\nsample.info <- data2\nrownames(data1) <- data1[, 1]\ndata1 <- as.matrix(data1[, -1])\n## tsne\nset.seed(123)\ndm_info <- DiffusionMap(t(data1))\ndm_info <- cbind(DC1 = dm_info$DC1, DC2 = dm_info$DC2, DC3 = dm_info$DC3)\ndm_data <- data.frame(\n sample = colnames(data1),\n dm_info\n)\n\ncolorBy <- sample.info[match(colnames(data1), sample.info[, 1]), \"Group\"]\ncolorBy <- factor(colorBy, level = colorBy[!duplicated(colorBy)])\ndm_data$colorBy = colorBy\n\n# View data\nhead(dm_data)\n\n# Create visualization\n# 2D Diffusion Map\np <- ggscatter(data = dm_data, x = \"DC1\", y = \"DC2\", color = \"colorBy\",\n size = 2, palette = \"lancet\", alpha = 1) +\n labs(color = \"Group\") +\n ggtitle(\"Diffusion Map\") +\n scale_color_manual(values = c(\"#3B4992FF\",\"#EE0000FF\",\"#008B45FF\")) +\n theme_classic() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_classic()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/042-diffusion-map.html\n", - "source_file": "Hiplot/042-diffusion-map.qmd", - "skill_file": "skills/Hiplot/042-diffusion-map_skill.md" - }, - { - "name": "Diverging Scale", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggcharts", - "jsonlite" - ], - "use_when": "The diverging scale is a graph that maps a continuous, quantitative input to a continuous fixed interpolator.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/043-diverging-scale.html", - "skill": "# Skill: Diverging Scale (R)\n\n## Category\nHiplot\n\n## When to Use\nThe diverging scale is a graph that maps a continuous, quantitative input to a continuous fixed interpolator.\n\n## Required R Packages\n- data.table\n- ggcharts\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggcharts)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/diverging-scale/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata <- dplyr::transmute(.data = data, x = model, y = scale(hp))\n\n# View data\nhead(data)\n\n# Create visualization\n# Diverging Scale Barplot\nfill_colors <- c(\"#C20B01\", \"#196ABD\")\nfill_colors <- fill_colors[c(any(data[, \"y\"] > 0), any(data[, \"y\"] < 0))]\np <- diverging_bar_chart(data = data, x = x, y = y, bar_colors = fill_colors,\n text_color = '#000000') + \n theme(axis.text.x = element_text(color = \"#000000\"),\n axis.title.x = element_text(colour = \"#000000\"),\n axis.title.y = element_text(colour = \"#000000\"),\n plot.background = element_blank()) + \n labs(x = \"model\", y = \"scale(hp)\", title = \"\")\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/043-diverging-scale.html\n", - "source_file": "Hiplot/043-diverging-scale.qmd", - "skill_file": "skills/Hiplot/043-diverging-scale_skill.md" - }, - { - "name": "DIY GSEA", - "category": "Hiplot", - "language": "R", - "packages": [ - "clusterProfiler", - "data.table", - "jsonlite" - ], - "use_when": "Create a DIY GSEA using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/044-diy-gsea.html", - "skill": "# Skill: DIY GSEA (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a DIY GSEA using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- clusterProfiler\n- data.table\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(clusterProfiler)\nlibrary(data.table)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata1 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/diy-gsea/data.json\")$exampleData$textarea[[1]])\ndata1 <- as.data.frame(data1)\ndata2 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/diy-gsea/data.json\")$exampleData$textarea[[2]])\ndata2 <- as.data.frame(data2)\n\n# convert data structure\ndata1[,2] <- as.numeric(data1[,2])\ngeneList <- data1[,2]\nnames(geneList) <- data1[,1]\ngeneList <- sort(geneList, decreasing = TRUE)\nterm <- data.frame(term=data2[,1], gene=data2[,2])\n\n# View data\nhead(term)\n\n# Create visualization\n# DIY GSEA\ny <- clusterProfiler::GSEA(geneList, TERM2GENE = term, pvalueCutoff = 1)\np <- gseaplot(\n y,\n y@result$Description[1],\n color = \"#000000\",\n by = \"runningScore\",\n color.line = \"#4CAF50\",\n color.vline= \"#FA5860\",\n title = \"DIY GSEA Plot\",\n )\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/044-diy-gsea.html\n", - "source_file": "Hiplot/044-diy-gsea.qmd", - "skill_file": "skills/Hiplot/044-diy-gsea_skill.md" - }, - { - "name": "Donut", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The donut is a variant of the pie chart, with a blank center allowing for additional information about the data as a whole to be included. Doughnut charts are similar to pie charts in that their aim is to illustrate proportions.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/045-donut.html", - "skill": "# Skill: Donut (R)\n\n## Category\nHiplot\n\n## When to Use\nThe donut is a variant of the pie chart, with a blank center allowing for additional information about the data as a whole to be included. Doughnut charts are similar to pie charts in that their aim is to illustrate proportions.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/donut/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata$fraction <- data[, 2] / sum(data[, 2])\ndata$ymax <- cumsum(data$fraction)\ndata$ymin <- c(0, head(data$ymax, n = -1))\ndata$labelPosition <- (data$ymax + data$ymin) / 2\ndata$label <- paste0(data[, 1], \"\\n\",\n \"(\", data[, 2], \", \", sprintf(\"%2.2f%%\", 100 * data[, 2] / sum(data[, 2])), \")\",\n sep = \"\"\n)\n\n# View data\nhead(data)\n\n# Create visualization\n# Donut\np <- ggplot(data, aes_(ymax = as.name(\"ymax\"), ymin = as.name(\"ymin\"), \n xmax = 4, xmin = 3, fill = as.name(colnames(data)[1]))) +\n geom_rect() +\n geom_text(x = 5 + (4 - 5) / 3,\n aes(y = labelPosition, label = label), size = 4) +\n coord_polar(theta = \"y\") +\n xlim(c(2, 5)) +\n scale_fill_manual(values = c(\"#00468BCC\",\"#ED0000CC\",\"#42B540CC\",\"#0099B4CC\")) +\n ggtitle(\"Donut Plot\") +\n theme_void() +\n theme(plot.title = element_text(hjust = 0.5),\n legend.position = \"none\")\n\np\n```\n\n## Key Parameters\n- `y`: Maps `labelPosition` to the y aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/045-donut.html\n", - "source_file": "Hiplot/045-donut.qmd", - "skill_file": "skills/Hiplot/045-donut_skill.md" - }, - { - "name": "Dotchart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "jsonlite" - ], - "use_when": "Sliding bead chart is a graph of beads sliding on a column. It is the superposition of bar chart and scatter chart.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/046-dotchart.html", - "skill": "# Skill: Dotchart (R)\n\n## Category\nHiplot\n\n## When to Use\nSliding bead chart is a graph of beads sliding on a column. It is the superposition of bar chart and scatter chart.\n\n## Required R Packages\n- data.table\n- ggpubr\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggpubr)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/dotchart/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Dotchart\np <- ggdotchart(data, x = \"Name\", y = \"Value\", group = \"Group\", color = \"Group\",\n rotate = T, sorting = \"descending\",\n y.text.col = F, add = \"segments\", dot.size = 2) +\n xlab(\"Name\") +\n ylab(\"Value\") +\n ggtitle(\"DotChart Plot\") +\n scale_color_manual(values = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\")) +\n theme_classic() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_classic()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/046-dotchart.html\n", - "source_file": "Hiplot/046-dotchart.qmd", - "skill_file": "skills/Hiplot/046-dotchart_skill.md" - }, - { - "name": "Dual Y Axis Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The dual Y-axis graph can put two groups of data with larger orders of magnitude in the same graph for display.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/047-dual-y-axis.html", - "skill": "# Skill: Dual Y Axis Chart (R)\n\n## Category\nHiplot\n\n## When to Use\nThe dual Y-axis graph can put two groups of data with larger orders of magnitude in the same graph for display.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/dual-y-axis/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Dual Y Axis Chart\np <- ggplot(data, aes(x = x)) +\n geom_line(aes(y = data[, 2]), size = 1, color = \"#D72C15\") +\n geom_line(aes(y = data[, 3] / as.numeric(10)), size = 1, color = \"#02657B\") +\n scale_y_continuous(\n name = colnames(data)[2],\n sec.axis = sec_axis(~ . * as.numeric(10), name = colnames(data)[3])) +\n ggtitle(\"Dual Y Axis Chart\") + xlab(\"x\") +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `x` to the x aesthetic\n- `y`: Maps `data` to the y aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/047-dual-y-axis.html\n", - "source_file": "Hiplot/047-dual-y-axis.qmd", - "skill_file": "skills/Hiplot/047-dual-y-axis_skill.md" - }, - { - "name": "Dumbbell Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggalt", - "ggplot2", - "jsonlite" - ], - "use_when": "Dumbbell Chart can display the data change.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/048-dumbbell.html", - "skill": "# Skill: Dumbbell Chart (R)\n\n## Category\nHiplot\n\n## When to Use\nDumbbell Chart can display the data change.\n\n## Required R Packages\n- data.table\n- ggalt\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggalt)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/dumbbell/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Dumbbell Chart\ncolors <- c(\"#3B4992FF\",\"#EE0000FF\")\np <- ggplot(data, aes(y = reorder(country, y1952), x = y1952, xend = y2007)) +\n geom_dumbbell(size = 1, size_x = 3, size_xend = 3, colour = \"#AFAFAF\", \n colour_x = colors[1], colour_xend = colors[2]) +\n labs(title = \"Dummbbell Chart\", x = \"Life Expectancy (years)\",\n y = \"country\") +\n theme_minimal() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `y`: Maps `reorder` to the y aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/048-dumbbell.html\n", - "source_file": "Hiplot/048-dumbbell.qmd", - "skill_file": "skills/Hiplot/048-dumbbell_skill.md" - }, - { - "name": "Easy Pairs", - "category": "Hiplot", - "language": "R", - "packages": [ - "GGally", - "data.table", - "jsonlite" - ], - "use_when": "Display a matrix of plots for viewing correlation relationship and distributions of multiple variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/049-easy-pairs.html", - "skill": "# Skill: Easy Pairs (R)\n\n## Category\nHiplot\n\n## When to Use\nDisplay a matrix of plots for viewing correlation relationship and distributions of multiple variables.\n\n## Required R Packages\n- GGally\n- data.table\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(GGally)\nlibrary(data.table)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/easy-pairs/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Easy Pairs\np <- ggpairs(data, columns = c(\"total_bill\", \"time\", \"tip\"),\n mapping = aes_string(color = \"gender\")) +\n ggtitle(\"Easy Pairs\") +\n scale_fill_manual(values = c(\"#3B4992FF\",\"#EE0000FF\")) +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/049-easy-pairs.html\n", - "source_file": "Hiplot/049-easy-pairs.qmd", - "skill_file": "skills/Hiplot/049-easy-pairs_skill.md" - }, - { - "name": "Easy SOM", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "kohonen" - ], - "use_when": "Establish the SOM model and conduct the visulization.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/050-easy-som.html", - "skill": "# Skill: Easy SOM (R)\n\n## Category\nHiplot\n\n## When to Use\nEstablish the SOM model and conduct the visulization.\n\n## Required R Packages\n- data.table\n- jsonlite\n- kohonen\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(jsonlite)\nlibrary(kohonen)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/easy-som/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ntarget <- data[,1]\ntarget <- factor(target, levels = unique(target))\ndata <- data[,-1]\ndata <- as.data.frame(data)\nfor (i in 1:ncol(data)) {\n data[,i] <- as.numeric(data[,i])\n}\ndata <- as.matrix(data)\nset.seed(7)\nkohmap <- xyf(scale(data), target, grid = somgrid(xdim=6, ydim=4, topo=\"hexagonal\"), rlen=100)\n\ncolor_key <- c(\"#A50026\",\"#D73027\",\"#F46D43\",\"#FDAE61\",\"#FEE090\",\"#FFFFBF\",\"#E0F3F8\",\n \"#ABD9E9\",\"#74ADD1\",\"#4575B4\",\"#313695\")\ncolors <- function (n, alpha, rev = FALSE) {\n colorRampPalette(color_key)(n)\n}\n\n# View data\nhead(data[,1:5])\n\n# Create visualization\n# Easy SOM\np <- function () {\n par(mfrow = c(3,2))\n xyfpredictions <- classmat2classvec(getCodes(kohmap, 2))\n plot(kohmap, type=\"counts\", col = as.integer(target),\n palette.name = colors,\n pchs = as.integer(target), \n main = \"Counts plot\", shape = \"straight\", border = NA)\n \n som.hc <- cutree(hclust(object.distances(kohmap, \"codes\")), 3)\n add.cluster.boundaries(kohmap, som.hc)\n\n plot(kohmap, type=\"mapping\",\n labels = as.integer(target), col = colors(3)[as.integer(target)],\n palette.name = colors,\n shape = \"straight\",\n main = \"Mapping plot\")\n\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/050-easy-som.html\n", - "source_file": "Hiplot/050-easy-som.qmd", - "skill_file": "skills/Hiplot/050-easy-som_skill.md" - }, - { - "name": "Eulerr Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "eulerr", - "ggplotify", - "jsonlite" - ], - "use_when": "Create a Eulerr Plot using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/051-eulerr.html", - "skill": "# Skill: Eulerr Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Eulerr Plot using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- eulerr\n- ggplotify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(eulerr)\nlibrary(ggplotify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/eulerr/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ngenes <- as.numeric(data[, 2])\nnames(genes) <- as.character(data[, 1])\neuler_set <- euler(genes)\n \n# View data\nhead(data)\n\n# Create visualization\n# Eulerr Plot\nfill <- c(\"#3B4992FF\",\"#EE0000FF\",\"#008B45FF\",\"#631879FF\",\"#008280FF\",\"#BB0021FF\",\n \"#5F559BFF\",\"#A20056FF\")\np <- as.ggplot(\n plot(euler_set,\n labels = list(col = rep(\"white\", length(genes))),\n fills = list(fill = fill),\n quantities = list(type = c(\"percent\", \"counts\"),\n col = rep(\"white\", length(genes))),\n main = \"Eulerr\")\n)\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/051-eulerr.html\n", - "source_file": "Hiplot/051-eulerr.qmd", - "skill_file": "skills/Hiplot/051-eulerr_skill.md" - }, - { - "name": "Extended Scatter", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggExtra", - "ggplot2", - "jsonlite" - ], - "use_when": "An extended scatter plot adds marginal plots to the basic scatter plot to provide a more comprehensive view of the data distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/052-extended-scatter.html", - "skill": "# Skill: Extended Scatter (R)\n\n## Category\nHiplot\n\n## When to Use\nAn extended scatter plot adds marginal plots to the basic scatter plot to provide a more comprehensive view of the data distribution.\n\n## Required R Packages\n- data.table\n- ggExtra\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggExtra)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/extended-scatter/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Extended Scatter\np <- ggplot(data, aes(x = wt, y = mpg, color = cyl, size = cyl)) +\n geom_point() +\n geom_rug(alpha = 0.2, size = 1.5, col = \"#4f80b3\") +\n theme(legend.position = \"none\")\n\np <- ggMarginal(\n p, type = \"densigram\", fill = \"#7054cc\", color = \"#7f0080\",\n size = 4, bins = 30)\n\np\n```\n\n## Key Parameters\n- `x`: Maps `wt` to the x aesthetic\n- `y`: Maps `mpg` to the y aesthetic\n- `color`: Maps `cyl` to the color aesthetic\n- `size`: Maps `cyl` to the size aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/052-extended-scatter.html\n", - "source_file": "Hiplot/052-extended-scatter.qmd", - "skill_file": "skills/Hiplot/052-extended-scatter_skill.md" - }, - { - "name": "Cox Models Forest", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ezcox", - "jsonlite" - ], - "use_when": "Cox model forest is a visual representation of a COX model that constructs a risk forest map to facilitate variable screening.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/053-ezcox.html", - "skill": "# Skill: Cox Models Forest (R)\n\n## Category\nHiplot\n\n## When to Use\nCox model forest is a visual representation of a COX model that constructs a risk forest map to facilitate variable screening.\n\n## Required R Packages\n- data.table\n- ezcox\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ezcox)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ezcox/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Cox Models Forest\np <- show_forest(\n data = data,\n covariates = c(\"sex\", \"ph.ecog\"),\n controls = \"age\",\n merge_models = F,\n drop_controls = F,\n add_caption = T\n)\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/053-ezcox.html\n", - "source_file": "Hiplot/053-ezcox.qmd", - "skill_file": "skills/Hiplot/053-ezcox_skill.md" - }, - { - "name": "Fan Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "plotrix" - ], - "use_when": "The pie chart is a statistical chart designed to clearly show the percentage of each data group by the size of the pie.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/054-fan.html", - "skill": "# Skill: Fan Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nThe pie chart is a statistical chart designed to clearly show the percentage of each data group by the size of the pie.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- plotrix\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(plotrix)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/fan/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Fan Plot\np <- as.ggplot(function() {\n fan.plot(data[, 2], main = \"\", labels = as.character(data[, 1]),\n col = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\"))\n })\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/054-fan.html\n", - "source_file": "Hiplot/054-fan.qmd", - "skill_file": "skills/Hiplot/054-fan_skill.md" - }, - { - "name": "Fishplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "fishplot", - "jsonlite" - ], - "use_when": "Clone evolution analysis", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/055-fishplot.html", - "skill": "# Skill: Fishplot (R)\n\n## Category\nHiplot\n\n## When to Use\nClone evolution analysis\n\n## Required R Packages\n- data.table\n- fishplot\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(fishplot)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/fishplot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n## Create a fish object\nfish = createFishObject(as.matrix(data[,4:7]), parents=data$parents, \n timepoints=data$timepoints, \n col = c(\"#888888\",\"#e8130c\",\"#f8150d\",\"#55158f\"))\n## Calculate the layout of the drawing\nfish = layoutClones(fish)\n## Draw the plot, using the splining method (recommended), and providing both timepoints to label and a plot title\nfishPlot(fish,shape=\"spline\", title.btm=\"Sample1\", title = \"Fishplot\",\n cex.title=1, vlines=c(0,30,75,150), \n vlab=c(\"Day 0\",\"Day 30\",\"Day 75\",\"Day 150\"))\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/055-fishplot.html\n", - "source_file": "Hiplot/055-fishplot.qmd", - "skill_file": "skills/Hiplot/055-fishplot_skill.md" - }, - { - "name": "Flower plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "flowerplot", - "ggplotify", - "jsonlite" - ], - "use_when": "Flower plot with multiple sets.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/056-flowerplot.html", - "skill": "# Skill: Flower plot (R)\n\n## Category\nHiplot\n\n## When to Use\nFlower plot with multiple sets.\n\n## Required R Packages\n- data.table\n- flowerplot\n- ggplotify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(flowerplot)\nlibrary(ggplotify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/flowerplot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Flower plot\np <- as.ggplot(function(){\n flowerplot(\n flower_dat = data,\n angle = 90,\n a = 0.5,\n b = 2,\n r = 1,\n ellipse_col = \"RdBu\",\n circle_col = \"#FFFFFF\",\n label_text_cex = 1\n )})\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/056-flowerplot.html\n", - "source_file": "Hiplot/056-flowerplot.qmd", - "skill_file": "skills/Hiplot/056-flowerplot_skill.md" - }, - { - "name": "Funnel Plot (metafor)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "metafor" - ], - "use_when": "Can be used to show potential bias factors in Meta-analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/057-funnel-plot-metafor.html", - "skill": "# Skill: Funnel Plot (metafor) (R)\n\n## Category\nHiplot\n\n## When to Use\nCan be used to show potential bias factors in Meta-analysis.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- metafor\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(metafor)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/funnel-plot-metafor/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata2 <- escalc(ri=ri, ni=ni, data = data, measure=\"ZCOR\")\nres <- rma(yi, vi, data = data2)\n\n# View data\nhead(data)\n\n# Create visualization\n# Funnel Plot\np <- as.ggplot(function(){\n funnel(x = res, main = \"Funnel Plot (metafor)\",\n level = c(90, 95, 99), shade = c(\"white\",\"#a90e07\",\"#d23e0b\"), refline = 0)\n })\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/057-funnel-plot-metafor.html\n", - "source_file": "Hiplot/057-funnel-plot-metafor.qmd", - "skill_file": "skills/Hiplot/057-funnel-plot-metafor_skill.md" - }, - { - "name": "Funnel Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "FunnelPlotR", - "data.table", - "gridExtra", - "jsonlite" - ], - "use_when": "Can be used to show potential bias factors in Meta-analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/058-funnel-plot.html", - "skill": "# Skill: Funnel Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nCan be used to show potential bias factors in Meta-analysis.\n\n## Required R Packages\n- FunnelPlotR\n- data.table\n- gridExtra\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(FunnelPlotR)\nlibrary(data.table)\nlibrary(gridExtra)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/funnel-plot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Funnel Plot\np <- funnel_plot(\n data, numerator = los, denominator = prds, group = provnum, data_type = \"SR\",\n limit = 99, label = \"outlier\", sr_method = \"SHMI\", trim_by=0.1, \n title = \"Funnel Plot\", x_range = \"auto\", y_range = \"auto\"\n )\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/058-funnel-plot.html\n", - "source_file": "Hiplot/058-funnel-plot.qmd", - "skill_file": "skills/Hiplot/058-funnel-plot_skill.md" - }, - { - "name": "Gantt", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggthemes", - "jsonlite", - "tidyverse" - ], - "use_when": "The Gantt chart is a type of bar chart that illustrates a project schedule.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/059-gantt.html", - "skill": "# Skill: Gantt (R)\n\n## Category\nHiplot\n\n## When to Use\nThe Gantt chart is a type of bar chart that illustrates a project schedule.\n\n## Required R Packages\n- data.table\n- ggthemes\n- jsonlite\n- tidyverse\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggthemes)\nlibrary(jsonlite)\nlibrary(tidyverse)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/gantt/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\nusr_ylab <- colnames(data)[1]\nif (!is.numeric(data[, 2])) {\n data[, 2] <- factor(data[, 2], levels = unique(data[, 2]))\n}\ndata_gather <- gather(data, \"state\", \"date\", 3:4)\nsample <- levels(data_gather$sample)\ndata_gather$sample <- factor(data_gather$sample,\n levels = rev(unique(data_gather$sample))\n)\n\n# View data\nhead(data_gather)\n\n# Create visualization\n# Gantt\np <- ggplot(data_gather, aes(date, sample, color = item)) +\n geom_line(size = 10, alpha = 1) +\n labs(x = \"Time\", y = \"sample\", title = \"Gantt Plot\") +\n theme(axis.ticks = element_blank()) +\n scale_color_manual(values = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\")) +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5, vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `color`: Maps `item` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/059-gantt.html\n", - "source_file": "Hiplot/059-gantt.qmd", - "skill_file": "skills/Hiplot/059-gantt_skill.md" - }, - { - "name": "Gene Density", - "category": "Hiplot", - "language": "R", - "packages": [ - "ComplexHeatmap", - "RColorBrewer", - "circlize", - "data.table", - "ggplotify", - "gtrellis", - "jsonlite", - "tidyverse" - ], - "use_when": "Chrosome data visualization.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/060-gene-density.html", - "skill": "# Skill: Gene Density (R)\n\n## Category\nHiplot\n\n## When to Use\nChrosome data visualization.\n\n## Required R Packages\n- ComplexHeatmap\n- RColorBrewer\n- circlize\n- data.table\n- ggplotify\n- gtrellis\n- jsonlite\n- tidyverse\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ComplexHeatmap)\nlibrary(RColorBrewer)\nlibrary(circlize)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(gtrellis)\n\n# Prepare data\n# Load data\ndata1 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/gene-density/data.json\")$exampleData$textarea[[1]])\ndata1 <- as.data.frame(data1)\ndata2 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/gene-density/data.json\")$exampleData$textarea[[2]])\ndata2 <- as.data.frame(data2)\n\n# Convert data structure\nchrNum <- str_replace(unique(data1$chr), \"Chr|chr\", \"\")\ndata1$chr <- factor(data1$chr, levels = paste0(\"Chr\", chrNum))\ndata2$chr <- factor(data2$chr, levels = paste0(\"Chr\", chrNum))\n# Set window to calculate gene density\nwindows <- 100 * 1000 # default:100kb window size\ngene_density <- genomicDensity(data2, window.size = windows)\ngene_density$chr <- factor(gene_density$chr,\n levels = paste0(\"Chr\", chrNum)\n)\n\n# View data\nhead(data1)\nhead(data2)\n\n# Create visualization\n# Set the palettes\npalettes <- c(\"#B2182B\",\"#EF8A62\",\"#FDDBC7\",\"#D1E5F0\",\"#67A9CF\",\"#2166AC\")\ncol_fun <- colorRamp2(\n seq(0, max(gene_density[[4]]), length = 6), rev(palettes)\n )\ncm <- ColorMapping(col_fun = col_fun)\n# Set the Legend\nlgd <- color_mapping_legend(\n cm, plot = F, title = \"density\", color_bar = \"continuous\"\n )\n# Plot\np <- as.ggplot(function() {\n gtrellis_layout(\n data1, n_track = 2, ncol = 1, byrow = FALSE,\n track_axis = FALSE, add_name_track = FALSE,\n xpadding = c(0.1, 0), gap = unit(1, \"mm\"),\n track_height = unit.c(unit(1, \"null\"), unit(4, \"mm\")),\n track_ylim = c(0, max(gene_density[[4]]), 0, 1),\n border = FALSE, asist_ticks = FALSE,\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/060-gene-density.html\n", - "source_file": "Hiplot/060-gene-density.qmd", - "skill_file": "skills/Hiplot/060-gene-density_skill.md" - }, - { - "name": "Gene Ranking Dotplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "ggrepel", - "jsonlite" - ], - "use_when": "Gene expression ranking visualization.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/061-gene-rank.html", - "skill": "# Skill: Gene Ranking Dotplot (R)\n\n## Category\nHiplot\n\n## When to Use\nGene expression ranking visualization.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- ggrepel\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggrepel)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/gene-rank/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\n## ordered by log2FoldChange and pvalue\ndata <- data[order(-data$log2FC, data$pvalue), ]\n## add the rank column\ndata$rank <- 1:nrow(data)\n## get the top n up and down gene for labeling\ntop_n <- 5\ntop_n_up <- rownames(head(data, top_n))\ntop_n_down <- rownames(tail(data, top_n))\ngenes_to_label <- c(top_n_up, top_n_down)\ndata2 <- data[genes_to_label, ]\n\n# View data\nhead(data)\n\n# Create visualization\n# Gene Ranking Dotplot\np <- \n ggplot(data, aes(rank, log2FC, color = pvalue, size = abs(log2FC))) + \n geom_point() + \n scale_color_gradientn(colours = colorRampPalette(brewer.pal(11,'RdYlBu'))(100)) +\n geom_hline(yintercept = c(-1, 1), linetype = 2, size = 0.3) +\n geom_hline(yintercept = 0, linetype = 1, size = 0.5) +\n geom_vline(xintercept = median(data$rank), linetype = 2, size = 0.3) + \n geom_text_repel(data = data2, aes(rank, log2FC, label = gene),\n size = 3, color = \"red\") +\n xlab(\"\") + ylab(\"\") + \n ylim(c(-max(abs(data$log2FC)), max(abs(data$log2FC)))) +\n labs(color = \"Pvalue\", size = \"Log2FoldChange\") +\n theme_bw(base_size = 12) +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `color`: Maps `pvalue` to the color aesthetic\n- `size`: Maps `abs` to the size aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/061-gene-rank.html\n", - "source_file": "Hiplot/061-gene-rank.qmd", - "skill_file": "skills/Hiplot/061-gene-rank_skill.md" - }, - { - "name": "Gene Cluster Trend", - "category": "Hiplot", - "language": "R", - "packages": [ - "Mfuzz", - "RColorBrewer", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The gene cluster trend is used to display different gene expression trend with multiple lines showing the similar expression patterns in each cluster.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/062-gene-trend.html", - "skill": "# Skill: Gene Cluster Trend (R)\n\n## Category\nHiplot\n\n## When to Use\nThe gene cluster trend is used to display different gene expression trend with multiple lines showing the similar expression patterns in each cluster.\n\n## Required R Packages\n- Mfuzz\n- RColorBrewer\n- data.table\n- ggplotify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(Mfuzz)\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/gene-trend/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\n## Convert a gene expression matrix to an ExpressionSet object\nrow.names(data) <- data[,1]\ndata <- data[,-1]\ndata <- as.matrix(data)\neset <- new(\"ExpressionSet\", exprs = data)\n## Filter genes with more than 25% missing values\neset <- filter.NA(eset, thres=0.25)\n## Remove genes with small differences between samples based on standard deviation\neset <- filter.std(eset, min.std=0, visu = F)\n## Data Standardization\neset <- standardise(eset)\n## Set the number of clusters\nc <- 6\n## Evaluate the optimal m value\nm <- mestimate(eset)\n## Perform mfuzz clustering\ncl <- mfuzz(eset, c = c, m = m)\n\n# View data\nhead(data)\n\n# Create visualization\n# Gene Cluster Trend\np <- as.ggplot(function(){\n mfuzz.plot2(\n eset,\n cl,\n xlab = \"Time\",\n ylab = \"Expression changes\",\n mfrow = c(2,(c/2+0.5)),\n colo = \"fancy\",\n centre = T,\n centre.col = \"red\",\n time.labels = colnames(eset),\n x11=F)\n })\n\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/062-gene-trend.html\n", - "source_file": "Hiplot/062-gene-trend.qmd", - "skill_file": "skills/Hiplot/062-gene-trend_skill.md" - }, - { - "name": "Barstats", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggplot2", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Barstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/063-ggbarstats.html", - "skill": "# Skill: Barstats (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Barstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- cowplot\n- data.table\n- ggplot2\n- ggstatsplot\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggstatsplot)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ggbarstats/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\naxis <- c(\"relig\", \"partyid\", \"race\")\ndata[, axis[1]] <- factor(data[, axis[1]], levels = rev(unique(data[, axis[1]])))\ndata[, axis[2]] <- factor(data[, axis[2]], levels = unique(data[, axis[2]]))\ndata[, axis[3]] <- factor(data[, axis[3]], levels = unique(data[, axis[3]]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Barstats\ng <- unique(data[,axis[3]])\nplist <- list()\nfor (i in 1:length(g)) {\n fil <- data[,axis[3]] == g[i]\n plist[[i]] <- ggbarstats(\n data = data[fil,], x = relig, y = partyid,\n plotgrid.args = list(ncol = 1), paired = F, k = 2) +\n scale_fill_manual(values = c(\"#00468BFF\",\"#ED0000FF\",\"#42B540FF\"))\n}\np <- plot_grid(plotlist = plist, ncol = 1)\n\np\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/063-ggbarstats.html\n", - "source_file": "Hiplot/063-ggbarstats.qmd", - "skill_file": "skills/Hiplot/063-ggbarstats_skill.md" - }, - { - "name": "Betweenstats", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggplot2", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Betweenstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/064-ggbetweenstats.html", - "skill": "# Skill: Betweenstats (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Betweenstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- cowplot\n- data.table\n- ggplot2\n- ggstatsplot\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggstatsplot)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ggbetweenstats/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\naxis <- c(\"mpaa\", \"length\", \"genre\")\ndata[, axis[1]] <- factor(data[, axis[1]], levels = unique(data[, axis[1]]))\ndata[, axis[3]] <- factor(data[, axis[3]], levels = unique(data[, axis[3]]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Betweenstats\ng <- unique(data[,axis[3]])\nplist <- list()\nfor (i in 1:length(g)) {\n fil <- data[,axis[3]] == g[i]\n plist[[i]] <- ggbetweenstats(\n data = data[fil,], x = mpaa, y = length,\n title= paste('', axis[3], g[i], sep = ':'),\n p.adjust.method = \"holm\",\n plot.type = \"boxviolin\",\n pairwise.comparisons = T,\n pairwise.display = \"significant\",\n effsize.type = \"unbiased\",\n notch = T,\n type = \"parametric\",\n plotgrid.args = list(ncol = 2)) +\n scale_color_manual(values = c(\"#00468BFF\",\"#ED0000FF\",\"#42B540FF\"))\n}\np <- plot_grid(plotlist = plist, ncol = 2)\n\np\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/064-ggbetweenstats.html\n", - "source_file": "Hiplot/064-ggbetweenstats.qmd", - "skill_file": "skills/Hiplot/064-ggbetweenstats_skill.md" - }, - { - "name": "Directed Acyclic Graphs", - "category": "Hiplot", - "language": "R", - "packages": [ - "ggdag" - ], - "use_when": "Visualizing directed acyclic graphs.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/065-ggdag.html", - "skill": "# Skill: Directed Acyclic Graphs (R)\n\n## Category\nHiplot\n\n## When to Use\nVisualizing directed acyclic graphs.\n\n## Required R Packages\n- ggdag\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ggdag)\n\n# Prepare data\n# Load data\ntidy_ggdag <- dagify(\n y ~ x + z2 + w2 + w1,\n x ~ z1 + w1 + w2,\n z1 ~ w1 + v,\n z2 ~ w2 + v,\n w1 ~ ~w2, # bidirected path\n exposure = \"x\",\n outcome = \"y\") %>%\n tidy_dagitty()\n\n# View data\nhead(tidy_ggdag)\n\n# Create visualization\n# Directed Acyclic Graphs\np <- ggdag(tidy_ggdag) +\n theme_dag() \n\np\n```\n\n## Key Parameters\n- `theme`: Plot theme; tutorial uses `theme_dag()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/065-ggdag.html\n", - "source_file": "Hiplot/065-ggdag.qmd", - "skill_file": "skills/Hiplot/065-ggdag_skill.md" - }, - { - "name": "Dist Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "broom", - "data.table", - "ggdist", - "ggplot2", - "jsonlite", - "modelr", - "tidyr" - ], - "use_when": "The dist plot is a visual diagram using a confidence distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/066-ggdist.html", - "skill": "# Skill: Dist Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nThe dist plot is a visual diagram using a confidence distribution.\n\n## Required R Packages\n- broom\n- data.table\n- ggdist\n- ggplot2\n- jsonlite\n- modelr\n- tidyr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(broom)\nlibrary(data.table)\nlibrary(ggdist)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(modelr)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ggdist/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[, 1] <- factor(data[, 1], levels = rev(unique(data[, 1])))\ndata <- tibble(data)\ndata2 = lm(response ~ condition, data = data)\ndata3 <- data_grid(data, condition) %>%\n augment(data2, newdata = ., se_fit = TRUE)\n\n# View data\nhead(data)\n\n# Create visualization\n# Dist Plot\np <- ggplot(data3, aes_(y = as.name(colnames(data[1])))) +\n stat_dist_halfeye(aes(dist = \"student_t\", arg1 = df.residual(data2),\n arg2 = .fitted, arg3 = .se.fit),\n scale = .5) +\n geom_point(aes_(x = as.name(colnames(data[2]))),\n data = data, pch = \"|\", size = 2,\n position = position_nudge(y = -.15)) +\n ggtitle(\"ggdist Plot\") + \n xlab(\"response\") + ylab(\"condition\") +\n theme_ggdist() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_ggdist()`\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/066-ggdist.html\n", - "source_file": "Hiplot/066-ggdist.qmd", - "skill_file": "skills/Hiplot/066-ggdist_skill.md" - }, - { - "name": "Histostats", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Display data distribution and inference.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/067-gghistostats.html", - "skill": "# Skill: Histostats (R)\n\n## Category\nHiplot\n\n## When to Use\nDisplay data distribution and inference.\n\n## Required R Packages\n- data.table\n- ggstatsplot\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggstatsplot)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/gghistostats/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\naxis <- c(\"budget\", \"genre\")\ndata[, axis[2]] <- factor(data[, axis[2]], levels = unique(data[, axis[2]]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Histostats\np <- grouped_gghistostats(\n data = data, x = budget, grouping.var = genre,\n effsize.type = \"unbiased\",\n type = \"parametric\",\n centrality.k = 2,\n plotgrid.args = list(ncol = 2),\n centrality.parameter = \"solid\",\n centrality.line.args = list(size = 1, color = \"black\"),\n bar.fill = \"#0D47A1\", \n centrality.label.args = list(color = \"#0D47A1\", size = 3),\n test.value = as.numeric(0),\n normal.curve = F,\n normal.curve.args = list(size = 1)\n)\n\np\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/067-gghistostats.html\n", - "source_file": "Hiplot/067-gghistostats.qmd", - "skill_file": "skills/Hiplot/067-gghistostats_skill.md" - }, - { - "name": "GGPIE", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "dplyr", - "ggpie", - "ggplot2", - "jsonlite" - ], - "use_when": "The pie chart is a statistical chart that shows the proportion of each part by dividing a circle into sections.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/068-ggpie.html", - "skill": "# Skill: GGPIE (R)\n\n## Category\nHiplot\n\n## When to Use\nThe pie chart is a statistical chart that shows the proportion of each part by dividing a circle into sections.\n\n## Required R Packages\n- cowplot\n- data.table\n- dplyr\n- ggpie\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(ggpie)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ggpie/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\naxis <- c(\"am\", \"cyl\")\ndata[, axis[1]] <- factor(data[, axis[1]], levels = unique(data[, axis[1]]))\ndata[, axis[2]] <- factor(data[, axis[2]], levels = unique(data[, axis[2]]))\n\n# View data\nhead(data)\n\n# Create visualization\n# GGPIE\nplist <- list()\nfor (j in unique(data[, axis[2]])) {\n plist[[j]] <- ggpie(\n data = data[data[, axis[2]] == j,],\n group_key = axis[1], count_type = \"full\",\n label_type = \"horizon\", label_size = 8,\n label_info = \"all\", label_pos = \"out\") + \n scale_fill_manual(values = c(\"#00468BFF\",\"#ED0000FF\")) +\n ggtitle(j)\n }\n\nplot_grid(plotlist = plist, ncol = 3)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/068-ggpie.html\n", - "source_file": "Hiplot/068-ggpie.qmd", - "skill_file": "skills/Hiplot/068-ggpie_skill.md" - }, - { - "name": "Piestats Group", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggplot2", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Piestats Group using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/069-ggpiestats-group.html", - "skill": "# Skill: Piestats Group (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Piestats Group using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- cowplot\n- data.table\n- ggplot2\n- ggstatsplot\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggstatsplot)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ggpiestats-group/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\naxis <- c(\"genre\", \"mpaa\")\ndata[, axis[1]] <- factor(data[, axis[1]], levels = unique(data[, axis[1]]))\ndata[, axis[2]] <- factor(data[, axis[2]], levels = unique(data[, axis[2]]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Piestats Group\ng <- unique(data[,axis[2]])\nplist <- list()\nfor (i in 1:length(g)) {\n fil <- data[,axis[2]] == g[i]\n plist[[i]] <- \n ggpiestats(\n data = data[fil,], x = genre, \n title= paste('', axis[2], g[i], sep = ':'),\n plotgrid.args = list(ncol = 3),\n label.repel = TRUE,\n k = 2\n ) +\n scale_fill_manual(values = c(\"#3B4992FF\",\"#EE0000FF\",\"#008B45FF\",\"#631879FF\",\n \"#008280FF\",\"#BB0021FF\",\"#5F559BFF\",\"#A20056FF\",\n \"#808180FF\"))\n}\n\nplot_grid(plotlist = plist, ncol = 3)\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/069-ggpiestats-group.html\n", - "source_file": "Hiplot/069-ggpiestats-group.qmd", - "skill_file": "skills/Hiplot/069-ggpiestats-group_skill.md" - }, - { - "name": "Piestats", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Piestats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/071-ggpiestats.html", - "skill": "# Skill: Piestats (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Piestats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggstatsplot\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggstatsplot)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ggpiestats/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\naxis <- c(\"am\", \"cyl\")\ndata[, axis[1]] <- factor(data[, axis[1]], levels = unique(data[, axis[1]]))\ndata[, axis[2]] <- factor(data[, axis[2]], levels = unique(data[, axis[2]]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Piestats\np <- ggpiestats(data = data, x = am, y = cyl,\n paired = F) +\n scale_fill_manual(values = c(\"#3B4992FF\",\"#EE0000FF\"))\n\np\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/071-ggpiestats.html\n", - "source_file": "Hiplot/071-ggpiestats.qmd", - "skill_file": "skills/Hiplot/071-ggpiestats_skill.md" - }, - { - "name": "GGPubr Boxplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "ggthemes", - "jsonlite" - ], - "use_when": "Feature-rich boxplot (GGPubr interface).", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/072-ggpubr-boxplot.html", - "skill": "# Skill: GGPubr Boxplot (R)\n\n## Category\nHiplot\n\n## When to Use\nFeature-rich boxplot (GGPubr interface).\n\n## Required R Packages\n- data.table\n- ggpubr\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggpubr)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ggpubr-boxplot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# GGPubr Boxplot\np <- ggboxplot(\n data = data, x = \"supp\", y = \"len\", facet.by = \"dose\",\n merge = T,\n color = \"supp\",\n fill = \"white\") + \n stat_compare_means(\n label = \"p.signif\",\n label.x.npc = \"center\",\n method = \"wilcox\") + \n scale_y_continuous(expand = expansion(mult = c(0.2, 0.2))) +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\")) +\n ggtitle(\"Complex Boxplot\") + \n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/072-ggpubr-boxplot.html\n", - "source_file": "Hiplot/072-ggpubr-boxplot.qmd", - "skill_file": "skills/Hiplot/072-ggpubr-boxplot_skill.md" - }, - { - "name": "Scatterstats", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Scatterstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/073-ggscatterstats.html", - "skill": "# Skill: Scatterstats (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Scatterstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- ggstatsplot\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggstatsplot)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ggscatterstats/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Scatterstats\np <- ggscatterstats(\n data = data, x = rating, y = budget\n)\n\np\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/073-ggscatterstats.html\n", - "source_file": "Hiplot/073-ggscatterstats.qmd", - "skill_file": "skills/Hiplot/073-ggscatterstats_skill.md" - }, - { - "name": "Seqlogo", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggseqlogo", - "jsonlite" - ], - "use_when": "The sequence LOGO is a graphic that describes a sequence pattern of binding sites.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/074-ggseqlogo.html", - "skill": "# Skill: Seqlogo (R)\n\n## Category\nHiplot\n\n## When to Use\nThe sequence LOGO is a graphic that describes a sequence pattern of binding sites.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggseqlogo\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggseqlogo)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ggseqlogo/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata <- data[, !sapply(data, function(x) {all(is.na(x))})]\ndata <- as.list(data)\ndata <- lapply(data, function(x) {return(x[!is.na(x)])})\n\n# View data\nstr(data[1:5])\n\n# Create visualization\n# Seqlogo\np <- ggseqlogo(\n data,\n ncol = 4,\n col_scheme = \"nucleotide\",\n seq_type = \"dna\",\n method = \"bits\") + \n theme(plot.title = element_text(hjust = 0.5))\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/074-ggseqlogo.html\n", - "source_file": "Hiplot/074-ggseqlogo.qmd", - "skill_file": "skills/Hiplot/074-ggseqlogo_skill.md" - }, - { - "name": "Complex-Violin", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggplot2", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Complex-Violin using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/075-ggwithinstats.html", - "skill": "# Skill: Complex-Violin (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Complex-Violin using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- cowplot\n- data.table\n- ggplot2\n- ggstatsplot\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggstatsplot)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ggwithinstats/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\naxis <- c(\"condition\", \"desire\", \"region\")\ndata[, axis[1]] <- factor(data[, axis[1]], levels = unique(data[, axis[1]]))\ndata[, axis[3]] <- factor(data[, axis[3]], levels = unique(data[, axis[3]]))\n\n# View data\nstr(data)\n\n# Create visualization\n# Complex-Violin\ng <- unique(data[,axis[3]])\nplist <- list()\nfor (i in 1:length(g)) {\n fil <- data[,axis[3]] == g[i]\n plist[[i]] <- ggwithinstats(\n data = data[fil,], x = condition, y = desire,\n title= paste('', axis[3], g[i], sep = ':'),\n p.adjust.method = \"holm\",\n plot.type = \"boxviolin\",\n pairwise.comparisons = T,\n pairwise.display = \"significant\",\n effsize.type = \"unbiased\",\n notch = T,\n type = \"parametric\",\n k = 2,\n plotgrid.args = list(ncol = 2)\n ) +\n scale_color_manual(values = c(\"#3B4992FF\",\"#EE0000FF\"))\n}\n\nplot_grid(plotlist = plist, ncol = 2)\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/075-ggwithinstats.html\n", - "source_file": "Hiplot/075-ggwithinstats.qmd", - "skill_file": "skills/Hiplot/075-ggwithinstats_skill.md" - }, - { - "name": "ggwordcloud", - "category": "Hiplot", - "language": "R", - "packages": [ - "curl", - "data.table", - "ggwordcloud", - "jsonlite", - "png" - ], - "use_when": "The word cloud is to visualize the \"keywords\" that appear frequently in the web text by forming a \"keyword cloud layer\" or \"keyword rendering\".", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/076-ggwordcloud.html", - "skill": "# Skill: ggwordcloud (R)\n\n## Category\nHiplot\n\n## When to Use\nThe word cloud is to visualize the \"keywords\" that appear frequently in the web text by forming a \"keyword cloud layer\" or \"keyword rendering\".\n\n## Required R Packages\n- curl\n- data.table\n- ggwordcloud\n- jsonlite\n- png\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(curl)\nlibrary(data.table)\nlibrary(ggwordcloud)\nlibrary(jsonlite)\nlibrary(png)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ggwordcloud/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ninmask <- \"https://download.hiplot.cn/api/file/fetch/?path=public/demo/ggwordcloud/hearth.png\"\n\n# Convert data structure\ncol <- data[, 2]\ndata <- cbind(data, col)\n\n# View data\nhead(data)\n\n# Create visualization\n# ggwordcloud\np <- ggplot(data, aes(label = word, size = freq, color = col)) +\n scale_size_area(max_size = 40) +\n theme_minimal() + \n geom_text_wordcloud_area(\n mask = png::readPNG(curl::curl_fetch_memory(inmask)$content), \n rm_outside = TRUE) +\n scale_color_gradient(low = \"#8B0000\", high = \"#FF0000\")\n\np\n```\n\n## Key Parameters\n- `size`: Maps `freq` to the size aesthetic\n- `color`: Maps `col` to the color aesthetic\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/076-ggwordcloud.html\n", - "source_file": "Hiplot/076-ggwordcloud.qmd", - "skill_file": "skills/Hiplot/076-ggwordcloud_skill.md" - }, - { - "name": "GOBar Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "GOplot", - "data.table", - "jsonlite" - ], - "use_when": "The gobar plot is used to display Z-score coloured barplot of terms ordered alternatively by z-score or the negative logarithm of the adjusted p-value.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/077-gobar.html", - "skill": "# Skill: GOBar Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nThe gobar plot is used to display Z-score coloured barplot of terms ordered alternatively by z-score or the negative logarithm of the adjusted p-value.\n\n## Required R Packages\n- GOplot\n- data.table\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(GOplot)\nlibrary(data.table)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/gobar/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ncolnames(data) <- c(\"category\",\"ID\",\"term\",\"count\",\"genes\",\"logFC\",\"adj_pval\",\"zscore\")\ndata <- data[data$category %in% c(\"BP\",\"CC\",\"MF\"),]\ndata <- data[!is.na(data$adj_pval),]\ndata$adj_pval <- as.numeric(data$adj_pval)\ndata$zscore <- as.numeric(data$zscore)\n\n# View data\nhead(data)\n\n# Create visualization\n# GOBar Plot\np <- GOBar(data, display = \"multiple\", order.by.zscore = T,\n title = \"GO Enrichment Barplot \", \n zsc.col = c(\"#EF8A62\",\"#F7F7F7\",\"#67A9CF\")) + \n theme(plot.title = element_text(hjust = 0.5),\n axis.text.x = element_text(size = 8))\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/077-gobar.html\n", - "source_file": "Hiplot/077-gobar.qmd", - "skill_file": "skills/Hiplot/077-gobar_skill.md" - }, - { - "name": "GOBubble Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "GOplot", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The gobubble plot is used to display Z-score coloured bubble plot of terms ordered alternatively by z-score or the negative logarithm of the adjusted p-value.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/078-gobubble.html", - "skill": "# Skill: GOBubble Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nThe gobubble plot is used to display Z-score coloured bubble plot of terms ordered alternatively by z-score or the negative logarithm of the adjusted p-value.\n\n## Required R Packages\n- GOplot\n- data.table\n- ggplotify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(GOplot)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/gobubble/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ncolnames(data) <- c(\"category\",\"ID\",\"term\",\"count\",\"genes\",\"logFC\",\"adj_pval\",\"zscore\")\ndata <- data[data$category %in% c(\"BP\",\"CC\",\"MF\"),]\ndata <- data[!is.na(data$adj_pval),]\ndata$adj_pval <- as.numeric(data$adj_pval)\ndata$zscore <- as.numeric(data$zscore)\n\n# View data\nhead(data)\n\n# Create visualization\n# GOBubble Plot\np <- function () {\n GOBubble(data, display = \"single\", title = \"GO Enrichment Bubbleplot\",\n colour = c(\"#FC8D59\",\"#FFFFBF\",\"#99D594\"),\n labels = 0, ID = T, table.legend = T, table.col = T, bg.col = F) + \n theme(plot.title = element_text(hjust = 0.5))\n}\np <- as.ggplot(p)\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/078-gobubble.html\n", - "source_file": "Hiplot/078-gobubble.qmd", - "skill_file": "skills/Hiplot/078-gobubble_skill.md" - }, - { - "name": "GOCircle Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "GOplot", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The gocircle plot is used to display the circular plot combines gene expression and gene- annotation enrichment data. A subset of terms is displayed like the GOBar plot in combination with a scatter plot of the gene expression data. The whole plot is drawn on a specific coordinate system to achieve the circular layout. The segments are labeled with the term ID.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/079-gocircle.html", - "skill": "# Skill: GOCircle Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nThe gocircle plot is used to display the circular plot combines gene expression and gene- annotation enrichment data. A subset of terms is displayed like the GOBar plot in combination with a scatter plot of the gene expression data. The whole plot is drawn on a specific coordinate system to achieve the circular layout. The segments are labeled with the term ID.\n\n## Required R Packages\n- GOplot\n- data.table\n- ggplotify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(GOplot)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/gocircle/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ncolnames(data) <- c(\"category\",\"ID\",\"term\",\"count\",\"genes\",\"logFC\",\"adj_pval\",\"zscore\")\ndata <- data[!is.na(data$adj_pval),]\ndata$adj_pval <- as.numeric(data$adj_pval)\ndata$zscore <- as.numeric(data$zscore)\ndata$count <- as.numeric(data$count)\n\n# View data\nhead(data)\n\n# Create visualization\n# GOCircle Plot\np <- function () {\n GOCircle(data, title = \"GO Enrichment Circleplot\",\n nsub = 10, rad1 = 2, rad2 = 3, table.legend = T, label.size = 5,\n zsc.col = c(\"#FC8D59\",\"#FFFFBF\",\"#99D594\")) + \n theme(plot.title = element_text(hjust = 0.5))\n}\np <- as.ggplot(p)\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/079-gocircle.html\n", - "source_file": "Hiplot/079-gocircle.qmd", - "skill_file": "skills/Hiplot/079-gocircle_skill.md" - }, - { - "name": "Group Rank Dotplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "sigminer" - ], - "use_when": "Values distribution for different groups.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/080-grdotplot.html", - "skill": "# Skill: Group Rank Dotplot (R)\n\n## Category\nHiplot\n\n## When to Use\nValues distribution for different groups.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n- sigminer\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(sigminer)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/grdotplot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Group Rank Dotplot\np <- show_group_distribution(data, gvar = \"gvar\", dvar = \"dvar\", \n order_by_fun = F)\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/080-grdotplot.html\n", - "source_file": "Hiplot/080-grdotplot.qmd", - "skill_file": "skills/Hiplot/080-grdotplot_skill.md" - }, - { - "name": "Group Bubble", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Group Bubble using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/081-group-bubble.html", - "skill": "# Skill: Group Bubble (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Group Bubble using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/group-bubble/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Group Bubble\np <- ggplot(data = data, aes(x = Sepal.Length, y = Sepal.Width, \n size = Petal.Width, color = Species)) +\n geom_point(alpha = 0.7) +\n scale_size(range = c(1, 4)) +\n scale_color_manual(values = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\")) +\n theme_bw()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `Sepal` to the x aesthetic\n- `y`: Maps `Sepal` to the y aesthetic\n- `size`: Maps `Petal` to the size aesthetic\n- `color`: Maps `Species` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/081-group-bubble.html\n", - "source_file": "Hiplot/081-group-bubble.qmd", - "skill_file": "skills/Hiplot/081-group-bubble_skill.md" - }, - { - "name": "Group-comparison Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "sigminer" - ], - "use_when": "Group-comparison Heatmap provides a way to compare multiple variables across multiple (>2) groups and visualize the result with heatmap.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/082-group-comparison.html", - "skill": "# Skill: Group-comparison Heatmap (R)\n\n## Category\nHiplot\n\n## When to Use\nGroup-comparison Heatmap provides a way to compare multiple variables across multiple (>2) groups and visualize the result with heatmap.\n\n## Required R Packages\n- data.table\n- jsonlite\n- sigminer\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(jsonlite)\nlibrary(sigminer)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/group-comparison/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Define plot functions\nunlist_and_covert <- function(x, recursive = FALSE) {\n if (!is.null(x)) {\n x <- unlist(x, recursive = recursive)\n if (!is.null(x)) {\n y <- sapply(x, function(x) {\n if (identical(x, \"NA\")) NA else x\n })\n names(y) <- names(x)\n x <- y\n }\n }\n x\n}\n\nplotentry <- function(data,\n grp_vars = NULL, enrich_vars = NULL, cross = TRUE,\n co_method = c(\"t.test\", \"wilcox.test\"), ref_group = NA,\n scales = \"free\", add_text_annotation = TRUE,\n fill_by_p_value = TRUE, use_fdr = TRUE, cut_p_value = FALSE,\n cluster_row = FALSE) {\n ref_group <- unlist_and_covert(ref_group)\n if (is.null(ref_group)) ref_group <- NA\n rv <- group_enrichment(data, grp_vars, enrich_vars, cross, co_method, ref_group)\n if (length(unique(rv$grp_var)) == 1) {\n p <- show_group_enrichment(rv,\n return_list = TRUE,\n scales = scales, add_text_annotation = add_text_annotation,\n fill_by_p_value = fill_by_p_value, use_fdr = use_fdr, cut_p_value = cut_p_value,\n cluster_row = cluster_row\n )\n p <- p[[1]]\n } else {\n p <- show_group_enrichment(rv,\n scales = scales, add_text_annotation = add_text_annotation,\n fill_by_p_value = fill_by_p_value, use_fdr = use_fdr, cut_p_value = cut_p_value,\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/082-group-comparison.html\n", - "source_file": "Hiplot/082-group-comparison.qmd", - "skill_file": "skills/Hiplot/082-group-comparison_skill.md" - }, - { - "name": "Group Dumbbell", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggalt", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Group Dumbbell using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/083-group-dumbbell.html", - "skill": "# Skill: Group Dumbbell (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Group Dumbbell using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- ggalt\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggalt)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/group-dumbbell/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata <- data[order(data[[\"group\"]], data[[\"y1952\"]]),]\ndata[[\"country\"]] <- factor(data[[\"country\"]], levels = data[[\"country\"]])\n\n# View data\nhead(data)\n\n# Create visualization\n# Group Dumbbell\np <- ggplot(data = data, aes(x = y1952, xend = y2007, y = country, color = group)) +\n geom_dumbbell(size = 1, size_xend = 2, size_x = 2) +\n theme_bw()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `y1952` to the x aesthetic\n- `y`: Maps `country` to the y aesthetic\n- `color`: Maps `group` to the color aesthetic\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/083-group-dumbbell.html\n", - "source_file": "Hiplot/083-group-dumbbell.qmd", - "skill_file": "skills/Hiplot/083-group-dumbbell_skill.md" - }, - { - "name": "Group Line", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Group Line using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/084-group-line.html", - "skill": "# Skill: Group Line (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Group Line using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/group-line/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Group Line\np <- ggplot(data, aes(x = x, y = y, group = names, color = groups)) +\n geom_line() +\n geom_point() +\n scale_color_manual(values = c(\"#e04d39\",\"#5bbad6\")) +\n theme_bw()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `x` to the x aesthetic\n- `y`: Maps `y` to the y aesthetic\n- `group`: Maps `names` to the group aesthetic\n- `color`: Maps `groups` to the color aesthetic\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/084-group-line.html\n", - "source_file": "Hiplot/084-group-line.qmd", - "skill_file": "skills/Hiplot/084-group-line_skill.md" - }, - { - "name": "Half Violin", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "ggpubr", - "ggthemes", - "jsonlite" - ], - "use_when": "The half violin plot is a statistical graph used to display the distribution and probability density of data by replacing the left part with the data frequency count graph on the basis of keeping the right part of violin graph.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/085-half-violin.html", - "skill": "# Skill: Half Violin (R)\n\n## Category\nHiplot\n\n## When to Use\nThe half violin plot is a statistical graph used to display the distribution and probability density of data by replacing the left part with the data frequency count graph on the basis of keeping the right part of violin graph.\n\n## Required R Packages\n- data.table\n- dplyr\n- ggplot2\n- ggpubr\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(ggpubr)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/half-violin/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ncolnames(data) <- c(\"Value\", \"Group\")\ndata[, 2] <- factor(data[, 2], levels = unique(data[, 2]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Half Violin\ngeom_flat_violin <- function(\n mapping = NULL, data = NULL, stat = \"ydensity\", position = \"dodge\", \n trim = TRUE, scale = \"area\", show.legend = NA, inherit.aes = TRUE, ...) {\n ggplot2::layer(data = data, mapping = mapping, stat = stat, \n geom = geom_flat_violin_proto, position = position,\n show.legend = show.legend, inherit.aes = inherit.aes,\n params = list(trim = trim, scale = scale, ...))\n}\n\n\"%||%\" <- function(a, b) {\n if (!is.null(a)) {\n a\n } else {\n b\n }\n}\n\ngeom_flat_violin_proto <-\n ggproto(\"geom_flat_violin_proto\", Geom,\n setup_data = function(data, params) {\n data$width <- data$width %||%\n params$width %||% (resolution(data$x, FALSE) * 0.9)\n \n data %>%\n dplyr::group_by(.data = ., group) %>%\n dplyr::mutate(.data = ., ymin = min(y), ymax = max(y), xmin = x,\n xmax = x + width / 2)\n },\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `size`: Maps `0` to the size aesthetic\n- `alpha`: Maps `NA` to the alpha aesthetic\n- `fill`: Maps `Group` to the fill aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/085-half-violin.html\n", - "source_file": "Hiplot/085-half-violin.qmd", - "skill_file": "skills/Hiplot/085-half-violin_skill.md" - }, - { - "name": "Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "ComplexHeatmap", - "data.table", - "genefilter", - "jsonlite" - ], - "use_when": "Heat map is an intuitive and visual method for analyzing the distribution of experimental data, which can be used for quality control of experimental data and visualization display of difference data, as well as clustering of data and samples to observe sample quality.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/086-heatmap.html", - "skill": "# Skill: Heatmap (R)\n\n## Category\nHiplot\n\n## When to Use\nHeat map is an intuitive and visual method for analyzing the distribution of experimental data, which can be used for quality control of experimental data and visualization display of difference data, as well as clustering of data and samples to observe sample quality.\n\n## Required R Packages\n- ComplexHeatmap\n- data.table\n- genefilter\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ComplexHeatmap)\nlibrary(data.table)\nlibrary(genefilter)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata_count <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/heatmap/data.json\")$exampleData[[1]]$textarea[[1]])\ndata_count <- as.data.frame(data_count)\ndata_sample <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/heatmap/data.json\")$exampleData[[1]]$textarea[[2]])\ndata_sample <- as.data.frame(data_sample)\ndata_gene <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/heatmap/data.json\")$exampleData[[1]]$textarea[[3]])\ndata_gene <- as.data.frame(data_gene)\n\n# Convert data structure\ndata_count <- data_count[!is.na(data_count[, 1]), ]\nidx <- duplicated(data_count[, 1])\ndata_count[idx, 1] <- paste0(data_count[idx, 1], \"--dup-\", cumsum(idx)[idx])\nfor (i in 2:ncol(data_count)) {\n data_count[, i] <- as.numeric(data_count[, i])\n}\ndata <- as.matrix(data_count[, -1])\nrownames(data) <- data_count[, 1]\n\n## Add annotation information to samples\nsample.info <- data_sample[-1]\nrow.names(sample.info) <- data_sample[, 1]\nsample_info_reorder <- as.data.frame(sample.info[match(\n colnames(data), rownames(sample.info)\n ), ])\ncolnames(sample_info_reorder) <- colnames(sample.info)\nrownames(sample_info_reorder) <- colnames(data)\n\n## Add annotation information to genes\ngene_info <- data_gene[-1]\nrownames(gene_info) <- data_gene[, 1]\ngene_info_reorder <- as.data.frame(gene_info[match(\n rownames(data), rownames(gene_info)\n ), ])\ncolnames(gene_info_reorder) <- colnames(gene_info)\nrownames(gene_info_reorder) <- rownames(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Heatmap\n## Set annotation_col and annotation_row to add annotations to samples and genes respectively\ntop_var <- 100\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/086-heatmap.html\n", - "source_file": "Hiplot/086-heatmap.qmd", - "skill_file": "skills/Hiplot/086-heatmap_skill.md" - }, - { - "name": "Hi-C Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The HiC heatmap is used to display the genome-wide chromatin interaction with heatmap on different chromosomes.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/087-hic-heatmap.html", - "skill": "# Skill: Hi-C Heatmap (R)\n\n## Category\nHiplot\n\n## When to Use\nThe HiC heatmap is used to display the genome-wide chromatin interaction with heatmap on different chromosomes.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/hic-heatmap/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Hi-C Heatmap\n## Calculate the number of bins\nbins_num <- max(data$index_bin1) + 1\n## Set the resolution of HiC data\nresolution <- 500\nres <- resolution * 1000\n# Set the separation unit to 50Mb\nintervals <- 50\nspacing <- intervals * 1000000\n## Count the number of breaks\nbreaks_num <- (res * bins_num) / spacing\n## Set breaks\nbreaks <- c()\nfor (i in 0:breaks_num) {\n breaks <- c(breaks, i * intervals)\n}\n\np <- ggplot(data = data, aes(x = index_bin1 * res, y = index_bin2 * res)) +\n geom_tile(aes(fill = freq)) +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n limits = c(0, max(data$freq) * 1.2)\n ) +\n scale_y_reverse() +\n scale_x_continuous(breaks = breaks * 1000000, labels = paste0(breaks, \"Mb\")) +\n scale_y_continuous(breaks = breaks * 1000000, labels = paste0(breaks, \"Mb\")) +\n theme(panel.grid = element_blank(), axis.title = element_blank()) +\n labs(title = paste0(\"(resolution: \", res / 1000, \"Kb)\"), x=\"\", y=\"\") +\n theme_bw() +\n theme(plot.title = element_text(hjust = 0.5),\n legend.position = \"right\", legend.key.size = unit(0.8, \"cm\"),\n panel.grid = element_blank())\n\np\n```\n\n## Key Parameters\n- `x`: Maps `index_bin1` to the x aesthetic\n- `y`: Maps `index_bin2` to the y aesthetic\n- `fill`: Maps `freq` to the fill aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/087-hic-heatmap.html\n", - "source_file": "Hiplot/087-hic-heatmap.qmd", - "skill_file": "skills/Hiplot/087-hic-heatmap_skill.md" - }, - { - "name": "Histogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "Histogram refers to the distribution of continuous variable data by a series of vertical stripes or line segments with different heights.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/088-histogram.html", - "skill": "# Skill: Histogram (R)\n\n## Category\nHiplot\n\n## When to Use\nHistogram refers to the distribution of continuous variable data by a series of vertical stripes or line segments with different heights.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/histogram/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[, 2] <- factor(data[, 2], levels = unique(data[, 2]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Histogram\np <- ggplot(data, aes(x=Value, fill=Group2)) +\n geom_histogram(alpha = 1, bins = 12, col = \"white\") +\n ggtitle(\"Histogram Plot\") +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\")) +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `Value` to the x aesthetic\n- `fill`: Maps `Group2` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/088-histogram.html\n", - "source_file": "Hiplot/088-histogram.qmd", - "skill_file": "skills/Hiplot/088-histogram_skill.md" - }, - { - "name": "Interval Area Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Interval Area Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/089-interval-area-chart.html", - "skill": "# Skill: Interval Area Chart (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Interval Area Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/interval-area-chart/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[[\"month\"]] <- factor(data[[\"month\"]], levels = data[[\"month\"]])\n\n# View data\nhead(data)\n\n# Create visualization\n# Interval Area Chart\np <- ggplot(data, aes(x = month, group = 1)) +\n geom_line(aes(y = max_temperature), size = 1.2, color = \"#EA3323\", \n linetype = \"solid\") +\n geom_line(aes(y = min_temperature), size = 1.2, color = \"#0000F5\", \n linetype = \"solid\") +\n geom_line(aes(x = month, y = mean), size = 1.2, color = \"#BEBEBE\", \n linetype = \"dashed\") +\n geom_ribbon(aes(ymin = min_temperature, ymax = max_temperature), \n fill = \"#F2F2F2\", alpha = 0.5) +\n geom_text(aes(x = month, y = max_temperature + 1, label = max_temperature),\n color = \"#EA3323\", size = 2.5, vjust = -0.5, hjust = 0) +\n geom_text(aes(x = month, y = min_temperature - 1, label = min_temperature),\n color = \"#0000F5\", size = 2.5, vjust = 1.5, hjust = 0) +\n geom_text(aes(x = month, y = mean, label = mean),\n color = \"#BEBEBE\", size = 2.5, vjust = 1.5, hjust = 0) +\n labs(title = \"Temperature\", x = \"Month\", y = \"Temperature\") +\n scale_color_manual(values = c(max = \"#EA3323\", min = \"#0000F5\")) +\n theme_bw() +\n theme(plot.title = element_text(hjust = 0.5))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `month` to the x aesthetic\n- `group`: Maps `1` to the group aesthetic\n- `y`: Maps `mean` to the y aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/089-interval-area-chart.html\n", - "source_file": "Hiplot/089-interval-area-chart.qmd", - "skill_file": "skills/Hiplot/089-interval-area-chart_skill.md" - }, - { - "name": "Interval Bar Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Interval Bar Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/090-interval-bar-chart.html", - "skill": "# Skill: Interval Bar Chart (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Interval Bar Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/interval-bar-chart/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata$name_num <- match(data[[\"month\"]], unique(data[[\"month\"]]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Interval Bar Chart\np <- ggplot(data, aes(x = month, y = max_temperature)) +\n geom_rect(aes(xmin = name_num - 0.4, xmax = name_num + 0.4,\n ymin = min_temperature, ymax = max_temperature), \n fill = \"#282726\", alpha = 0.7) +\n geom_line(aes(x = name_num, y = mean), color = \"#006064\", size = 0.8) +\n labs(x = \"Month\", y = \"Temperature\") +\n scale_x_discrete() +\n theme_bw()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `name_num` to the x aesthetic\n- `y`: Maps `mean` to the y aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/090-interval-bar-chart.html\n", - "source_file": "Hiplot/090-interval-bar-chart.qmd", - "skill_file": "skills/Hiplot/090-interval-bar-chart_skill.md" - }, - { - "name": "Likert Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "likert" - ], - "use_when": "Descriptive statistical analysis of Likert scale data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/091-likert.html", - "skill": "# Skill: Likert Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nDescriptive statistical analysis of Likert scale data.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- likert\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(likert)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/likert/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\nlevs <- unique(unlist(data))\nfor (i in 1:ncol(data)) {\n data[,i] <- factor(data[, i], levels = levs)\n}\n\n# View data\nhead(data)\n\n# Create visualization\n# Likert Plot\npobj <- likert(data)\ncolrs <- c(\"#3B4992FF\",\"#EE0000FF\")\np <- as.ggplot(plot(pobj, type = \"bar\", \n low.color = colrs[1], high.color = colrs[2], wrap = 50))\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/091-likert.html\n", - "source_file": "Hiplot/091-likert.qmd", - "skill_file": "skills/Hiplot/091-likert_skill.md" - }, - { - "name": "Line (Color Dot)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "grafify", - "jsonlite" - ], - "use_when": "Create a Line (Color Dot) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/092-line-color-dot.html", - "skill": "# Skill: Line (Color Dot) (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Line (Color Dot) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- grafify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(grafify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/line-color-dot/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\nx <- \"Time\"\ny <- \"PI\"\ngroup <- \"Experiment\"\nfacet <- \"Genotype\"\ndata[, x] <- factor(data[, x], levels = unique(data[, x]))\ndata[, group] <- factor(data[, group], levels = unique(data[, group]))\ndata[, facet] <- factor(data[, facet], levels = unique(data[, facet]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Line (Color Dot)\np <- plot_befafter_colours(\n data = data, xcol = get(x), ycol = get(y), match = get(group),\n symsize = 5, symthick = 1, s_alpha = 1) +\n facet_wrap(facet) +\n guides(fill = guide_legend(title = group)) +\n scale_fill_grafify() +\n xlab(x) + ylab(y) +\n ggtitle(\"Two-way repeated measures\") +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12, hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/092-line-color-dot.html\n", - "source_file": "Hiplot/092-line-color-dot.qmd", - "skill_file": "skills/Hiplot/092-line-color-dot_skill.md" - }, - { - "name": "Line (errorbar)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "jsonlite" - ], - "use_when": "The error line mainly indicates the error range of each data point and shows the potential error or uncertainty relative to each data in the series.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/093-line-errorbar.html", - "skill": "# Skill: Line (errorbar) (R)\n\n## Category\nHiplot\n\n## When to Use\nThe error line mainly indicates the error range of each data point and shows the potential error or uncertainty relative to each data in the series.\n\n## Required R Packages\n- data.table\n- ggpubr\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggpubr)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/line-errorbar/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[, 3] <- factor(data[, 3], levels = unique(data[, 3]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Line (errorbar)\np <- ggline(\n data, x = \"Group1\", y = \"Value\", color = \"Group2\",\n add = \"mean_se\", title = \"Line plot with errorbar\", palette = \"npg\") +\n stat_compare_means(aes_(group = as.name(\"Group2\"))) +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12, hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/093-line-errorbar.html\n", - "source_file": "Hiplot/093-line-errorbar.qmd", - "skill_file": "skills/Hiplot/093-line-errorbar_skill.md" - }, - { - "name": "Line Regression", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggrepel", - "jsonlite" - ], - "use_when": "Linear regression is a regression method for linear modeling of the relationship between independent variables and dependent variables.If there is only one independent variable, it is called simple regression, and if there is more than one independent variable, it is called multiple regression.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/094-line-regression.html", - "skill": "# Skill: Line Regression (R)\n\n## Category\nHiplot\n\n## When to Use\nLinear regression is a regression method for linear modeling of the relationship between independent variables and dependent variables.If there is only one independent variable, it is called simple regression, and if there is more than one independent variable, it is called multiple regression.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggrepel\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggrepel)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/line-regression/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata$group <- factor(data$group, levels = unique(data$group))\n\n# View data\nhead(data)\n\n# Create visualization\n# Line Regression\n## Defining the equation\nequation <- function(x, add_p = FALSE) {\n xs <- summary(x)\n lm_coef <- list(\n a = as.numeric(round(coef(x)[1], digits = 2)),\n b = as.numeric(round(coef(x)[2], digits = 2)),\n r2 = round(xs$r.squared, digits = 2),\n pval = xs$coef[2, 4] \n )\n if (add_p) {\n lm_eq <- substitute(italic(y) == a + b %.% italic(x) * \",\" ~ ~\n italic(R)^2 ~ \"=\" ~ r2 * \",\" ~ ~ italic(p) ~ \"=\" ~ pval, lm_coef)\n } else {\n lm_eq <- substitute(italic(y) == a + b %.% italic(x) * \",\" ~ ~\n italic(R)^2 ~ \"=\" ~ r2, lm_coef)\n }\n as.expression(lm_eq)\n}\n## Plot\np <- ggplot(data, aes(x = value1, y = value2, colour = group)) +\n geom_point(show.legend = TRUE) +\n geom_smooth(method = \"lm\", se = T, show.legend = F) +\n geom_rug(sides = \"bl\", size = 1, show.legend = F) +\n scale_color_manual(values = c(\"#00468BFF\",\"#ED0000FF\")) +\n ggtitle(\"Line Reguression Plot\") +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12, hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `value1` to the x aesthetic\n- `y`: Maps `value2` to the y aesthetic\n- `colour`: Maps `group` to the colour aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/094-line-regression.html\n", - "source_file": "Hiplot/094-line-regression.qmd", - "skill_file": "skills/Hiplot/094-line-regression_skill.md" - }, - { - "name": "Line", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The line chart is a statistical chart that USES a linear or logarithmic scale to draw data in a two - or three-dimensional view to show the data set or track the characteristics of the data over time.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/095-line.html", - "skill": "# Skill: Line (R)\n\n## Category\nHiplot\n\n## When to Use\nThe line chart is a statistical chart that USES a linear or logarithmic scale to draw data in a two - or three-dimensional view to show the data set or track the characteristics of the data over time.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/line/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[,3] <- factor(data[,3], levels = unique(data[,3]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Line\np <- ggplot(data, aes(x = Value1, y = Value2)) +\n geom_line(alpha = 1, aes(color = Group, linetype = Group)) +\n geom_point(aes(color = Group, shape = Group)) +\n ggtitle(\"Line Regression Plot\") +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\")) +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `Value1` to the x aesthetic\n- `y`: Maps `Value2` to the y aesthetic\n- `color`: Maps `Group` to the color aesthetic\n- `shape`: Maps `Group` to the shape aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/095-line.html\n", - "source_file": "Hiplot/095-line.qmd", - "skill_file": "skills/Hiplot/095-line_skill.md" - }, - { - "name": "Africa Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Africa Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/096-map-africa.html", - "skill": "# Skill: Africa Map (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Africa Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-africa/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-africa/afr.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$ADM0_NAME, data$region)]\n\n# View data\nhead(data)\n\n# Create visualization\n# Africa Map\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(9, 985, 139),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n labs(x = NULL, y = NULL, title = \"Africa Map\")\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/096-map-africa.html\n", - "source_file": "Hiplot/096-map-africa.qmd", - "skill_file": "skills/Hiplot/096-map-africa_skill.md" - }, - { - "name": "Americas Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Americas Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/097-map-americas.html", - "skill": "# Skill: Americas Map (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Americas Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-americas/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-americas/amr.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$ENG_NAME, data$region)]\n\n# View data\nhead(data)\n\n# Create visualization\n# Americas Map\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/097-map-americas.html\n", - "source_file": "Hiplot/097-map-americas.qmd", - "skill_file": "skills/Hiplot/097-map-americas_skill.md" - }, - { - "name": "China Map (City)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a China Map (City) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/098-map-china-city.html", - "skill": "# Skill: China Map (City) (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a China Map (City) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-china-city/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-china-city/china.city.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$city, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# China Map (City)\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/098-map-china-city.html\n", - "source_file": "Hiplot/098-map-china-city.qmd", - "skill_file": "skills/Hiplot/098-map-china-city_skill.md" - }, - { - "name": "China Map (County)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a China Map (County) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/099-map-china-county.html", - "skill": "# Skill: China Map (County) (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a China Map (County) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-china-county/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-china-county/china.county.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$county, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# China Map (County)\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/099-map-china-county.html\n", - "source_file": "Hiplot/099-map-china-county.qmd", - "skill_file": "skills/Hiplot/099-map-china-county_skill.md" - }, - { - "name": "China Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a China Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/100-map-china.html", - "skill": "# Skill: China Map (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a China Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-china/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-china/china.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$FCNAME, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# China Map\np <- ggplot(dt_map, aes(x = long, y = lat, group = group, fill = Value)) +\n labs(fill = \"Value\") +\n geom_polygon() +\n geom_path() +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n na.value = \"grey10\",\n limits = c(0, max(dt_map$Value) * 1.2)) +\n ggtitle(\"China Map Plot\") +\n theme_minimal()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/100-map-china.html\n", - "source_file": "Hiplot/100-map-china.qmd", - "skill_file": "skills/Hiplot/100-map-china_skill.md" - }, - { - "name": "China Map 2", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a China Map 2 using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/101-map-china2.html", - "skill": "# Skill: China Map 2 (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a China Map 2 using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-china2/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-china/china.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$FCNAME, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# China Map 2\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/101-map-china2.html\n", - "source_file": "Hiplot/101-map-china2.qmd", - "skill_file": "skills/Hiplot/101-map-china2_skill.md" - }, - { - "name": "Europe Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Europe Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/102-map-europe.html", - "skill": "# Skill: Europe Map (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Europe Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-europe/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-europe/eu.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$ENG_NAME, data$region)]\n\n# View data\nhead(data)\n\n# Create visualization\n# Europe Map\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/102-map-europe.html\n", - "source_file": "Hiplot/102-map-europe.qmd", - "skill_file": "skills/Hiplot/102-map-europe_skill.md" - }, - { - "name": "France Map (Town)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a France Map (Town) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/103-map-france-town.html", - "skill": "# Skill: France Map (Town) (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a France Map (Town) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-france-town/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-france-town/france_town.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$ENG_NAME, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# France Map (Town)\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/103-map-france-town.html\n", - "source_file": "Hiplot/103-map-france-town.qmd", - "skill_file": "skills/Hiplot/103-map-france-town_skill.md" - }, - { - "name": "France Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a France Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/104-map-france.html", - "skill": "# Skill: France Map (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a France Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-france/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-france/france.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$ENG_NAME, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# France Map\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/104-map-france.html\n", - "source_file": "Hiplot/104-map-france.qmd", - "skill_file": "skills/Hiplot/104-map-france_skill.md" - }, - { - "name": "Germany Map (Town)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Germany Map (Town) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/106-map-germany-town.html", - "skill": "# Skill: Germany Map (Town) (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Germany Map (Town) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-germany-town/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-germany-town/germany_town.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$ENG_NAME, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# Germany Map (Town)\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/106-map-germany-town.html\n", - "source_file": "Hiplot/106-map-germany-town.qmd", - "skill_file": "skills/Hiplot/106-map-germany-town_skill.md" - }, - { - "name": "Germany Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Germany Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/107-map-germany.html", - "skill": "# Skill: Germany Map (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Germany Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-germany/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-germany/germany.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$ENG_NAME, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# Germany Map\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/107-map-germany.html\n", - "source_file": "Hiplot/107-map-germany.qmd", - "skill_file": "skills/Hiplot/107-map-germany_skill.md" - }, - { - "name": "North America Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a North America Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/108-map-north-america.html", - "skill": "# Skill: North America Map (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a North America Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-north-america/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-north-america/na.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$ENG_NAME, data$region)]\n\n# View data\nhead(data)\n\n# Create visualization\n# North America Map\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/108-map-north-america.html\n", - "source_file": "Hiplot/108-map-north-america.qmd", - "skill_file": "skills/Hiplot/108-map-north-america_skill.md" - }, - { - "name": "Oceania/Antarc Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Oceania/Antarc Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/109-map-oceania-antarc.html", - "skill": "# Skill: Oceania/Antarc Map (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Oceania/Antarc Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-oceania-antarc/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-oceania-antarc/oca.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$ENG_NAME, data$region)]\n\n# View data\nhead(data)\n\n# Create visualization\n# Oceania/Antarc Map\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/109-map-oceania-antarc.html\n", - "source_file": "Hiplot/109-map-oceania-antarc.qmd", - "skill_file": "skills/Hiplot/109-map-oceania-antarc_skill.md" - }, - { - "name": "South America Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a South America Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/111-map-south-america.html", - "skill": "# Skill: South America Map (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a South America Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-south-america/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-south-america/sa.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$ENG_NAME, data$region)]\n\n# View data\nhead(data)\n\n# Create visualization\n# South America Map\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/111-map-south-america.html\n", - "source_file": "Hiplot/111-map-south-america.qmd", - "skill_file": "skills/Hiplot/111-map-south-america_skill.md" - }, - { - "name": "UK Map (City)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a UK Map (City) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/112-map-uk-city.html", - "skill": "# Skill: UK Map (City) (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a UK Map (City) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-uk-city/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-uk-city/uk_city.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$ENG_NAME, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# UK Map (City)\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/112-map-uk-city.html\n", - "source_file": "Hiplot/112-map-uk-city.qmd", - "skill_file": "skills/Hiplot/112-map-uk-city_skill.md" - }, - { - "name": "UK Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a UK Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/113-map-uk.html", - "skill": "# Skill: UK Map (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a UK Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-uk/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-uk/uk.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$name, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# UK Map\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/113-map-uk.html\n", - "source_file": "Hiplot/113-map-uk.qmd", - "skill_file": "skills/Hiplot/113-map-uk_skill.md" - }, - { - "name": "USA Map (County)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a USA Map (County) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/114-map-usa-county.html", - "skill": "# Skill: USA Map (County) (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a USA Map (County) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-usa-county/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-usa-county/usa.county.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$county, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# USA Map (County)\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/114-map-usa-county.html\n", - "source_file": "Hiplot/114-map-usa-county.qmd", - "skill_file": "skills/Hiplot/114-map-usa-county_skill.md" - }, - { - "name": "USA Map (States)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a USA Map (States) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/115-map-usa.html", - "skill": "# Skill: USA Map (States) (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a USA Map (States) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-usa/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-usa/usa.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$value[match(dt_map$state, data$name)]\n\n# View data\nhead(data)\n\n# Create visualization\n# USA Map (States)\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(min(data$value), max(data$value), \n round((max(data$value)-min(data$value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/115-map-usa.html\n", - "source_file": "Hiplot/115-map-usa.qmd", - "skill_file": "skills/Hiplot/115-map-usa_skill.md" - }, - { - "name": "World Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a World Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/116-map-world.html", - "skill": "# Skill: World Map (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a World Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-world/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-world/world.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$death_rate[match(dt_map$ENG_NAME, data$region)]\n\n# View data\nhead(data)\n\n# Create visualization\n# World Map\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), \n color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n na.value = \"grey10\",\n limits = c(0, max(dt_map$Value) * 1.2)) +\n ggtitle(\"World Map Plot\") +\n theme_minimal() +\n theme(plot.title = element_text(hjust = 0.5),\n legend.position = \"bottom\", legend.direction = \"horizontal\")\n\np\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/116-map-world.html\n", - "source_file": "Hiplot/116-map-world.qmd", - "skill_file": "skills/Hiplot/116-map-world_skill.md" - }, - { - "name": "World Map 2", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a World Map 2 using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/117-map-world2.html", - "skill": "# Skill: World Map 2 (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a World Map 2 using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/map-world2/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndt_map <- readRDS(url(\"https://download.hiplot.cn/ui/basic/map-world/world.rds\"))\n\n# Convert data structure\ndt_map$Value <- data$death_rate[match(dt_map$ENG_NAME, data$region)]\n\n# View data\nhead(data)\n\n# Create visualization\n# World Map 2\np <- ggplot(dt_map) +\n geom_polygon(aes(x = long, y = lat, group = group, fill = Value),\n alpha = 0.9, size = 0.5) +\n geom_path(aes(x = long, y = lat, group = group), color = \"black\", size = 0.2) +\n coord_fixed() +\n scale_fill_gradientn(\n colours = colorRampPalette(rev(brewer.pal(11,\"RdYlBu\")))(500),\n breaks = seq(round(min(dt_map$Value)), round(max(dt_map$Value)), \n round((max(dt_map$Value)-min(dt_map$Value))/7)),\n name = \"Color Key\",\n guide = guide_legend(\n direction = \"vertical\", keyheight = unit(1, units = \"mm\"),\n keywidth = unit(8, units = \"mm\"),\n title.position = \"top\", title.hjust = 0.5, label.hjust = 0.5,\n nrow = 1, byrow = T, reverse = F, label.position = \"bottom\")) +\n theme(text = element_text(color = \"#3A3F4A\"),\n axis.text = element_blank(),\n axis.ticks = element_blank(),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank(),\n legend.position = \"top\",\n legend.text = element_text(size = 4 * 1.5, color = \"black\"),\n legend.title = element_text(size = 5 * 1.5, color = \"black\"),\n plot.title = element_text(\n face = \"bold\", size = 5 * 1.5, hjust = 0.5, \n margin = margin(t = 4, b = 5), color = \"black\"),\n plot.background = element_rect(fill = \"#FFFFFF\", color = \"#FFFFFF\"),\n panel.background = element_rect(fill = \"#FFFFFF\", color = NA),\n legend.background = element_rect(fill = \"#FFFFFF\", color = NA),\n plot.margin = unit(c(1.5, 1.5, 1.5, 1.5), \"cm\")) +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `long` to the x aesthetic\n- `y`: Maps `lat` to the y aesthetic\n- `group`: Maps `group` to the group aesthetic\n- `fill`: Maps `Value` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/117-map-world2.html\n", - "source_file": "Hiplot/117-map-world2.qmd", - "skill_file": "skills/Hiplot/117-map-world2_skill.md" - }, - { - "name": "Matrix Bubble", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggalluvial", - "ggplot2", - "jsonlite" - ], - "use_when": "The color matrix bubble is used to visualize the expression matrix data of multiple genes (rows) in various cells (columns).", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/118-matrix-bubble.html", - "skill": "# Skill: Matrix Bubble (R)\n\n## Category\nHiplot\n\n## When to Use\nThe color matrix bubble is used to visualize the expression matrix data of multiple genes (rows) in various cells (columns).\n\n## Required R Packages\n- data.table\n- ggalluvial\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggalluvial)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/matrix-bubble/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[, 1] <- factor(data[, 1], levels = unique(data[, 1]))\ndata[, 2] <- factor(data[, 2], levels = unique(data[, 2]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Matrix Bubble\np <- ggplot(data = data, aes(x = x, y = y, size = value, color = y)) +\n geom_point(alpha = 1) +\n labs(title = \"Matrix Bubble\") +\n guides(color = FALSE) +\n theme(panel.background = element_blank(),\n panel.grid.major = element_line(colour = \"gray\"),\n strip.background = element_blank(),\n panel.border = element_rect(colour = \"black\", fill = NA),\n panel.spacing = unit(0, \"lines\"),\n plot.title = element_text(size = 12, hjust = 0.5),\n text = element_text(family = \"Arial\"),\n legend.title = element_text(size = 10),\n axis.text.x = element_text(angle=0, hjust=0.5, vjust=1)) +\n facet_grid(~group, scales = 'fixed', margins = F) +\n scale_color_manual(values = c(\n \"#3B4992FF\",\"#EE0000FF\",\"#008B45FF\",\"#631879FF\",\"#008280FF\",\"#BB0021FF\",\n \"#5F559BFF\",\"#A20056FF\",\"#808180FF\",\"#1B1919FF\"))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `x` to the x aesthetic\n- `y`: Maps `y` to the y aesthetic\n- `size`: Maps `value` to the size aesthetic\n- `color`: Maps `y` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/118-matrix-bubble.html\n", - "source_file": "Hiplot/118-matrix-bubble.qmd", - "skill_file": "skills/Hiplot/118-matrix-bubble_skill.md" - }, - { - "name": "Meta-analysis of Binary Data", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "meta" - ], - "use_when": "Create a Meta-analysis of Binary Data using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/119-meta-bin.html", - "skill": "# Skill: Meta-analysis of Binary Data (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Meta-analysis of Binary Data using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- meta\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(meta)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/meta-bin/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\nm1 <- metabin(ev.exp, n.exp, ev.cont, n.cont, studlab = Study, data = data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Meta-analysis of Binary Data\np <- as.ggplot(function(){\n meta::forest(m1, layout = \"meta\")\n })\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/119-meta-bin.html\n", - "source_file": "Hiplot/119-meta-bin.qmd", - "skill_file": "skills/Hiplot/119-meta-bin_skill.md" - }, - { - "name": "Meta-analysis of Continuous Data", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "meta" - ], - "use_when": "Create a Meta-analysis of Continuous Data using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/120-meta-cont.html", - "skill": "# Skill: Meta-analysis of Continuous Data (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Meta-analysis of Continuous Data using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- meta\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(meta)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/meta-cont/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\nm1 <- metacont(n.e, mean.e, sd.e, n.c, mean.c, sd.c, studlab = Study, data = data,\n sm = \"SMD\")\n\n# View data\nhead(data)\n\n# Create visualization\n# Meta-analysis of Continuous Data\np <- as.ggplot(function(){\n meta::forest(m1, layout = \"meta\")\n })\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/120-meta-cont.html\n", - "source_file": "Hiplot/120-meta-cont.qmd", - "skill_file": "skills/Hiplot/120-meta-cont_skill.md" - }, - { - "name": "Meta-Subgroup Analysis", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "jsonlite", - "metawho" - ], - "use_when": "The goal of metawho is to provide simple R implementation of “Meta-analytical method to Identify Who Benefits Most from Treatments”.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/121-metawho.html", - "skill": "# Skill: Meta-Subgroup Analysis (R)\n\n## Category\nHiplot\n\n## When to Use\nThe goal of metawho is to provide simple R implementation of “Meta-analytical method to Identify Who Benefits Most from Treatments”.\n\n## Required R Packages\n- cowplot\n- data.table\n- jsonlite\n- metawho\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(data.table)\nlibrary(jsonlite)\nlibrary(metawho)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/metawho/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata = deft_prepare(data, conf_level = 1 - 0.95)\nres = deft_do(data, group_level = unique(data$subgroup))\n\n# View data\nhead(data)\n\n# Create visualization\n# Meta-Subgroup Analysis\np1 <- deft_show(res, element = \"all\")\np2 <- deft_show(res, element = \"subgroup\")\np <- plot_grid(p1, p2, nrow = 2)\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/121-metawho.html\n", - "source_file": "Hiplot/121-metawho.qmd", - "skill_file": "skills/Hiplot/121-metawho_skill.md" - }, - { - "name": "Moon charts", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "gggibbous", - "ggplot2", - "jsonlite" - ], - "use_when": "The moon chart is a graph that uses the moon's waxing and waning to reflect the size of the data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/122-moon-charts.html", - "skill": "# Skill: Moon charts (R)\n\n## Category\nHiplot\n\n## When to Use\nThe moon chart is a graph that uses the moon's waxing and waning to reflect the size of the data.\n\n## Required R Packages\n- data.table\n- gggibbous\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(gggibbous)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/moon-charts/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[, 1] <- factor(data[, 1], levels = unique(data[, 1]))\nrest_cols <- colnames(data)[-1]\ntidyrest <- reshape(\n data,\n varying = rest_cols,\n v.names = \"Score\",\n timevar = \"Category\",\n times = factor(rest_cols, levels = rest_cols),\n idvar = colnames(data)[1],\n direction = \"long\"\n)\n\n# View data\nhead(data)\n\n# Create visualization\n# Moon charts\np <- ggplot(tidyrest, aes(0, 0)) +\n geom_moon(aes(ratio = (Score - 1) / 4), fill = \"black\") +\n geom_moon(aes(ratio = 1 - (Score - 1) / 4), right = FALSE) +\n facet_grid(Category ~ Restaurant, switch = \"y\") +\n theme_minimal() +\n theme(\n panel.grid = element_blank(),\n axis.text = element_blank(),\n axis.title = element_blank()\n )\n\np\n```\n\n## Key Parameters\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/122-moon-charts.html\n", - "source_file": "Hiplot/122-moon-charts.qmd", - "skill_file": "skills/Hiplot/122-moon-charts_skill.md" - }, - { - "name": "Mosaic Ratio Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "DescTools", - "data.table", - "ggplotify", - "jsonlite", - "vcd" - ], - "use_when": "Use mosaic blocks to show data proportions.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/123-mosaic.html", - "skill": "# Skill: Mosaic Ratio Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nUse mosaic blocks to show data proportions.\n\n## Required R Packages\n- DescTools\n- data.table\n- ggplotify\n- jsonlite\n- vcd\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(DescTools)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(vcd)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/mosaic/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ntbl <- xtabs(~ Survived + PassengerClass + Gender, data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Mosaic Ratio Plot\np <- as.ggplot(function() {\n mosaic(tbl, shade = TRUE, legend = TRUE, main = \"Mosaic Ratio Plot\",\n gp = shading_binary(tbl, col = c(\"#3B4992FF\",\"#EE0000FF\")))\n})\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/123-mosaic.html\n", - "source_file": "Hiplot/123-mosaic.qmd", - "skill_file": "skills/Hiplot/123-mosaic_skill.md" - }, - { - "name": "Multiple Histograms", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Multiple histograms are plotted on the same graph to compare differences between multiple sets of data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/125-multiple-histograms.html", - "skill": "# Skill: Multiple Histograms (R)\n\n## Category\nHiplot\n\n## When to Use\nMultiple histograms are plotted on the same graph to compare differences between multiple sets of data.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/multiple-histograms/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Multiple Histograms\np <- ggplot(data, aes(x = value, fill = type)) +\n geom_histogram(color = \"black\", alpha = 0.5, \n position = \"identity\", binwidth = 0.3) +\n scale_fill_manual(values = c(\"#BC3C29FF\",\"#0072B5FF\")) +\n theme_bw()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `value` to the x aesthetic\n- `fill`: Maps `type` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/125-multiple-histograms.html\n", - "source_file": "Hiplot/125-multiple-histograms.qmd", - "skill_file": "skills/Hiplot/125-multiple-histograms_skill.md" - }, - { - "name": "Network (igraph)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplotify", - "igraph", - "jsonlite", - "stringr" - ], - "use_when": "Network (igraph) can be used to visulize basic network based on igraph.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/127-network-igraph.html", - "skill": "# Skill: Network (igraph) (R)\n\n## Category\nHiplot\n\n## When to Use\nNetwork (igraph) can be used to visulize basic network based on igraph.\n\n## Required R Packages\n- RColorBrewer\n- data.table\n- ggplotify\n- igraph\n- jsonlite\n- stringr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(igraph)\nlibrary(jsonlite)\nlibrary(stringr)\n\n# Prepare data\n# Load data\nnodes_data <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/network-igraph/data.json\")$exampleData[[1]]$textarea[[1]])\nnodes_data <- as.data.frame(nodes_data)\nedges_data <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/network-igraph/data.json\")$exampleData[[1]]$textarea[[2]])\nedges_data <- as.data.frame(edges_data)\n\n# Convert data structure\nnodes_data[,\"type.label\"] <- factor(nodes_data[,\"type.label\"], \n levels = unique(nodes_data[,\"type.label\"]))\nnodes_data$hiplot_color_type <- as.numeric(nodes_data[,\"type.label\"])\nnet <- graph_from_data_frame(d = edges_data, vertices = nodes_data, directed = T)\n## Generate colors based on type\ncolrs <- c(\"#7f7f7f\",\"#ff6347\",\"#ffd700\")\ncolrs2 <- c(\"#BC3C29FF\",\"#0072B5FF\",\"#E18727FF\",\"#20854EFF\",\"#7876B1FF\",\n \"#6F99ADFF\",\"#FFDC91FF\",\"#EE4C97FF\")\nV(net)$color <- colrs[V(net)$hiplot_color_type]\n## Compute node degrees (#links) and use that to set node size\ndeg <- degree(net, mode=\"all\")\nV(net)$size <- deg*3\n## Set label\nV(net)$label.color <- \"black\"\nV(net)$label <- NA\n## Set edge width based on weight\nweight_column <- edges_data$weight\nE(net)$width <- weight_column/6\n## Change arrow size and edge color\nE(net)$arrow.size <- .2\nE(net)$edge.color <- \"gray80\"\nedge.start <- ends(net, es=E(net), names=F)[,1]\nedge.col <- V(net)$color[edge.start]\n\n# View data\nhead(nodes_data)\nhead(edges_data)\n\n# Create visualization\n# Network (igraph)\nraw <- par()\np <- as.ggplot(function () {\n par(mar=c(8,2,2,2))\n radian.rescale <- function(x, start=0, direction=1) {\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `width`: Controls element width\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/127-network-igraph.html\n", - "source_file": "Hiplot/127-network-igraph.qmd", - "skill_file": "skills/Hiplot/127-network-igraph_skill.md" - }, - { - "name": "Neural Network", - "category": "Hiplot", - "language": "R", - "packages": [ - "NeuralNetTools", - "data.table", - "jsonlite", - "nnet" - ], - "use_when": "Create a Neural Network using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/129-neural-network.html", - "skill": "# Skill: Neural Network (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Neural Network using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- NeuralNetTools\n- data.table\n- jsonlite\n- nnet\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(NeuralNetTools)\nlibrary(data.table)\nlibrary(jsonlite)\nlibrary(nnet)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/neural-network/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Neural Network\nmod <- nnet(Y1 ~ X1 + X2 + X3, data = neuraldat, size = 10,\n maxint = 100, decay = 0)\n\n# plot\npar(mar = numeric(4))\nplotnet(mod)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/129-neural-network.html\n", - "source_file": "Hiplot/129-neural-network.qmd", - "skill_file": "skills/Hiplot/129-neural-network_skill.md" - }, - { - "name": "Nomogram (Logistic)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "rms" - ], - "use_when": "Create a Nomogram (Logistic) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/130-nomogram-logistic.html", - "skill": "# Skill: Nomogram (Logistic) (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Nomogram (Logistic) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- rms\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(rms)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/nomogram-logistic/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndd <- datadist(data)\noptions(datadist = \"dd\")\n## Build Logistic model and run nomogram\nlogistic_res <- lrm(data=data, as.formula(paste(\n colnames(data)[1], \" ~ \",\n paste(colnames(data)[2:length(colnames(data))],\n collapse = \"+\"\n )\n ))\n)\nlogistic_nomo <- nomogram(logistic_res, maxscale = 100,\n fun= function(x)1/(1+exp(-x)), lp=F, funlabel=\"Dead Risk\",\n fun.at=c(.001,.01,.05,seq(.1,.9,by=.1),.95,.99,.999)\n)\n\n# View data\nhead(data)\n\n# Create visualization\n# Nomogram (Logistic)\np <- as.ggplot(function() {\n plot(logistic_nomo,\n scale = 1\n )\n title(main = \"Nomogram (Logistic)\")\n})\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/130-nomogram-logistic.html\n", - "source_file": "Hiplot/130-nomogram-logistic.qmd", - "skill_file": "skills/Hiplot/130-nomogram-logistic_skill.md" - }, - { - "name": "Nomogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "rms", - "survival" - ], - "use_when": "Nomogram is often used to evaluate the prognosis of oncology and medicine, and can visualize the results of logistic regression or Cox regression.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/131-nomogram.html", - "skill": "# Skill: Nomogram (R)\n\n## Category\nHiplot\n\n## When to Use\nNomogram is often used to evaluate the prognosis of oncology and medicine, and can visualize the results of logistic regression or Cox regression.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- rms\n- survival\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(rms)\nlibrary(survival)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/nomogram/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndd <- datadist(data)\noptions(datadist = \"dd\")\n## Build COX model and run nomogram\ncox_res <- psm(\n data = data,\n as.formula(paste(\n sprintf(\"Surv(%s, %s) ~ \", colnames(data)[1], colnames(data)[2]),\n paste(colnames(data)[3:length(colnames(data))],\n collapse = \"+\"\n )\n )),\n # Surv(time, status) ~ age + sex + ph.ecog + ph.karno + pat.karno,\n dist = \"lognormal\"\n)\n## Build survival probability function\nsurv <- Survival(cox_res)\n## Build quantile survival time function\nmed <- Quantile(cox_res)\n\ncox_nomo <- nomogram(\n cox_res,\n fun = list(function(x) surv(365, x), function(x) surv(1095, x),\n function(x) surv(1825, x), function(x) med(lp = x)),\n funlabel = c(\"1-year Survival Probability\",\n \"3-year Survival Probability\",\n \"5-year Survival Probability\",\n \"Median Survival Time\"),\n maxscale = 100\n)\n\n# View data\nhead(data)\n\n# Create visualization\n# Nomogram\np <- as.ggplot(function() {\n plot(cox_nomo, scale = 1)\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/131-nomogram.html\n", - "source_file": "Hiplot/131-nomogram.qmd", - "skill_file": "skills/Hiplot/131-nomogram_skill.md" - }, - { - "name": "Parallel Coordinate", - "category": "Hiplot", - "language": "R", - "packages": [ - "GGally", - "data.table", - "ggthemes", - "hrbrthemes", - "jsonlite", - "viridis" - ], - "use_when": "Create a Parallel Coordinate using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/132-parallel-coordinate.html", - "skill": "# Skill: Parallel Coordinate (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Parallel Coordinate using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- GGally\n- data.table\n- ggthemes\n- hrbrthemes\n- jsonlite\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(GGally)\nlibrary(data.table)\nlibrary(ggthemes)\nlibrary(hrbrthemes)\nlibrary(jsonlite)\nlibrary(viridis)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/parallel-coordinate/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[, 6] <- factor(data[, 6], levels = unique(data[, 6]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Parallel Coordinate\np <- ggparcoord(data, columns = 2:(ncol(data) - 1), groupColumn = ncol(data),\n title = \"Parallel Coordinate Plot for cancer Data\",\n alphaLines = 0.3, scale = \"globalminmax\",\n showPoints = T, boxplot = F) +\n theme_base() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12, hjust = 0.5),\n axis.title = element_text(size = 10),\n axis.text = element_text(size = 12),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10)) +\n scale_color_viridis(discrete = TRUE) +\n facet_grid(formula(paste(\"~\", (colnames(data)[ncol(data)]))))\n\np\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_base()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/132-parallel-coordinate.html\n", - "source_file": "Hiplot/132-parallel-coordinate.qmd", - "skill_file": "skills/Hiplot/132-parallel-coordinate_skill.md" - }, - { - "name": "Pareto Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Pareto Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/133-pareto-chart.html", - "skill": "# Skill: Pareto Chart (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Pareto Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pareto-chart/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata <- data[order(-data[[\"sales\"]]), ]\ndata[[\"channel\"]] <- factor(data[[\"channel\"]], levels = data[[\"channel\"]])\n## Calculate percentage number\ndata$accumulating <- cumsum(data[[\"sales\"]])\nmax_y <- max(data[[\"sales\"]])\ncal_num <- sum(data[[\"sales\"]]) / max_y\ndata$accumulating <- data$accumulating / cal_num\n\n# View data\nhead(data)\n\n# Create visualization\n# Pareto Chart\np <- ggplot(data, aes(x = channel, y = sales, fill = channel)) +\n geom_bar(stat = \"identity\") +\n geom_line(aes(y = accumulating), group = 1) +\n geom_point(aes(y = accumulating), show.legend = FALSE) +\n scale_y_continuous(sec.axis = sec_axis(trans = ~ . / max_y * 100, name = \"Percentage\")) +\n scale_fill_manual(values = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\",\n \"#F39B7FFF\",\"#8491B4FF\",\"#91D1C2FF\",\"#DC0000FF\")) +\n theme_bw()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `channel` to the x aesthetic\n- `y`: Maps `accumulating` to the y aesthetic\n- `fill`: Maps `channel` to the fill aesthetic\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/133-pareto-chart.html\n", - "source_file": "Hiplot/133-pareto-chart.qmd", - "skill_file": "skills/Hiplot/133-pareto-chart_skill.md" - }, - { - "name": "Parliament", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggpol", - "jsonlite" - ], - "use_when": "The parliamentary chart is a data processing method that looks like a parliamentary seat, with points representing a data set to show the share ratio of each group more flexibly.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/134-parliament.html", - "skill": "# Skill: Parliament (R)\n\n## Category\nHiplot\n\n## When to Use\nThe parliamentary chart is a data processing method that looks like a parliamentary seat, with points representing a data set to show the share ratio of each group more flexibly.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggpol\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggpol)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/parliament/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Parliament\np <- ggplot(data) +\n geom_parliament(alpha = 1, aes(seats = value, fill = group), color = \"black\") +\n coord_fixed() +\n scale_fill_discrete(name = \"group\", labels = unique(data$group)) +\n scale_fill_manual(values = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\",\n \"#F39B7FFF\")) +\n ggtitle(\"Parliament Plot\") +\n theme_void() +\n theme(legend.position = \"bottom\",\n plot.title = element_text(hjust = 0.5))\n\np\n```\n\n## Key Parameters\n- `fill`: Maps `group` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/134-parliament.html\n", - "source_file": "Hiplot/134-parliament.qmd", - "skill_file": "skills/Hiplot/134-parliament_skill.md" - }, - { - "name": "PCA2", - "category": "Hiplot", - "language": "R", - "packages": [ - "FactoMineR", - "data.table", - "factoextra", - "jsonlite" - ], - "use_when": "Principal component analysis (PCA) is a data processing method with \"dimension reduction\" as the core, replacing multi-index data with a few comprehensive indicators (PCA), and restoring the most essential characteristics of data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/135-pca2.html", - "skill": "# Skill: PCA2 (R)\n\n## Category\nHiplot\n\n## When to Use\nPrincipal component analysis (PCA) is a data processing method with \"dimension reduction\" as the core, replacing multi-index data with a few comprehensive indicators (PCA), and restoring the most essential characteristics of data.\n\n## Required R Packages\n- FactoMineR\n- data.table\n- factoextra\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(FactoMineR)\nlibrary(data.table)\nlibrary(factoextra)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pca2/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\nsample_info <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pca2/data.json\")$exampleData[[1]]$textarea[[2]])\nsample_info <- as.data.frame(sample_info)\n\n# Convert data structure\nrow.names(sample_info) <- sample_info[,1]\nsample_info <- sample_info[colnames(data)[-1],]\n## tsne\nrownames(data) <- data[, 1]\ndata <- as.matrix(data[, -1])\npca_data <- PCA(t(as.matrix(data)), scale.unit = TRUE, ncp = 5, graph = FALSE)\n\n# View data\nhead(data[,1:5])\n\n# Create visualization\n# PCA2\np <- fviz_pca_ind(pca_data, geom.ind = \"point\", pointsize = 6, addEllipses = TRUE,\n mean.point = F, col.ind = sample_info[,\"Group\"]) +\n ggtitle(\"Principal Component Analysis\") +\n scale_fill_manual(values = c(\"#00468BFF\",\"#ED0000FF\")) +\n scale_color_manual(values = c(\"#00468BFF\",\"#ED0000FF\")) +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/135-pca2.html\n", - "source_file": "Hiplot/135-pca2.qmd", - "skill_file": "skills/Hiplot/135-pca2_skill.md" - }, - { - "name": "PCAtools", - "category": "Hiplot", - "language": "R", - "packages": [ - "PCAtools", - "cowplot", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "PCAtools can reduce the dimensionality of data through principal component analysis, and view principal component related features at a two-dimensional level", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/136-pcatools.html", - "skill": "# Skill: PCAtools (R)\n\n## Category\nHiplot\n\n## When to Use\nPCAtools can reduce the dimensionality of data through principal component analysis, and view principal component related features at a two-dimensional level\n\n## Required R Packages\n- PCAtools\n- cowplot\n- data.table\n- ggplotify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(PCAtools)\nlibrary(cowplot)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pcatools/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\ndata2 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pcatools/data.json\")$exampleData$textarea[[2]])\ndata2 <- as.data.frame(data2)\n\n# View data\nhead(data[,1:5])\nhead(data2[,1:5])\n\n# Create visualization\n# PCAtools\n## Define the plot function\ncall_pcatools <- function(datTable, sampleInfo,\n top_var,\n screeplotComponents, screeplotColBar,\n pairsplotComponents,\n biplotShapeBy, biplotColBy,\n plotloadingsComponents,\n plotloadingsLowCol,\n plotloadingsMidCol,\n plotloadingsHighCol,\n eigencorplotMetavars,\n eigencorplotComponents) {\n row.names(datTable) <- datTable[, 1]\n datTable <- datTable[, -1]\n row.names(sampleInfo) <- sampleInfo[, 1]\n data3 <<- pca(datTable, metadata = sampleInfo, removeVar = (100 - top_var) / 100)\n\n for (i in c(\"screeplotComponents\", \"pairsplotComponents\",\n \"plotloadingsComponents\", \"eigencorplotComponents\")) {\n if (ncol(data3$rotated) < get(i)) {\n assign(i, ncol(data3$rotated))\n }\n }\n\n p1 <- PCAtools::screeplot(\n data3,\n components = getComponents(data3, 1:screeplotComponents),\n axisLabSize = 14, titleLabSize = 20,\n colBar = screeplotColBar,\n gridlines.major = FALSE, gridlines.minor = FALSE,\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `width`: Controls element width\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/136-pcatools.html\n", - "source_file": "Hiplot/136-pcatools.qmd", - "skill_file": "skills/Hiplot/136-pcatools_skill.md" - }, - { - "name": "Perspective", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "shape" - ], - "use_when": "The three-dimensional perspective is a three-dimensional figure that can connect the higher values contained in a matrix with surfaces.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/137-perspective.html", - "skill": "# Skill: Perspective (R)\n\n## Category\nHiplot\n\n## When to Use\nThe three-dimensional perspective is a three-dimensional figure that can connect the higher values contained in a matrix with surfaces.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- shape\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(shape)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/perspective/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata <- as.matrix(data)\ncol <- drapecol(data)\n\n# View data\nhead(data[,1:5])\n\n# Create visualization\n# Perspective\np <- as.ggplot(function() {\n persp(as.matrix(data),\n theta = 45, phi = 20,\n expand = 0.5,\n r = 180, col = col,\n ltheta = 120,\n shade = 0.5,\n ticktype = \"detailed\",\n xlab = \"X\", ylab = \"Y\", zlab = \"Z\",\n border = \"black\" # could be NA\n )\n title(\"Perspective Plot\", line = 0)\n})\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/137-perspective.html\n", - "source_file": "Hiplot/137-perspective.qmd", - "skill_file": "skills/Hiplot/137-perspective_skill.md" - }, - { - "name": "3D Pie", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "plotrix" - ], - "use_when": "The 3D pie chart is a pie chart that has a 3D appearance.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/138-pie-3d.html", - "skill": "# Skill: 3D Pie (R)\n\n## Category\nHiplot\n\n## When to Use\nThe 3D pie chart is a pie chart that has a 3D appearance.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- plotrix\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(plotrix)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pie-3d/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ncolnames(data) <- c(\"Group\", \"Value\")\ndata$Value <- as.numeric(data$Value)\ndata <- data[data$Value != 0,]\n\n# View data\nhead(data)\n\n# Create visualization\n# 3D Pie\npie3D(data$Value, radius = 0.8, height = 0.05, theta = 0.8,\n labels = paste(data$Group, \"\\n(n=\", data$Value, \", \",\n round(data$Value / sum(data$Value) * 100, 2), \"%)\",\n sep = \"\"),\n explode = 0.1, main = \"\", labelcex = 1, shade = 0.4, labelcol = \"black\",\n col = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\"))\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/138-pie-3d.html\n", - "source_file": "Hiplot/138-pie-3d.qmd", - "skill_file": "skills/Hiplot/138-pie-3d_skill.md" - }, - { - "name": "Pie Group", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggplotify", - "jsonlite", - "patchwork" - ], - "use_when": "Create a Pie Group using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/139-pie-group.html", - "skill": "# Skill: Pie Group (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Pie Group using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- cowplot\n- data.table\n- ggplotify\n- jsonlite\n- patchwork\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(patchwork)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pie-group/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[,\"genre\"] <- factor(data[,\"genre\"], levels = unique(data[,\"genre\"]))\ndata[,\"mpaa\"] <- factor(data[,\"mpaa\"], levels = unique(data[,\"mpaa\"]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Pie Group\ncol <- c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\",\"#F39B7FFF\",\"#8491B4FF\",\n \"#91D1C2FF\",\"#DC0000FF\",\"#7E6148FF\",\"#B09C85FF\")\nplist <- list()\nfor (i in 1:length(unique(data[,\"mpaa\"]))) {\n data_tmp <- data[data[,\"mpaa\"] == unique(data[,\"mpaa\"])[i],]\n x <- table(data_tmp[,\"genre\"])\n ptmp <- as.ggplot(function(){\n par(oma=c(0,0,0,0))\n pie(x,\n labels = sprintf(\"%s\\n(n=%s, %s%%)\", names(x), x,\n round(x / sum(x) * 100, 0)),\n col = col,\n main = paste0(\"mpaa\", \":\", unique(data[,\"mpaa\"])[i]),\n edges = 200,\n radius = 0.8,\n clockwise = F\n )\n })\n plist[[i]] <- ptmp\n}\n\nplot_grid(plotlist = plist, ncol = 2)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/139-pie-group.html\n", - "source_file": "Hiplot/139-pie-group.qmd", - "skill_file": "skills/Hiplot/139-pie-group_skill.md" - }, - { - "name": "Pie Matrix", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "jsonlite", - "stringr", - "tidyr" - ], - "use_when": "Create a Pie Matrix using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/140-pie-matrix.html", - "skill": "# Skill: Pie Matrix (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Pie Matrix using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- dplyr\n- ggplot2\n- jsonlite\n- stringr\n- tidyr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(stringr)\nlibrary(tidyr)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pie-matrix/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[,\"genre\"] <- factor(data[,\"genre\"], levels = unique(data[,\"genre\"]))\ndata[,\"mpaa\"] <- factor(data[,\"mpaa\"], levels = unique(data[,\"mpaa\"]))\ndata[,\"status\"] <- factor(data[,\"status\"], levels = unique(data[,\"status\"]))\ncol <- c(\"#E64B35FF\",\"#4DBBD5FF\")\ndf <- matrix(NA, nrow = length(unique(data[,\"mpaa\"])),\n ncol = length(unique(data[,\"genre\"])))\nrow.names(df) <- unique(data[,\"mpaa\"])\ncolnames(df) <- unique(data[,\"genre\"])\nfor (i in 1:nrow(df)) {\n for (j in 1:ncol(df)) {\n for (k in unique(data[,\"status\"])) {\n if (is.na(df[i, j])) {\n df[i, j] <- sum(data[,\"genre\"] == unique(data[,\"genre\"])[j] &\n data[,\"mpaa\"] == unique(data[,\"mpaa\"])[i] &\n data[,\"status\"] == k)\n } else {\n df[i, j] <- paste0(df[i, j], \",\", \n sum(data[,\"genre\"] == unique(data[,\"genre\"])[j] &\n data[,\"mpaa\"] == unique(data[,\"mpaa\"])[i] &\n data[,\"status\"] == k))\n }\n }\n }\n}\ndf <- as.matrix(df)\n\n# View data\nhead(data[,1:5])\n\n# Create visualization\n# Pie Matrix\np <- df %>% as.table() %>%\n as.data.frame() %>%\n mutate(Freq = str_split(Freq,\",\")) %>%\n unnest(Freq) %>%\n mutate(Freq = as.integer(Freq)) %>%\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `fill`: Maps `factor` to the fill aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/140-pie-matrix.html\n", - "source_file": "Hiplot/140-pie-matrix.qmd", - "skill_file": "skills/Hiplot/140-pie-matrix_skill.md" - }, - { - "name": "Pie", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "jsonlite" - ], - "use_when": "The pie chart is a statistical chart that shows the proportion of each part by dividing a circle into sections.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/141-pie.html", - "skill": "# Skill: Pie (R)\n\n## Category\nHiplot\n\n## When to Use\nThe pie chart is a statistical chart that shows the proportion of each part by dividing a circle into sections.\n\n## Required R Packages\n- data.table\n- dplyr\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pie/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n\n# Convert data structure\ncolnames(data) <- c(\"Group\", \"Value\")\ndata <- data %>%\n arrange(desc(Group)) %>%\n mutate(prop = Value / sum(data$Value) * 100) %>%\n mutate(ypos = Value / length(unique(Group)) +\n c(0, cumsum(Value)[-length(Value)]) + 5)\n\n# View data\nhead(data)\n\n# Create visualization\n# Pie\np <- ggplot(data, aes(x = \"\", y = Value, fill = Group)) +\n geom_col(width = 1) +\n geom_bar(stat = \"identity\", width = 1, color = \"white\") +\n geom_text(aes(y = ypos, \n label = sprintf(\"%s\\n(n=%s, %s%%)\", Group, Value,\n round(Value / sum(data$Value) * 100, 2))), \n color = \"white\", fontface = \"bold\") +\n coord_polar(theta = \"y\", start = 0, direction = -1) +\n guides(fill = guide_legend(title = \"Group\")) +\n scale_fill_discrete(\n breaks = data$Group,\n labels = paste(data$Group,\" (\", round(data$Value / sum(data$Value) * 100, 2),\n \"%)\", sep = \"\")) +\n scale_fill_manual(values = c(\"#00468BFF\",\"#ED0000FF\",\"#42B540FF\",\"#0099B4FF\")) +\n ggtitle(\"Pie Plot\") + \n theme_minimal() +\n theme(\n axis.title.x = element_blank(),\n axis.title.y = element_blank(),\n axis.text.x = element_blank(),\n axis.text.y = element_blank(),\n panel.border = element_blank(),\n panel.grid = element_blank(),\n axis.ticks = element_blank(),\n plot.title = element_text(size = 14, face = \"bold\",\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `y`: Maps `ypos` to the y aesthetic\n- `fill`: Maps `Group` to the fill aesthetic\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/141-pie.html\n", - "source_file": "Hiplot/141-pie.qmd", - "skill_file": "skills/Hiplot/141-pie_skill.md" - }, - { - "name": "Point (SD)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "grafify", - "jsonlite" - ], - "use_when": "Displaying the standard deviation (SD) of multi-group data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/142-point-sd.html", - "skill": "# Skill: Point (SD) (R)\n\n## Category\nHiplot\n\n## When to Use\nDisplaying the standard deviation (SD) of multi-group data.\n\n## Required R Packages\n- data.table\n- dplyr\n- grafify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(grafify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/point-sd/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ny <- \"Doubling_time\"\ngroup <- \"Student\"\ndata[, group] <- factor(data[, group], levels = unique(data[, group]))\ndata <- data %>% \n mutate(median = median(get(y), na.rm = TRUE),\n mean = mean(get(y), na.rm = TRUE))\n\n# View data\nhead(data)\n\n# Create visualization\n# Point (SD)\np <- plot_point_sd(data = data, Student, Doubling_time, symsize = 5,\n symthick = 0.5, s_alpha = 1, ewid = 0, symshape = 21,\n all_alpha = 0) +\n geom_hline(aes(yintercept = median), colour = 'black', linetype = 2, \n size = 0.5) +\n xlab(group) + ylab(y) + \n guides(fill = guide_legend(title = group)) +\n ggtitle(\"Point-SD\") +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n \n \np\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/142-point-sd.html\n", - "source_file": "Hiplot/142-point-sd.qmd", - "skill_file": "skills/Hiplot/142-point-sd_skill.md" - }, - { - "name": "EnhancedMA", - "category": "Hiplot", - "language": "R", - "packages": [ - "EnhancedVolcano", - "data.table", - "jsonlite" - ], - "use_when": "Visualization of differentially expressed genes.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/143-pseudo-enhanced-ma.html", - "skill": "# Skill: EnhancedMA (R)\n\n## Category\nHiplot\n\n## When to Use\nVisualization of differentially expressed genes.\n\n## Required R Packages\n- EnhancedVolcano\n- data.table\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(EnhancedVolcano)\nlibrary(data.table)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pseudo-enhanced-ma/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\nrow.names(data) <- data[,1]\ndata <- data[,-1]\ndata$baseMeanNew <- 1 / (10^log(data$baseMean + 1))\n\n# View data\nhead(data)\n\n# Create visualization\n# EnhancedMA\np <- EnhancedVolcano(\n data, lab = rownames(data), title = \"MA plot\", subtitle = \"EnhancedMA\",\n x = 'log2FoldChange', y = 'baseMeanNew', xlab = bquote(~Log[2]~ 'fold change'),\n ylab = bquote(~Log[e]~ 'base mean + 1'), ylim = c(0,12),\n pCutoff = as.numeric(1e-05), FCcutoff = 1, pointSize = 3.5,\n labSize = 4, boxedLabels = T, colAlpha = 1,\n legendLabels = c('NS', expression(Log[2]~FC),\n 'Mean expression', \n expression(Mean-expression~and~log[2]~FC)),\n legendPosition = \"bottom\", legendLabSize = 16, legendIconSize = 4.0,\n encircleCol = 'black', encircleSize = 2.5, encircleFill = 'pink',\n encircleAlpha = 1/2) + \n coord_flip() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `coord_flip()` for horizontal orientation when labels are long\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/143-pseudo-enhanced-ma.html\n", - "source_file": "Hiplot/143-pseudo-enhanced-ma.qmd", - "skill_file": "skills/Hiplot/143-pseudo-enhanced-ma_skill.md" - }, - { - "name": "Pyramid Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggcharts", - "jsonlite" - ], - "use_when": "The pyramid chart is a pyramid-like figure that distributes data on both sides of a central axis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/144-pyramid-chart.html", - "skill": "# Skill: Pyramid Chart (R)\n\n## Category\nHiplot\n\n## When to Use\nThe pyramid chart is a pyramid-like figure that distributes data on both sides of a central axis.\n\n## Required R Packages\n- data.table\n- ggcharts\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggcharts)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pyramid-chart/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Pyramid Chart\np <- pyramid_chart(data = data, x = age, y = pop, group = sex, \n title = \"\", sort = \"no\", bar_colors = c(\"#C20B01\",\"#196ABD\")) +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/144-pyramid-chart.html\n", - "source_file": "Hiplot/144-pyramid-chart.qmd", - "skill_file": "skills/Hiplot/144-pyramid-chart_skill.md" - }, - { - "name": "Pyramid Chart 2", - "category": "Hiplot", - "language": "R", - "packages": [ - "apyramid", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The pyramid chart is a pyramid-like figure that distributes data on both sides of a central axis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/145-pyramid-chart2.html", - "skill": "# Skill: Pyramid Chart 2 (R)\n\n## Category\nHiplot\n\n## When to Use\nThe pyramid chart is a pyramid-like figure that distributes data on both sides of a central axis.\n\n## Required R Packages\n- apyramid\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(apyramid)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pyramid-chart2/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\nx <- as.integer(data[,\"age\"])\ndata$age_group <- cut(x, breaks = pretty(x), right = TRUE, include.lowest = TRUE)\n\n# View data\nhead(data[,1:5])\n\n# Create visualization\n# Pyramid Chart 2\np <- age_pyramid(data, \"age_group\", split_by = \"Gender\") + \n scale_fill_manual(values = c(\"#BC3C29FF\",\"#0072B5FF\")) +\n xlab(\"Age group\") + \n ylab(\"Gender\") +\n theme_classic() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_classic()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/145-pyramid-chart2.html\n", - "source_file": "Hiplot/145-pyramid-chart2.qmd", - "skill_file": "skills/Hiplot/145-pyramid-chart2_skill.md" - }, - { - "name": "Pyramid Stack", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The pyramid stack is a pyramid-like figure that distributes data on both sides of a central axis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/146-pyramid-stack.html", - "skill": "# Skill: Pyramid Stack (R)\n\n## Category\nHiplot\n\n## When to Use\nThe pyramid stack is a pyramid-like figure that distributes data on both sides of a central axis.\n\n## Required R Packages\n- data.table\n- dplyr\n- ggplot2\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pyramid-stack/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[,3] <- factor(data[,3], levels = unique(data[,3]))\ndata[,1] <- factor(data[,1], levels = unique(data[,1]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Pyramid Stack\np <- ggplot(data = data, aes(x = age, y = pop, fill = year)) +\n geom_bar(data = data %>% filter(gender == \"female\") %>% arrange(rev(year)),\n stat = \"identity\", position = \"identity\") +\n geom_bar(data = data %>% filter(gender == \"male\") %>% arrange(rev(year)),\n stat = \"identity\", position = \"identity\", mapping = aes(y = -pop)) +\n coord_flip() +\n geom_hline(yintercept = 0) +\n scale_fill_economist() +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\")) +\n labs(y = \"pop | male (left) - female (right)\", x= \"\") +\n theme_economist(horizontal = FALSE) +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"top\",\n legend.direction = \"horizontal\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10),\n panel.grid.major = element_blank(),\n panel.grid.minor = element_blank())\n\np\n```\n\n## Key Parameters\n- `x`: Maps `age` to the x aesthetic\n- `y`: Maps `pop` to the y aesthetic\n- `fill`: Maps `year` to the fill aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Use `coord_flip()` for horizontal orientation when labels are long\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/146-pyramid-stack.html\n", - "source_file": "Hiplot/146-pyramid-stack.qmd", - "skill_file": "skills/Hiplot/146-pyramid-stack_skill.md" - }, - { - "name": "Pyramid Stack2", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "plotrix" - ], - "use_when": "The pyramid stack is a pyramid-like figure that distributes data on both sides of a central axis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/147-pyramid-stack2.html", - "skill": "# Skill: Pyramid Stack2 (R)\n\n## Category\nHiplot\n\n## When to Use\nThe pyramid stack is a pyramid-like figure that distributes data on both sides of a central axis.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- plotrix\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(plotrix)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pyramid-stack2/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\nagegrps <- unique(data[,1])\nsplit_var <- unique(data[,2])\ndat_left <- as.matrix(data[data[,2] == split_var[1],-c(1,2)])\ndat_right <- as.matrix(data[data[,2] == split_var[2],-c(1,2)])\n\n# View data\nhead(data)\n\n# Create visualization\n# Pyramid Stack2\np <- as.ggplot(function() {\n cols <- c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\")\n names(cols) <- colnames(dat_left)\n cols <- cols[1:ncol(dat_left)]\n pyramid.plot(dat_left, dat_right, labels = agegrps, unit = \"Value\",\n lxcol = cols, rxcol = cols,\n laxlab=as.numeric(c(0,10,20,30)), raxlab=as.numeric(c(0,10,20,30)),\n top.labels=c(split_var[1], colnames(data)[1], split_var[2]),\n gap=4, ppmar=c(4,2,4,7), do.first=\"plot_bg(\\\"#FFFFFF\\\")\")\n mtext(\"Porridge temperature by age and sex of bear\", 3, 2, cex=1)\n legend(\"right\", inset=c(-0.25,0), legend = colnames(dat_left), fill = cols)\n })\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/147-pyramid-stack2.html\n", - "source_file": "Hiplot/147-pyramid-stack2.qmd", - "skill_file": "skills/Hiplot/147-pyramid-stack2_skill.md" - }, - { - "name": "QQ Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "grafify", - "jsonlite" - ], - "use_when": "Verify whether a set of data comes from a certain distribution or whether two sets of data come from the same (family) distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/148-qqplot.html", - "skill": "# Skill: QQ Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nVerify whether a set of data comes from a certain distribution or whether two sets of data come from the same (family) distribution.\n\n## Required R Packages\n- data.table\n- grafify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(grafify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/qqplot/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[, \"Genotype\"] <- factor(data[, \"Genotype\"], levels = unique(data[, \"Genotype\"]))\n\n# View data\nhead(data)\n\n# Create visualization\n# QQ Plot\np <- plot_qqline(data = data, ycol = Cytokine, group = Genotype,\n symsize = 2, symthick = 0.5, s_alpha = 1) +\n ggtitle(\"QQplot without facet\") +\n xlab(\"theoretical\") + ylab(\"sample\") + \n guides(fill = guide_legend(title = \"Genotype\")) +\n scale_color_manual(values = c(\"#E69F00\",\"#4DB1DC\")) +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/148-qqplot.html\n", - "source_file": "Hiplot/148-qqplot.qmd", - "skill_file": "skills/Hiplot/148-qqplot_skill.md" - }, - { - "name": "R Script Flow", - "category": "Hiplot", - "language": "R", - "packages": [ - "flow" - ], - "use_when": "R script flow can realize the visual window of if, else and other logic functions.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/149-r-code-flow.html", - "skill": "# Skill: R Script Flow (R)\n\n## Category\nHiplot\n\n## When to Use\nR script flow can realize the visual window of if, else and other logic functions.\n\n## Required R Packages\n- flow\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(flow)\n\n# Prepare data\n# Load data\ncode <- function(){\n if (x < 10) {\n a <- 1\n } else {\n a <- 2\n }\n if (a == 2) {\n c <- d\n } else {\n d <- a\n }\n}\n\n# Create visualization\n# R Script Flow\np <- flow_view(code)\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/149-r-code-flow.html\n", - "source_file": "Hiplot/149-r-code-flow.qmd", - "skill_file": "skills/Hiplot/149-r-code-flow_skill.md" - }, - { - "name": "Radar", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "ggradar", - "jsonlite", - "scales", - "tibble" - ], - "use_when": "Radar chart displays multivariable data in the form of two-dimensional charts representing three or more quantitative variables on the axis starting from the same point, so as to visually express the comparison of a research object in multiple parameters.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/150-radar.html", - "skill": "# Skill: Radar (R)\n\n## Category\nHiplot\n\n## When to Use\nRadar chart displays multivariable data in the form of two-dimensional charts representing three or more quantitative variables on the axis starting from the same point, so as to visually express the comparison of a research object in multiple parameters.\n\n## Required R Packages\n- data.table\n- dplyr\n- ggplot2\n- ggradar\n- jsonlite\n- scales\n- tibble\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(ggradar)\nlibrary(jsonlite)\nlibrary(scales)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/radar/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata <- as.data.frame(t(data))\ncolnames(data) <- data[1, ]\ndata <- data[-1, ]\nfor (i in seq_len(ncol(data))) {\n data[, i] <- as.numeric(data[, i])\n}\ndata_radar <- data %>%\n rownames_to_column(var = \"sample\")\ndata_radar <- data_radar %>% mutate_at(vars(-sample), rescale)\n\n# View data\nhead(data)\n\n# Create visualization\n# Radar\np <- ggradar(data_radar, gridline.max.linetype = 1, group.point.size = 4,\n group.line.width = 1, font.radar = \"Arial\", fill.alpha = 0.5,\n gridline.min.colour = \"grey\", gridline.mid.colour = \"#007A87\",\n gridline.max.colour = \"grey\") +\n ggtitle(\"Radar Plot\") +\n scale_color_manual(values = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\")) +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_blank(),\n axis.text = element_text(size = 10),\n axis.text.x = element_blank(),\n axis.title.y=element_blank(),\n axis.ticks.y=element_blank(),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n \np\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/150-radar.html\n", - "source_file": "Hiplot/150-radar.qmd", - "skill_file": "skills/Hiplot/150-radar_skill.md" - }, - { - "name": "RCS-COX", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "rms", - "stringr", - "survival" - ], - "use_when": "Nonlinear regression analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/151-rcs-cox.html", - "skill": "# Skill: RCS-COX (R)\n\n## Category\nHiplot\n\n## When to Use\nNonlinear regression analysis.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n- rms\n- stringr\n- survival\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(rms)\nlibrary(stringr)\nlibrary(survival)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/rcs-cox/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata <- na.omit(data)\nex <- set::not(colnames(data), c(\"main\", \"time\", \"event\"))\nex <- str_c(ex, collapse = \"+\")\ndd <<- datadist(data)\noptions(datadist = \"dd\")\nfor (i in 3:5) {\n fit <- coxph(as.formula(paste0(\"Surv(time, event) ~ rcs(main, nk = i, inclx = T)+\", ex, collapse = \"+\")), data = data, x = TRUE)\n tmp <- extractAIC(fit)\n if (i == 3) {\n AIC <- tmp[2]\n nk <<- 3\n }\n if (tmp[2] < AIC) {\n AIC <- tmp[2]\n nk <<- i\n }\n}\nfit <- cph(as.formula(paste0(\"Surv(time, event) ~ rcs(main, nk = nk, inclx = T)+\", ex, collapse = \"+\")), data = data, x = TRUE)\ndd$limits$main[2] <- median(data$main)\nfit <- update(fit)\norr <- Predict(fit, main, fun = exp, ref.zero = TRUE)\n\n# View data\nhead(data)\n\n# Create visualization\n# RCS-COX\np <- ggplot() +\n geom_line(data = orr, aes(main, yhat), linetype = \"solid\", size = 1, alpha = 1,\n colour = \"#FF0000\") +\n geom_ribbon(data = orr, aes(main, ymin = lower, ymax = upper), alpha = 0.6, \n fill = \"#FFC0CB\") +\n geom_hline(yintercept = 1, linetype = 2, size = 0.5) +\n geom_vline(xintercept = dd$limits$main[2], linetype = 2, size = 0.5) +\n labs(x = \" \", y = \"Hazard Ratio(95%CI)\") +\n theme_bw() +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/151-rcs-cox.html\n", - "source_file": "Hiplot/151-rcs-cox.qmd", - "skill_file": "skills/Hiplot/151-rcs-cox_skill.md" - }, - { - "name": "RCS-LRM", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "rms", - "stringr", - "survival" - ], - "use_when": "Nonlinear regression analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/152-rcs-lrm.html", - "skill": "# Skill: RCS-LRM (R)\n\n## Category\nHiplot\n\n## When to Use\nNonlinear regression analysis.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n- rms\n- stringr\n- survival\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(rms)\nlibrary(stringr)\nlibrary(survival)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/rcs-lrm/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata <- na.omit(data)\nex <- set::not(colnames(data), c(\"main\", \"group\"))\nex <- str_c(ex, collapse = \"+\")\ndd <<- datadist(data)\noptions(datadist = \"dd\")\nfor (i in 3:5) {\n fit <- lrm(as.formula(paste0(\"group~rcs(main,nk=i,inclx = T)+\", ex, collapse = \"+\")), data = data, x = TRUE)\n tmp <- AIC(fit)\n if (i == 3) {\n AIC <- tmp\n nk <<- 3\n }\n if (tmp < AIC) {\n AIC <- tmp\n nk <<- i\n }\n}\nfit <- lrm(as.formula(paste0(\"group~rcs(main,nk=nk,inclx = T)+\", ex, collapse = \"+\")), data = data, x = TRUE)\ndd$limits$main[2] <- median(data$main)\nfit <- update(fit)\norr <- Predict(fit, main, fun = exp, ref.zero = TRUE)\n\n# View data\nhead(data)\n\n# Create visualization\n# RCS-LRM\np <- ggplot() +\n geom_line(data = orr, aes(main, yhat), linetype = \"solid\", size = 1, alpha = 1,\n colour = \"#FF0000\") +\n geom_ribbon(data = orr, aes(main, ymin = lower, ymax = upper), alpha = 0.6, \n fill = \"#FFC0CB\") +\n geom_hline(yintercept = 1, linetype = 2, size = 0.5) +\n geom_vline(xintercept = dd$limits$main[2], linetype = 2, size = 0.5) +\n labs(x = \"main\", y = \"Odds Ratio(95%CI)\") +\n theme_bw() +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/152-rcs-lrm.html\n", - "source_file": "Hiplot/152-rcs-lrm.qmd", - "skill_file": "skills/Hiplot/152-rcs-lrm_skill.md" - }, - { - "name": "Ribbon", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The ribbon diagram is a pattern similar to a ribbon.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/153-ribbon.html", - "skill": "# Skill: Ribbon (R)\n\n## Category\nHiplot\n\n## When to Use\nThe ribbon diagram is a pattern similar to a ribbon.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ribbon/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ncolnames(data) <- c(\"group\", \"xvalue\", \"yvalue1\", \"yvalue2\")\ndata$yvalue <- (data$yvalue1 + data$yvalue2) / 2\n\n# View data\nhead(data)\n\n# Create visualization\n# Ribbon\np <- ggplot(data, aes(xvalue, yvalue, fill = group)) +\n geom_ribbon(alpha = 0.2, aes(ymin = yvalue1, ymax = yvalue2)) +\n geom_line(aes(y = yvalue, color = group), lwd = 1) +\n geom_line(aes(y = yvalue1, color = group), linetype = \"dotted\") +\n geom_line(aes(y = yvalue2, color = group), linetype = \"dotted\") +\n ylab(\"y axis value\") +\n xlab(\"x axis value\") +\n ggtitle(\"Ribbon Plot\") +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\")) +\n scale_color_manual(values = c(\"#e04d39\",\"#5bbad6\")) +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n \np\n```\n\n## Key Parameters\n- `fill`: Maps `group` to the fill aesthetic\n- `y`: Maps `yvalue2` to the y aesthetic\n- `color`: Maps `group` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/153-ribbon.html\n", - "source_file": "Hiplot/153-ribbon.qmd", - "skill_file": "skills/Hiplot/153-ribbon_skill.md" - }, - { - "name": "Ridge", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggridges", - "ggthemes", - "jsonlite" - ], - "use_when": "The ridge map is a graph that connects points and forms a ridge.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/154-ridge.html", - "skill": "# Skill: Ridge (R)\n\n## Category\nHiplot\n\n## When to Use\nThe ridge map is a graph that connects points and forms a ridge.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggridges\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggridges)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/ridge/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata$group <- factor(data$group, levels = unique(data$group)[length(unique(data$group)):1])\n\n# View data\nhead(data)\n\n# Create visualization\n# Ridge\np <- ggplot(data, aes(x = value, y = group, fill = group, col = group)) +\n geom_density_ridges(scale = 5, alpha = 0.8) +\n labs(x = \"value\", y = \"group\") +\n theme(plot.title = element_text(hjust = 0.5),\n legend.position = \"none\") +\n ggtitle(\"Ridge Plot\") +\n guides(color = guide_legend(reverse = TRUE),\n fill = guide_legend(reverse = TRUE)) +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\")) +\n scale_color_manual(values = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\")) +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `value` to the x aesthetic\n- `y`: Maps `group` to the y aesthetic\n- `fill`: Maps `group` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/154-ridge.html\n", - "source_file": "Hiplot/154-ridge.qmd", - "skill_file": "skills/Hiplot/154-ridge_skill.md" - }, - { - "name": "Risk Factor Analysis", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "cutoff", - "data.table", - "fastStat", - "ggplot2", - "jsonlite", - "survminer" - ], - "use_when": "Create a Risk Factor Analysis using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/155-risk-plot.html", - "skill": "# Skill: Risk Factor Analysis (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Risk Factor Analysis using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- cowplot\n- cutoff\n- data.table\n- fastStat\n- ggplot2\n- jsonlite\n- survminer\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(cutoff)\nlibrary(data.table)\nlibrary(fastStat)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/risk-plot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata <- data[order(data[, \"riskscore\"], decreasing = F), ]\ncutoff_point <- median(x = data$riskscore, na.rm = TRUE)\ndata$Group <- ifelse(data$riskscore > cutoff_point, \"High\", \"Low\")\ncut.position <- (1:nrow(data))[data$riskscore == cutoff_point]\nif (length(cut.position) == 0) {\n cut.position <- which.min(abs(data$riskscore - cutoff_point))\n} else if (length(cut.position) > 1) {\n cut.position <- cut.position[length(cut.position)]\n}\n## Generate the data.frame required to draw A B graph\ndata2 <- data[, c(\"time\", \"event\", \"riskscore\", \"Group\")]\n\n# View data\nhead(data)\n\n# Create visualization\n# Risk Factor Analysis\n## Figure A\nfA <- ggplot(data = data2, aes(x = 1:nrow(data2), y = data2$riskscore, \n color = Group)) +\n geom_point(size = 2) +\n scale_color_manual(name = \"Risk Group\", \n values = c(\"Low\" = \"#0B45A5\", \"High\" = \"#E20B0B\")) +\n geom_vline(xintercept = cut.position, linetype = \"dotted\", size = 1) +\n theme(panel.grid = element_blank(), panel.background = element_blank(),\n axis.ticks.x = element_blank(), axis.line.x = element_blank(),\n axis.text.x = element_blank(), axis.title.x = element_blank(),\n axis.title.y = element_text(size = 14, vjust = 1, angle = 90),\n axis.text.y = element_text(size = 11),\n axis.line.y = element_line(size = 0.5, colour = \"black\"),\n axis.ticks.y = element_line(size = 0.5, colour = \"black\"),\n legend.title = element_text(size = 13), \n legend.text = element_text(size = 12)) +\n coord_trans() +\n ylab(\"Risk Score\") +\n scale_x_continuous(expand = c(0, 3))\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `id` to the x aesthetic\n- `fill`: Maps `value` to the fill aesthetic\n- `y`: Maps `variable` to the y aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/155-risk-plot.html\n", - "source_file": "Hiplot/155-risk-plot.qmd", - "skill_file": "skills/Hiplot/155-risk-plot_skill.md" - }, - { - "name": "ROC", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "pROC" - ], - "use_when": "Receiver operating characteristic curve (ROC curve) is used to describe the diagnostic ability of binary classifier system when its recognition threshold changes.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/156-roc.html", - "skill": "# Skill: ROC (R)\n\n## Category\nHiplot\n\n## When to Use\nReceiver operating characteristic curve (ROC curve) is used to describe the diagnostic ability of binary classifier system when its recognition threshold changes.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- pROC\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(pROC)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/roc/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\nname_val <- colnames(data)[2:ncol(data)]\nnum_value <- ncol(data) - 1\n\n# View data\nhead(data)\n\n# Create visualization\n# ROC\ncol <- c(\"#00468BFF\",\"#ED0000FF\",\"#42B540FF\")\np <- as.ggplot(function() {\n for (i in 1:num_value) {\n if (i == 1) {\n roc_data <- roc(data[, 1], data[, i + 1],\n percent = T, plot = T, grid = T, lty = i, quiet = T,\n print.auc = F, col = col[i], smooth = F,\n main = \"ROC Plot\"\n )\n text(30, 50, \"AUC\", font = 2, col = \"darkgray\")\n text(30, 50 - 10 * i,\n paste(name_val[i], \":\", sprintf(\"%0.4f\", as.numeric(roc_data$auc))),\n col = col[i]\n )\n } else {\n roc_data <- roc(data[, 1], data[, i + 1],\n percent = T, plot = T, grid = T, add = T, lty = i, quiet = T,\n print.auc = F, col = col[i]\n )\n text(30, 50 - 10 * i,\n paste(name_val[i], \":\", sprintf(\"%0.4f\", as.numeric(roc_data$auc))),\n col = col[i]\n )\n }\n }\n })\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/156-roc.html\n", - "source_file": "Hiplot/156-roc.qmd", - "skill_file": "skills/Hiplot/156-roc_skill.md" - }, - { - "name": "Rose Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The rose chart is a column chart drawn in polar coordinates. The radius of the arc is used to indicate the size of the data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/157-rose-chart.html", - "skill": "# Skill: Rose Chart (R)\n\n## Category\nHiplot\n\n## When to Use\nThe rose chart is a column chart drawn in polar coordinates. The radius of the arc is used to indicate the size of the data.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/rose-chart/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ndata[, 2] <- factor(data[, 2], levels = unique(data[, 2]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Rose Chart\np <- ggplot(data, aes(x = Sample, y = Freq)) +\n geom_col(aes(fill = Group), width = 0.9, size = 0, alpha = 0.8) +\n coord_polar() +\n ggtitle(\"Rose Chart\") +\n scale_fill_manual(values = c(\"#E64B35FF\", \"#4DBBD5FF\")) +\n theme_bw() +\n theme(aspect.ratio = 1,\n axis.text.x = element_text(colour = \"black\"),\n axis.text.y = element_text(colour = \"black\"),\n legend.title = element_blank(),\n legend.position = \"bottom\",\n plot.title = element_text(hjust = 0.5))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `Sample` to the x aesthetic\n- `y`: Maps `Freq` to the y aesthetic\n- `fill`: Maps `Group` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/157-rose-chart.html\n", - "source_file": "Hiplot/157-rose-chart.qmd", - "skill_file": "skills/Hiplot/157-rose-chart_skill.md" - }, - { - "name": "Sankey", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggalluvial", - "ggplot2", - "jsonlite" - ], - "use_when": "Sankey diagrams are a type of flow diagramin which the width of the arrows is proportional to the flow rate.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/158-sankey.html", - "skill": "# Skill: Sankey (R)\n\n## Category\nHiplot\n\n## When to Use\nSankey diagrams are a type of flow diagramin which the width of the arrows is proportional to the flow rate.\n\n## Required R Packages\n- data.table\n- ggalluvial\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggalluvial)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/sankey/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\nvalue <- \"Freq\"\naxis <- c(\"Class\", \"Sex\")\nusr_axis <- c()\nfor (i in seq_len(length(axis))) {\n usr_axis <- c(usr_axis, axis[i])\n assign(paste0(\"axis\", i), axis[i])\n}\nindex_axis <- match(usr_axis, colnames(data))\nindex_value <- match(value, colnames(data))\ndata1 <- data[, c(index_value, index_axis)]\n## define band color\nnlevels <- as.numeric(apply(data1[, -1], 2, function(data) {\n return(length(unique(data)))\n}))\nband_color <- c(\"#8DD3C7\", \"#FFFFB3\", \"#BEBADA\", \"#FB8072\", \"#8DD3C7\", \"#FFFFB3\")\n## rename data\ndata_rename <- data1\ncolnames(data_rename) <- c(\n \"value\",\n paste(\"axis\", seq_len(length(usr_axis)), sep = \"\")\n)\n\n# View data\nhead(data)\n\n# Create visualization\n# Sankey\np <- ggplot(data_rename, aes(y = value, axis1 = axis1, axis2 = axis2)) +\n geom_alluvium(alpha = 1, aes(fill = data1[, colnames(data1) == \"Sex\"]),\n width = 0, reverse = FALSE) +\n scale_x_discrete(limits = usr_axis, expand = c(0.02, 0.1)) +\n ylab(\"\") +\n scale_fill_discrete(name = \"Sex\") +\n coord_flip() +\n geom_stratum(alpha = 1, width = 1 / 8, reverse = FALSE, fill = band_color,\n color = \"white\") +\n geom_text(stat = \"stratum\", infer.label = TRUE, reverse = FALSE) +\n ggtitle(\"Sankey plot\") +\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `y`: Maps `value` to the y aesthetic\n- `fill`: Maps `data1` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Use `coord_flip()` for horizontal orientation when labels are long\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/158-sankey.html\n", - "source_file": "Hiplot/158-sankey.qmd", - "skill_file": "skills/Hiplot/158-sankey_skill.md" - }, - { - "name": "3D-Scatter", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "plot3D" - ], - "use_when": "3D scatter plot is to apply a number of quantitative variables to different coaxes in space and combine different variables into coordinates in space, so as to clearly explain the interaction between the three quantitative variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/159-scatter-3d.html", - "skill": "# Skill: 3D-Scatter (R)\n\n## Category\nHiplot\n\n## When to Use\n3D scatter plot is to apply a number of quantitative variables to different coaxes in space and combine different variables into coordinates in space, so as to clearly explain the interaction between the three quantitative variables.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- plot3D\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(plot3D)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/scatter-3d/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# Convert data structure\ncol_idx <- which(colnames(data) == \"group\")\ndata[, col_idx] <- as.factor(data[, col_idx])\nshapes <- 19\nshape_idx <- \"\"\n\n# View data\nhead(data)\n\n# Create visualization\n# 3D-Scatter\np <- as.ggplot(function() {\n plot3d <- scatter3D(data[, 1], data[, 2], data[, 3],\n pch = shapes, cex = 1,\n phi = 0, theta = 45, ticktype = \"detailed\",\n bty = \"b2\", colkey = FALSE, alpha = 1,\n xlab = colnames(data)[1], ylab = colnames(data)[2],\n zlab = colnames(data)[3],\n main = \"3D-Scatter Plot\",\n colvar = as.numeric(as.factor(data[, 4])),\n col = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\")\n )\n \n legend(\"right\", pch=19, legend = levels(data[, col_idx]),\n cex = 1.1, bty = 'n', xjust = 0.5, horiz = F,\n title = colnames(data)[col_idx],\n col = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\"))\n})\n\np\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/159-scatter-3d.html\n", - "source_file": "Hiplot/159-scatter-3d.qmd", - "skill_file": "skills/Hiplot/159-scatter-3d_skill.md" - }, - { - "name": "Gradient Scatter", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "grafify", - "jsonlite" - ], - "use_when": "Two-dimensional spatial scatter to demonstrate multi-numerical variable relationships.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/160-scatter-gradient.html", - "skill": "# Skill: Gradient Scatter (R)\n\n## Category\nHiplot\n\n## When to Use\nTwo-dimensional spatial scatter to demonstrate multi-numerical variable relationships.\n\n## Required R Packages\n- data.table\n- ggplot2\n- grafify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(grafify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/scatter-gradient/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Gradient Scatter\np <- ggplot(data, aes(x = mpg, y = disp)) + \n geom_point(aes(fill = gear), size = 5, alpha = 1, shape = 21, stroke = 0.5) +\n labs(fill = \"gear\", color = \"gear\") +\n theme_classic(base_size = 10) +\n theme(strip.background = element_blank()) +\n guides(x = guide_axis(angle = 0)) +\n scale_fill_gradient(low = \"#00438E\", high = \"#E43535\") +\n scale_color_gradient(low = \"#00438E\", high = \"#E43535\") + \n guides(fill = guide_legend(title = \"gear\"),\n size = guide_legend(title = \"gear\")) +\n ggtitle(\"Scatter-gradient Plot\") +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `mpg` to the x aesthetic\n- `y`: Maps `disp` to the y aesthetic\n- `fill`: Maps `gear` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/160-scatter-gradient.html\n", - "source_file": "Hiplot/160-scatter-gradient.qmd", - "skill_file": "skills/Hiplot/160-scatter-gradient_skill.md" - }, - { - "name": "Scatter", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Two groups of data are used to form multiple coordinate points. By observing the distribution of coordinate points, it can judge whether there is correlation between variables or summarize the data processing mode of coordinate point distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/161-scatter.html", - "skill": "# Skill: Scatter (R)\n\n## Category\nHiplot\n\n## When to Use\nTwo groups of data are used to form multiple coordinate points. By observing the distribution of coordinate points, it can judge whether there is correlation between variables or summarize the data processing mode of coordinate point distribution.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/scatter/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Scatter\np <- ggplot(data, aes(x = Value1, y = Value2)) +\n geom_point(size = 1, alpha = 1, aes(color = Group, shape = Group)) +\n ggtitle(\"Scatter Plot\") +\n scale_color_manual(values = c(\"#00468BFF\", \"#ED0000FF\")) +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `Value1` to the x aesthetic\n- `y`: Maps `Value2` to the y aesthetic\n- `color`: Maps `Group` to the color aesthetic\n- `shape`: Maps `Group` to the shape aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/161-scatter.html\n", - "source_file": "Hiplot/161-scatter.qmd", - "skill_file": "skills/Hiplot/161-scatter_skill.md" - }, - { - "name": "Scatter2", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "grafify", - "jsonlite" - ], - "use_when": "Two-dimensional spatial scatter to demonstrate multi-numerical variable relationships.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/162-scatter2.html", - "skill": "# Skill: Scatter2 (R)\n\n## Category\nHiplot\n\n## When to Use\nTwo-dimensional spatial scatter to demonstrate multi-numerical variable relationships.\n\n## Required R Packages\n- data.table\n- ggplot2\n- grafify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(grafify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/scatter2/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data[,1:5])\n\n# Create visualization\n# scatter2\nsymsize <- data[,\"gear\"]\ndata[,\"gear\"] <- factor(data[,\"gear\"], levels = unique(data[,\"gear\"]))\np <- ggplot(data, aes(x = mpg, y = disp)) + \n geom_point(alpha = 1, aes(size = gear, fill = gear), shape = 21, stroke = 0.5) +\n labs(fill = \"gear\", color = \"gear\") +\n guides(x = guide_axis(angle = 0),\n fill = guide_legend(title = \"gear\"),\n color = FALSE,\n size = guide_legend(title = \"gear\")) +\n ggtitle(\"Scatter2 Plot\") +\n scale_fill_grafify() +\n theme_classic(base_size = 20) +\n theme(text = element_text(family = \"Arial\"),\n strip.background = element_blank(),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `mpg` to the x aesthetic\n- `y`: Maps `disp` to the y aesthetic\n- `size`: Maps `gear` to the size aesthetic\n- `fill`: Maps `gear` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/162-scatter2.html\n", - "source_file": "Hiplot/162-scatter2.qmd", - "skill_file": "skills/Hiplot/162-scatter2_skill.md" - }, - { - "name": "Scatterpie", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "scatterpie" - ], - "use_when": "Scatter Pie can be used to visualize data fraction in different space coordinates.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/163-scatterpie.html", - "skill": "# Skill: Scatterpie (R)\n\n## Category\nHiplot\n\n## When to Use\nScatter Pie can be used to visualize data fraction in different space coordinates.\n\n## Required R Packages\n- data.table\n- jsonlite\n- scatterpie\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(jsonlite)\nlibrary(scatterpie)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/scatterpie/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Scatterpie\np <- ggplot() +\n geom_scatterpie(data = data, aes(x = x, y = y), cols = colnames(data)[-c(1, 2)]) +\n scale_fill_manual(values = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\")) +\n labs(x=\"x\", y=\"y\") +\n theme_minimal() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `x` to the x aesthetic\n- `y`: Maps `y` to the y aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/163-scatterpie.html\n", - "source_file": "Hiplot/163-scatterpie.qmd", - "skill_file": "skills/Hiplot/163-scatterpie_skill.md" - }, - { - "name": "Simple Funnel Diagram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "echarts4r", - "jsonlite", - "magrittr" - ], - "use_when": "Create a Simple Funnel Diagram using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/164-simple-funnel-diagram.html", - "skill": "# Skill: Simple Funnel Diagram (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Simple Funnel Diagram using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- echarts4r\n- jsonlite\n- magrittr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(echarts4r)\nlibrary(jsonlite)\nlibrary(magrittr)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/simple-funnel-diagram/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Simple Funnel Diagram\np <- data %>%\n e_charts() %>%\n e_funnel(value, key) %>%\n e_title(\"Funnel\") %>%\n e_theme(\"macarons\")\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/164-simple-funnel-diagram.html\n", - "source_file": "Hiplot/164-simple-funnel-diagram.qmd", - "skill_file": "skills/Hiplot/164-simple-funnel-diagram_skill.md" - }, - { - "name": "Slopegraph", - "category": "Hiplot", - "language": "R", - "packages": [ - "CGPfunctions", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Sopegraph can be used to display the change of values.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/165-slopegraph.html", - "skill": "# Skill: Slopegraph (R)\n\n## Category\nHiplot\n\n## When to Use\nSopegraph can be used to display the change of values.\n\n## Required R Packages\n- CGPfunctions\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(CGPfunctions)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/slopegraph/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata[, \"country\"] <- factor(data[ ,\"country\"], levels = unique(data[ ,\"country\"]))\ndata[, \"year\"] <- factor(data[ ,\"year\"], levels = unique(data[ ,\"year\"]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Slopegraph\np <- newggslopegraph(data, year, lifeExp, country) +\n labs(subtitle = \"\", title = \"Slope Graph\", x = \"Life Expectancy (years)\",\n y = \"country\", caption = \"\") +\n scale_color_manual(values = c(\"#3B4992FF\", \"#EE0000FF\", \"#008B45FF\",\n \"#631879FF\", \"#008280FF\", \"#BB0021FF\")) +\n theme_minimal() +\n theme(plot.title = element_text(hjust = 0.5))\n\np\n```\n\n## Key Parameters\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/165-slopegraph.html\n", - "source_file": "Hiplot/165-slopegraph.qmd", - "skill_file": "skills/Hiplot/165-slopegraph_skill.md" - }, - { - "name": "Stack Violin", - "category": "Hiplot", - "language": "R", - "packages": [ - "Seurat", - "ggplot2", - "limma", - "readr" - ], - "use_when": "The expression of key genes in each cluster in single-cell transcriptomic (Single Cell RNA-Seq)analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/166-stack-violin.html", - "skill": "# Skill: Stack Violin (R)\n\n## Category\nHiplot\n\n## When to Use\nThe expression of key genes in each cluster in single-cell transcriptomic (Single Cell RNA-Seq)analysis.\n\n## Required R Packages\n- Seurat\n- ggplot2\n- limma\n- readr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(Seurat)\nlibrary(ggplot2)\nlibrary(limma)\nlibrary(readr)\n\n# Prepare data\n# Load data\ndata <- readr::read_delim(\"https://download.hiplot.cn/api/file/fetch/?path=/c622f9b0-54da-11f0-ba5f-8dc116702904/public/demo/stack-violin.txt\")\n\n# convert data structure\ndata <- as.matrix(data)\nrownames(data) <- data[, 1]\nexp <- data[, 2:ncol(data)]\ndimnames <- list(\n rownames(exp),\n colnames(exp)\n)\ndata <- matrix(as.numeric(as.matrix(exp)),\n nrow = nrow(exp),\n dimnames = dimnames\n)\ndata <- avereps(data,\n ID = rownames(data)\n)\n## Convert the matrix to a Seurat object and filter the data\npbmc <- CreateSeuratObject(\n counts = data,\n project = \"seurat\",\n min.cells = 0,\n min.features = 0,\n names.delim = \"_\",\n)\n## Calculate the percentage of mitochondrial genes using the PercentageFeatureSet function\npbmc[[\"percent.mt\"]] <- PercentageFeatureSet(\n object = pbmc,\n pattern = \"^MT-\"\n)\n## Filter the data\npbmc <- subset(\n x = pbmc,\n subset = nFeature_RNA > 50 & percent.mt < 5\n)\n## Normalize the data\npbmc <- NormalizeData(\n object = pbmc,\n normalization.method = \"LogNormalize\",\n scale.factor = 10000, verbose = F\n)\n## Extract genes with large coefficient of variation between cells\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/166-stack-violin.html\n", - "source_file": "Hiplot/166-stack-violin.qmd", - "skill_file": "skills/Hiplot/166-stack-violin_skill.md" - }, - { - "name": "Percentsge Stacked Bar Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "jsonlite", - "scales", - "tidyr" - ], - "use_when": "Create a Percentsge Stacked Bar Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/167-stacked-percentage-bar-chart.html", - "skill": "# Skill: Percentsge Stacked Bar Chart (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Percentsge Stacked Bar Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- dplyr\n- ggplot2\n- jsonlite\n- scales\n- tidyr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(scales)\nlibrary(tidyr)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/stacked-percentage-bar-chart/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata$total <- rowSums(data[, -1])\ndata_long <- gather(data, kinds, value, -days, -total)\ndata_long <- data_long %>%\n group_by(days) %>%\n mutate(percent = value / total * 100)\ndata_long[[\"days\"]] <- factor(data_long[[\"days\"]], levels = data[[\"days\"]])\n\n# View data\nhead(data)\n\n# Create visualization\n# Percentsge Stacked Bar Chart\np <- ggplot(data_long, aes(x = percent, y = days, fill = kinds)) +\n geom_bar(stat = \"identity\", position = \"stack\") +\n geom_text(aes(label = ifelse(percent != 0, paste0(round(percent), \"%\"), \"\")),\n position = position_stack(vjust = 0.5)) +\n labs(title = \"Percentage Stacked Bar Chart\", x = \"Percentage\", y = \"Days\") +\n scale_x_continuous(labels = percent_format(scale = 1)) +\n theme_bw() +\n theme(plot.title = element_text(hjust = 0.5)) +\n scale_fill_manual(values = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\"))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `percent` to the x aesthetic\n- `y`: Maps `days` to the y aesthetic\n- `fill`: Maps `kinds` to the fill aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/167-stacked-percentage-bar-chart.html\n", - "source_file": "Hiplot/167-stacked-percentage-bar-chart.qmd", - "skill_file": "skills/Hiplot/167-stacked-percentage-bar-chart_skill.md" - }, - { - "name": "Streamgraph", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "streamgraph" - ], - "use_when": "Create a Streamgraph using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/168-streamgraph.html", - "skill": "# Skill: Streamgraph (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Streamgraph using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- jsonlite\n- streamgraph\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(jsonlite)\nlibrary(streamgraph)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/streamgraph/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ncolnames(data) <- c(\"date\",\"key\",\"value\")\n\n# View data\nhead(data)\n\n# Create visualization\n# Streamgraph\np <- streamgraph(data, key = \"key\", value = \"value\", date = \"date\",\n offset = \"silhouette\", interpolate = \"cardinal\",\n interactive = F, scale = \"date\") %>% \n sg_fill_brewer(palette = \"Spectral\")\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/168-streamgraph.html\n", - "source_file": "Hiplot/168-streamgraph.qmd", - "skill_file": "skills/Hiplot/168-streamgraph_skill.md" - }, - { - "name": "Survival Analysis", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "survival", - "survminer" - ], - "use_when": "The survivorship curve is a graph showing the number or proportion of individuals surviving to each age for a given species or group (e.g. males or females).", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/169-survival.html", - "skill": "# Skill: Survival Analysis (R)\n\n## Category\nHiplot\n\n## When to Use\nThe survivorship curve is a graph showing the number or proportion of individuals surviving to each age for a given species or group (e.g. males or females).\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- survival\n- survminer\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(survival)\nlibrary(survminer)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/survival/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ncolnames(data) <- c(\"Time\", \"Status\", \"Group\")\ndata[,1] <- as.numeric(data[,1])\nfit <- survfit(Surv(Time, Status == 1) ~ Group, data = data)\ndata <- data[data[,1] < 1100,]\n\n# View data\nhead(data)\n\n# Create visualization\n# Survival Analysis\np <- ggsurvplot(\n fit, data = data, risk.table = T, pval = T, conf.int = T, fun = \"pct\", \n size = 0.5, xlab = \"Time\", ylab = \"Survival probability\",\n ggtheme = theme_bw(), risk.table.y.text.col = TRUE,\n risk.table.height = 0.25, risk.table.y.text = T,\n ncensor.plot = T, ncensor.plot.height = 0.25,\n conf.int.style = \"ribbon\", surv.median.line = \"hv\",\n palette = c(\"#00468BFF\", \"#ED0000FF\"),\n xlim = c(0, 1100), ylim = c(0, 100),\n break.x.by = 150)\n\np\n```\n\n## Key Parameters\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/169-survival.html\n", - "source_file": "Hiplot/169-survival.qmd", - "skill_file": "skills/Hiplot/169-survival_skill.md" - }, - { - "name": "Taylor Diagram", - "category": "Hiplot", - "language": "R", - "packages": [ - "openair" - ], - "use_when": "It can be used to display the standard deviation (SD), root mean square (RMS) error and correlation coefficient of the models simultaneously.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/170-taylor-diagram.html", - "skill": "# Skill: Taylor Diagram (R)\n\n## Category\nHiplot\n\n## When to Use\nIt can be used to display the standard deviation (SD), root mean square (RMS) error and correlation coefficient of the models simultaneously.\n\n## Required R Packages\n- openair\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(openair)\n\n# Prepare data\n# Load data\ndat <- selectByDate(mydata, year = 2003)\n\n# convert data structure\ndat <- data.frame(date = mydata$date, obs = mydata$nox, mod = mydata$nox)\ndat <- transform(dat, month = as.numeric(format(date, \"%m\")))\nmod1 <- transform(dat, mod = mod + 10 * month + 10 * month * rnorm(nrow(dat)),\nmodel = \"model 1\")\nmod1 <- transform(mod1, mod = c(mod[5:length(mod)], mod[(length(mod) - 3) :\nlength(mod)]))\nmod2 <- transform(dat, mod = mod + 7 * month + 7 * month * rnorm(nrow(dat)),\nmodel = \"model 2\")\nmod3 <- transform(dat, mod = mod + 3 * month + 3 * month * rnorm(nrow(dat)),\nmodel = \"model 3\")\nmod.dat <- rbind(mod1, mod2, mod3)\n\n# View data\nhead(mod.dat)\n\n# Create visualization\n# Taylor Diagram\nTaylorDiagram(mod.dat, obs = \"obs\", mod = \"mod\", group = \"model\",\n main = \"Taylor diagram\", \n cols = c(\"#00468BFF\",\"#8e6097\",\"#BFACF0FF\"))\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/170-taylor-diagram.html\n", - "source_file": "Hiplot/170-taylor-diagram.qmd", - "skill_file": "skills/Hiplot/170-taylor-diagram_skill.md" - }, - { - "name": "Time ROC", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "grid", - "jsonlite", - "plotROC", - "survivalROC" - ], - "use_when": "Receiver Operating Characteristic (ROC) analysis with time records in survival analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/171-time-roc.html", - "skill": "# Skill: Time ROC (R)\n\n## Category\nHiplot\n\n## When to Use\nReceiver Operating Characteristic (ROC) analysis with time records in survival analysis.\n\n## Required R Packages\n- data.table\n- ggplot2\n- grid\n- jsonlite\n- plotROC\n- survivalROC\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(grid)\nlibrary(jsonlite)\nlibrary(plotROC)\nlibrary(survivalROC)\n\n# Prepare data\n# Load data\ndata1 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/time-roc/data.json\")$exampleData$textarea[[1]])\ndata1 <- as.data.frame(data1)\ndata2 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/time-roc/data.json\")$exampleData$textarea[[2]])\ndata2 <- as.data.frame(data2)\n\n# convert data structure\nsurv_table <- data1\ncolnames(surv_table) <- c(\"surv\", \"cens\", \"risk\")\nmtime <- as.data.frame(data2)[, 1]\nsroc <- lapply(mtime, function(t) {\n stroc <- survivalROC(\n Stime = surv_table$surv,\n status = surv_table$cens,\n marker = surv_table$risk,\n predict.time = t,\n method = \"KM\"\n )\n data.frame(\n TPF = stroc[[\"TP\"]],\n FPF = stroc[[\"FP\"]],\n cut = stroc[[\"cut.values\"]],\n time = rep(\n stroc[[\"predict.time\"]],\n length(stroc[[\"TP\"]])\n ),\n AUC = rep(\n stroc$AUC,\n length(stroc$FP)\n )\n )\n})\nmroc <- do.call(rbind, sroc)\nmroc$time <- factor(mroc$time)\n\n# View data\nhead(data1)\nhead(data2)\n\n# Create visualization\n# Time ROC\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `FPF` to the x aesthetic\n- `y`: Maps `TPF` to the y aesthetic\n- `color`: Maps `time` to the color aesthetic\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/171-time-roc.html\n", - "source_file": "Hiplot/171-time-roc.qmd", - "skill_file": "skills/Hiplot/171-time-roc_skill.md" - }, - { - "name": "Treeheatr", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "treeheatr" - ], - "use_when": "The heatmap decision tree is a visualization graph that combines two types of graphs: heatmap and decision tree visualization.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/172-treeheatr.html", - "skill": "# Skill: Treeheatr (R)\n\n## Category\nHiplot\n\n## When to Use\nThe heatmap decision tree is a visualization graph that combines two types of graphs: heatmap and decision tree visualization.\n\n## Required R Packages\n- data.table\n- ggplotify\n- jsonlite\n- treeheatr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplotify)\nlibrary(jsonlite)\nlibrary(treeheatr)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/treeheatr/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\nx <- data\nwrong_cols <- suppressWarnings(sapply(x, function(x) {\n if (!is.numeric(x)) {\n sum(!is.na(as.numeric(x))) > 0.7 * length(x)\n } else {\n FALSE\n }\n}))\nif (any(wrong_cols)) {\n ix <- which(wrong_cols)\n for (i in ix) {\n data[[i]] <- suppressWarnings(as.numeric(data[[i]]))\n }\n rm(ix)\n}\nrm(x, wrong_cols)\n\n# View data\nhead(data)\n\n# Create visualization\n# Treeheatr\np <- as.ggplot(function() {\n print(heat_tree(data,\n target_lab = \"species\",\n task = 'classification',\n show = \"heat-tree\",\n heat_rel_height = 0.2,\n panel_space = 0.001,\n clust_samps = T,\n clust_target = T,\n lev_fac = 1.3,\n cont_legend = F,\n cate_legend = F\n ))\n})\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/172-treeheatr.html\n", - "source_file": "Hiplot/172-treeheatr.qmd", - "skill_file": "skills/Hiplot/172-treeheatr_skill.md" - }, - { - "name": "Treemap", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "treemap" - ], - "use_when": "Tree map is a kind of tree structure diagram that graphical form to represent hierarchy structure.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/173-treemap.html", - "skill": "# Skill: Treemap (R)\n\n## Category\nHiplot\n\n## When to Use\nTree map is a kind of tree structure diagram that graphical form to represent hierarchy structure.\n\n## Required R Packages\n- data.table\n- jsonlite\n- treemap\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(jsonlite)\nlibrary(treemap)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/treemap/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Treemap\ntreemap(data, index = colnames(data)[1], vSize = colnames(data)[2],\n vColor = colnames(data)[1], type = \"index\", title = \"\", \n algorithm = \"pivotSize\", sortID = colnames(data)[1], border.lwds = 1,\n fontcolor.labels = \"#000000\", inflate.labels = F, overlap.labels = 0.5,\n fontfamily.title = \"Arial\", fontfamily.legend = \"Arial\",\n fontfamily.labels = \"Arial\", \n palette = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\",\"#F39B7FFF\"), \n aspRatio = 6 / 6)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/173-treemap.html\n", - "source_file": "Hiplot/173-treemap.qmd", - "skill_file": "skills/Hiplot/173-treemap_skill.md" - }, - { - "name": "Tricolor Histogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The tricolored histogram divides the histogram into three regions: low-value zone, middle-value zone, and high-value zone, using three different colors.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/174-tricolor-histogram.html", - "skill": "# Skill: Tricolor Histogram (R)\n\n## Category\nHiplot\n\n## When to Use\nThe tricolored histogram divides the histogram into three regions: low-value zone, middle-value zone, and high-value zone, using three different colors.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/tricolor-histogram/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata$draw_color <- ifelse(data$value < 5, \"#F44336\",\n ifelse(data$value > 7, \"#006064\", \"#3F51B5\")\n)\n\n# View data\nhead(data)\n\n# Create visualization\n# Tricolor Histogram\np <- ggplot(data, aes(x = values, fill = draw_color)) +\n geom_histogram(alpha = 0.5, binwidth = 0.05, position = \"identity\") +\n scale_fill_manual(values = c(\"#3F51B5\", \"#006064\", \"#F44336\")) +\n theme_bw()\n\np\n```\n\n## Key Parameters\n- `x`: Maps `values` to the x aesthetic\n- `fill`: Maps `draw_color` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/174-tricolor-histogram.html\n", - "source_file": "Hiplot/174-tricolor-histogram.qmd", - "skill_file": "skills/Hiplot/174-tricolor-histogram_skill.md" - }, - { - "name": "tSNE", - "category": "Hiplot", - "language": "R", - "packages": [ - "Rtsne", - "data.table", - "ggpubr", - "jsonlite" - ], - "use_when": "T-sne is a nonlinear dimensionality reduction algorithm suitable for high-dimensional data reduction to two or three dimensions and visualization. The algorithm can make the t distribution of points with greater similarity closer in the lower dimensional space. For low similarity points, the t distribution is farther away in the low dimensional space.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/175-tsne.html", - "skill": "# Skill: tSNE (R)\n\n## Category\nHiplot\n\n## When to Use\nT-sne is a nonlinear dimensionality reduction algorithm suitable for high-dimensional data reduction to two or three dimensions and visualization. The algorithm can make the t distribution of points with greater similarity closer in the lower dimensional space. For low similarity points, the t distribution is farther away in the low dimensional space.\n\n## Required R Packages\n- Rtsne\n- data.table\n- ggpubr\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(Rtsne)\nlibrary(data.table)\nlibrary(ggpubr)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata1 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/tsne/data.json\")$exampleData[[1]]$textarea[[1]])\ndata1 <- as.data.frame(data1)\ndata2 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/tsne/data.json\")$exampleData[[1]]$textarea[[2]])\ndata2 <- as.data.frame(data2)\n\n# convert data structure\nsample.info <- data2\nrownames(data1) <- data1[, 1]\ndata1 <- as.matrix(data1[, -1])\n## tsne\nset.seed(123)\ntsne_info <- Rtsne(t(data1), perplexity = 1, theta = 0.1, check_duplicates = FALSE)\ncolnames(tsne_info$Y) <- c(\"tSNE_1\", \"tSNE_2\")\n# handle data\ntsne_data <- data.frame(\n sample = colnames(data1),\n tsne_info$Y\n)\ncolorBy <- sample.info[match(colnames(data1), sample.info[, 1]), \"group\"]\ncolorBy <- factor(colorBy, level = colorBy[!duplicated(colorBy)])\ntsne_data$colorBy = colorBy\nshapeBy <- NULL\n\n# View data\nhead(data1)\nhead(data2)\n\n# Create visualization\n# tsne\np <- ggscatter(data = tsne_data, x = \"tSNE_1\", y = \"tSNE_2\", size = 2, \n palette = \"lancet\", color = \"colorBy\") +\n labs(color = \"group\") +\n ggtitle(\"tSNE Plot1\") +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/175-tsne.html\n", - "source_file": "Hiplot/175-tsne.qmd", - "skill_file": "skills/Hiplot/175-tsne_skill.md" - }, - { - "name": "UMAP", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "jsonlite", - "umap" - ], - "use_when": "UMAP is a nonlinear dimensionality reduction algorithm suitable for high-dimensional data reduction to two or three dimensions and visualization. The algorithm can make the t distribution of points with greater similarity closer in the lower dimensional space. For low similarity points, the t distribution is farther away in the low dimensional space.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/176-umap.html", - "skill": "# Skill: UMAP (R)\n\n## Category\nHiplot\n\n## When to Use\nUMAP is a nonlinear dimensionality reduction algorithm suitable for high-dimensional data reduction to two or three dimensions and visualization. The algorithm can make the t distribution of points with greater similarity closer in the lower dimensional space. For low similarity points, the t distribution is farther away in the low dimensional space.\n\n## Required R Packages\n- data.table\n- ggpubr\n- jsonlite\n- umap\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggpubr)\nlibrary(jsonlite)\nlibrary(umap)\n\n# Prepare data\n# Load data\ndata1 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/umap/data.json\")$exampleData$textarea[[1]])\ndata1 <- as.data.frame(data1)\ndata2 <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/umap/data.json\")$exampleData$textarea[[2]])\ndata2 <- as.data.frame(data2)\n\n# convert data structure\nsample.info <- data2\nrownames(data1) <- data1[, 1]\ndata1 <- as.matrix(data1[, -1])\n## umap\nset.seed(123)\numap_info <- umap(t(data1))\ncolnames(umap_info$layout) <- c(\"UMAP_1\", \"UMAP_2\")\n# handle data\numap_data <- data.frame(\n sample = colnames(data1),\n umap_info$layout\n)\ncolorBy <- sample.info[match(colnames(data1), sample.info[, 1]), \"Species\"]\ncolorBy <- factor(colorBy, level = colorBy[!duplicated(colorBy)])\numap_data$colorBy = colorBy\nshapeBy <- NULL\n\n# View data\nhead(data1[,1:5])\nhead(data2)\n\n# Create visualization\n# umap\np <- ggscatter(data = umap_data, x = \"UMAP_1\", y = \"UMAP_2\", size = 2, \n palette = \"lancet\", color = \"colorBy\") +\n labs(color = \"group\") +\n ggtitle(\"UMAP Plot\") +\n theme_classic() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_classic()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/176-umap.html\n", - "source_file": "Hiplot/176-umap.qmd", - "skill_file": "skills/Hiplot/176-umap_skill.md" - }, - { - "name": "Upset Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "ComplexHeatmap", - "VennDiagram", - "data.table", - "ggplot2", - "ggplotify", - "jsonlite" - ], - "use_when": "Upset can be used to show the interactive relationship between collections.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/177-upset-plot.html", - "skill": "# Skill: Upset Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nUpset can be used to show the interactive relationship between collections.\n\n## Required R Packages\n- ComplexHeatmap\n- VennDiagram\n- data.table\n- ggplot2\n- ggplotify\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ComplexHeatmap)\nlibrary(VennDiagram)\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggplotify)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/upset-plot/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\nfor (i in seq_len(ncol(data))) {\n data[is.na(data[, i]), i] <- \"\"\n}\ndata2 <- as.list(data)\ndata2 <- lapply(data2, function(x) {x[x != \"\"]})\ndata2 <- list_to_matrix(data2)\nm = make_comb_mat(data2, mode = \"distinct\")\nss = set_size(m)\ncs = comb_size(m)\nset_order <- order(ss)\ncomb_order <- order(comb_degree(m), -cs)\n\n# View data\nhead(data)\n\n# Create visualization\n# Upset Plot\np <- as.ggplot(function(){\n top_annotation <- HeatmapAnnotation(\n Intersections = anno_barplot(\n cs, ylim = c(0, max(cs)*1.1), \n border = FALSE, \n gp = gpar(fill = \"#000000\", fontsize = 10), \n height = unit(5, \"cm\")\n ), \n annotation_name_side = \"left\", \n annotation_name_rot = 90\n )\n \n left_annotation <- rowAnnotation(\n Numbers = anno_barplot(-ss, axis_param = list(\n at = seq(-max(ss), 0, round(max(ss)/5)),\n labels = rev(seq(0, max(ss), round(max(ss)/5))),\n labels_rot = 0),\n baseline = 0,\n border = FALSE, \n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `width`: Controls element width\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/177-upset-plot.html\n", - "source_file": "Hiplot/177-upset-plot.qmd", - "skill_file": "skills/Hiplot/177-upset-plot_skill.md" - }, - { - "name": "Venn", - "category": "Hiplot", - "language": "R", - "packages": [ - "VennDiagram", - "data.table", - "jsonlite" - ], - "use_when": "A Venn diagram is a diagramthat shows all possible logical relations between a finite collection of different sets. These diagrams depict elements as points in the plane, and sets as regions inside closed curves. A Venn diagram consists of multiple overlapping closed curves, usually circles, each representing a set. The points inside a curve labelled S represent elements of the set S, while points outside the boundary represent elements not in the set S. This lends to easily read visualizatio...", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/178-venn.html", - "skill": "# Skill: Venn (R)\n\n## Category\nHiplot\n\n## When to Use\nA Venn diagram is a diagramthat shows all possible logical relations between a finite collection of different sets. These diagrams depict elements as points in the plane, and sets as regions inside closed curves. A Venn diagram consists of multiple overlapping closed curves, usually circles, each representing a set. The points inside a curve labelled S represent elements of the set S, while points outside the boundary represent elements not in the set S. This lends to easily read visualizatio...\n\n## Required R Packages\n- VennDiagram\n- data.table\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(VennDiagram)\nlibrary(data.table)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/venn/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\nfor (i in seq_len(ncol(data))) {\n data[is.na(data[, i]), i] <- \"\"\n}\nraw <- data\ndata <- as.data.frame(raw[raw[, 1] != \"\", 1])\ncolnames(data) <- colnames(raw)[1]\nlist.num <- 1\nfor (i in 2:ncol(raw)) {\n if (any(!is.na(raw[, i]) & raw[, i] != \"\")) {\n tmp <- raw[i]\n tmp <- tmp[tmp[, 1] != \"\", ]\n tmp <- as.data.frame(tmp)\n colnames(tmp) <- colnames(raw)[i]\n assign(paste0(\"data\", i), tmp)\n list.num <- list.num + 1\n }\n}\ncolnames(data) <- paste(\"V\", seq_len(ncol(data)), sep = \"\")\ncolnames(data2) <- paste(\"V\", seq_len(ncol(data2)), sep = \"\")\ncolnames(data3) <- paste(\"V\", seq_len(ncol(data3)), sep = \"\")\ncolnames(data4) <- paste(\"V\", seq_len(ncol(data4)), sep = \"\")\ncolnames(data5) <- paste(\"V\", seq_len(ncol(data5)), sep = \"\")\ndata_list <- list(\n n1 = data$V1, n2 = data2$V1, n3 = data3$V1,\n n4 = data4$V1, n5 = data5$V1\n)\nnames(data_list) <- colnames(raw)[1:5]\n\n# View data\nhead(data)\n\n# Create visualization\n# Venn\ncol <- c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\",\"#F39B7FFF\")\np <- venn.diagram(\n data_list, scaled = F, euler.d = F, filename = NULL, col = \"black\",\n fill = col,\n cex = c(\n 1.5, 1.5, 1.5, 1.5, 1.5, 1, 0.8, 1, 0.8, 1, 0.8, 1, 0.8,\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/178-venn.html\n", - "source_file": "Hiplot/178-venn.qmd", - "skill_file": "skills/Hiplot/178-venn_skill.md" - }, - { - "name": "Venn2", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "venn" - ], - "use_when": "A Venn diagram is a diagramthat shows all possible logical relations between a finite collection of different sets. These diagrams depict elements as points in the plane, and sets as regions inside closed curves. A Venn diagram consists of multiple overlapping closed curves, usually circles, each representing a set. The points inside a curve labelled S represent elements of the set S, while points outside the boundary represent elements not in the set S. This lends to easily read visualizatio...", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/179-venn2.html", - "skill": "# Skill: Venn2 (R)\n\n## Category\nHiplot\n\n## When to Use\nA Venn diagram is a diagramthat shows all possible logical relations between a finite collection of different sets. These diagrams depict elements as points in the plane, and sets as regions inside closed curves. A Venn diagram consists of multiple overlapping closed curves, usually circles, each representing a set. The points inside a curve labelled S represent elements of the set S, while points outside the boundary represent elements not in the set S. This lends to easily read visualizatio...\n\n## Required R Packages\n- data.table\n- jsonlite\n- venn\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(jsonlite)\nlibrary(venn)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/venn2/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata_venn <- as.list(data)\ndata_venn <- lapply(data_venn, function(x) {\n x[is.na(x)] <- \"\"\n x <- x[x != \"\"]\n return(x)\n})\n\n# View data\nhead(data)\n\n# Create visualization\n# Venn2\ncol <- c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\",\"#F39B7FFF\")\nvenn(x=data_venn, opacity=0.8, ggplot=F, ilabels = TRUE, zcolor=col, box=F)\ntitle(main = \"Vene Plot (5 sets)\", line = -1)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/179-venn2.html\n", - "source_file": "Hiplot/179-venn2.qmd", - "skill_file": "skills/Hiplot/179-venn2_skill.md" - }, - { - "name": "Violin Group", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "ggthemes", - "jsonlite" - ], - "use_when": "Violin and box plot of grouped data with T-test.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/180-violin-group.html", - "skill": "# Skill: Violin Group (R)\n\n## Category\nHiplot\n\n## When to Use\nViolin and box plot of grouped data with T-test.\n\n## Required R Packages\n- data.table\n- ggpubr\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggpubr)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/violin-group/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata[, 3] <- factor(data[, 3], levels = unique(data[, 3]))\n\n# View data\nhead(data)\n\n# Create visualization\n# Violin Group\np <- ggviolin(data, x = \"Group1\", y = \"Value\", color = \"Group2\", add = \"dotplot\",\n add.params = list(fill = \"white\",size = 1), title = \"Violin Diagram\",\n xlab = \"Group1\", ylab = \"Value\", fill = \"Group2\",\n palette = c(\"#374E55FF\", \"#DF8F44FF\"), alpha = 0.5, trim = F) +\n stat_compare_means(aes(group = data[, colnames(data)[3]]),\n method = \"t.test\", vjust = -6, label.x.npc = \"left\", label.y.npc = \"top\",\n tip.length = 0.03, bracket.size = 0.3, step.increase = 0, position = \"identity\",\n na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, geom = \"text\") +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `group`: Maps `data` to the group aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/180-violin-group.html\n", - "source_file": "Hiplot/180-violin-group.qmd", - "skill_file": "skills/Hiplot/180-violin-group_skill.md" - }, - { - "name": "Violin", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "ggthemes", - "jsonlite" - ], - "use_when": "The violin plot, named for its resemblance to a violin, is a statistical diagram combining a box diagram with a kernel density diagram to show the distribution of data and the probability density.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/181-violin.html", - "skill": "# Skill: Violin (R)\n\n## Category\nHiplot\n\n## When to Use\nThe violin plot, named for its resemblance to a violin, is a statistical diagram combining a box diagram with a kernel density diagram to show the distribution of data and the probability density.\n\n## Required R Packages\n- data.table\n- ggpubr\n- ggthemes\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggpubr)\nlibrary(ggthemes)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/violin/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ngroups <- unique(data[, 2])\nngroups <- length(groups)\ncomb <- combn(1:ngroups, 2)\nmy_comparisons <- list()\nfor (i in seq_len(ncol(comb))) {\n my_comparisons[[i]] <- groups[comb[, i]]\n}\n\n# View data\nhead(data)\n\n# Create visualization\n# Violin\np <- ggviolin(data, x = \"Tumor\", y = \"Expresssion\", fill = \"Tumor\", add = \"boxplot\",\n xlab = \"Tumor\", ylab = \"Expresssion\", \n add.params = list(fill = \"white\"),\n palette = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\"),\n title = \"Violin Plot\", alpha = 1) + \n stat_compare_means(comparisons = my_comparisons, label = \"p.signif\") +\n theme_stata() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_stata()`\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/181-violin.html\n", - "source_file": "Hiplot/181-violin.qmd", - "skill_file": "skills/Hiplot/181-violin_skill.md" - }, - { - "name": "Visdat", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "jsonlite", - "patchwork", - "visdat" - ], - "use_when": "Create a Visdat using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/182-visdat.html", - "skill": "# Skill: Visdat (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Visdat using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- dplyr\n- ggplot2\n- jsonlite\n- patchwork\n- visdat\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(patchwork)\nlibrary(visdat)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/visdat/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Visdat\nadd_palette <- function (p) {\n ## add color palette\n p <- p + scale_fill_manual(values = c(\"#3B4992FF\", \"#EE0000FF\"))\n}\npobj <- list()\npobj[[\"p1\"]] <- add_palette(vis_dat(data)) + ggtitle(':vis_dat')\npobj[[\"p2\"]] <- add_palette(vis_guess(data)) + ggtitle(':vis_guess')\npobj[[\"p3\"]] <- vis_miss(data, cluster = T, sort_miss = T) + ggtitle(':vis_miss')\npobj[[\"p4\"]] <- add_palette(vis_expect(data, ~.x >= 20 )) + ggtitle(':vis_expect')\npobj[[\"p5\"]] <- vis_cor(data) + \n scale_fill_gradientn(colours = c(\"#0571B0\", \"#92C5DE\", \"#F4A582\", \"#CA0020\")) +\n ggtitle(':vis_cor')\npobj[[\"p6\"]] <- data %>%\n select_if(is.numeric) %>%\n vis_value() + ggtitle(':vis_value')\npobj[[\"p6\"]] <- pobj[[\"p6\"]] + \n scale_fill_gradientn(colours = c(\"#0571B0\",\"#92C5DE\",\"#F7F7F7\",\"#F4A582\",\n \"#CA0020\"))\n\npstr <- paste0(sprintf(\"pobj[[%s]]\", 1:length(pobj)), collapse = \" + \")\np <- eval(parse(text = \n sprintf(\"%s + plot_layout(ncol = 2) +\nplot_annotation(tag_levels = 'A')\", pstr)))\n\np\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/182-visdat.html\n", - "source_file": "Hiplot/182-visdat.qmd", - "skill_file": "skills/Hiplot/182-visdat_skill.md" - }, - { - "name": "Volcano", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "jsonlite" - ], - "use_when": "The volcanogram is a visual representation of the difference in gene expression between two samples.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/183-volcano.html", - "skill": "# Skill: Volcano (R)\n\n## Category\nHiplot\n\n## When to Use\nThe volcanogram is a visual representation of the difference in gene expression between two samples.\n\n## Required R Packages\n- data.table\n- ggpubr\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggpubr)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/volcano/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\n## Perform log10 transformation on the difference p (adj.P.Val column)\ndata[, \"logP\"] <- -log10(as.numeric(data[, \"P.Value\"]))\ndata[, \"logFC\"] <- as.numeric(data[, \"logFC\"])\n## Add a new column Group\ndata[, \"Group\"] <- \"not-significant\"\n## Up and down\ndata$Group[which((data[, \"P.Value\"] < 0.05) & (data$logFC >= 2))] <- \"Up-regulated\"\ndata$Group[which((data[, \"P.Value\"] < 0.05) & (data$logFC <= 2 * -1))] <- \"Down-regulated\"\n## Add a new column Label\ndata[[\"Label\"]] <- \"\"\n## Sort the p-values of differentially expressed genes from small to large\ndata <- data[order(data[, \"P.Value\"]), ]\n## Among the highly expressed genes, select the 10 with the smallest adj.P.Val\nup_genes <- head(data[, \"Symbol\"][which(data$Group == \"Up-regulated\")], 10)\ndown_genes <- head(data[, \"Symbol\"][which(data$Group == \"Down-regulated\")], 10)\nnot_sig_genes <- NA\n## Merge up_genes and down_genes and add them to Label\ndeg_top_genes <- c(as.character(up_genes), as.character(not_sig_genes),\nas.character(down_genes))\ndeg_top_genes <- deg_top_genes[!is.na(deg_top_genes)]\ndata$Label[match(deg_top_genes, data[, \"Symbol\"])] <- deg_top_genes\n\n# View data\nhead(data)\n\n# Create visualization\n# Volcano\noptions(ggrepel.max.overlaps = 100)\np <- ggscatter(data, x = \"logFC\", y = \"logP\", color = \"Group\", \n palette = c(\"#2f5688\", \"#BBBBBB\", \"#CC0000\"), size = 1, \n alpha = 0.5, font.label = 8, repel = TRUE, label=data$Label,\n xlab = \"log2(Fold Change)\", ylab = \"-log10(P Value)\",\n show.legend.text = FALSE) +\n ggtitle(\"Volcano Plot\") +\n geom_hline(yintercept = -log(0.05, 10), linetype = \"dashed\") +\n geom_vline(xintercept = c(2, -2), linetype = \"dashed\") +\n theme_bw() +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/183-volcano.html\n", - "source_file": "Hiplot/183-volcano.qmd", - "skill_file": "skills/Hiplot/183-volcano_skill.md" - }, - { - "name": "Waffle Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "waffle" - ], - "use_when": "Create a Waffle Plot using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/184-waffle.html", - "skill": "# Skill: Waffle Plot (R)\n\n## Category\nHiplot\n\n## When to Use\nCreate a Waffle Plot using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.\n\n## Required R Packages\n- data.table\n- jsonlite\n- waffle\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(jsonlite)\nlibrary(waffle)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/waffle/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\nparts <- data[,2]\n\n# View data\nhead(data)\n\n# Create visualization\n# Waffle Plot\np <- waffle(parts, rows = 8, size = 1, legend_pos = \"right\") +\n ggtitle(\"Waffle Plot\") +\n scale_fill_manual(values = c(\"#e04d39\",\"#5bbad6\",\"#1e9f86\")) +\n theme(text = element_text(family = \"Arial\"),\n plot.title = element_text(size = 12,hjust = 0.5),\n axis.title = element_text(size = 12),\n axis.text = element_text(size = 10),\n axis.text.x = element_text(angle = 0, hjust = 0.5,vjust = 1),\n legend.position = \"right\",\n legend.direction = \"vertical\",\n legend.title = element_text(size = 10),\n legend.text = element_text(size = 10))\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/184-waffle.html\n", - "source_file": "Hiplot/184-waffle.qmd", - "skill_file": "skills/Hiplot/184-waffle_skill.md" - }, - { - "name": "Waterfalls Plot2", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "waterfalls" - ], - "use_when": "Used to visualize changes in data, with the difference from version 1 being the ability to customize the colors for upward and downward values.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/185-waterfalls-plot.html", - "skill": "# Skill: Waterfalls Plot2 (R)\n\n## Category\nHiplot\n\n## When to Use\nUsed to visualize changes in data, with the difference from version 1 being the ability to customize the colors for upward and downward values.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n- waterfalls\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(waterfalls)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/waterfalls-plot/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# convert data structure\ndata[[\"name\"]] <- factor(data[[\"name\"]], levels = data[[\"name\"]])\ndata$fill <- ifelse(data$value > 0, \"#B71C1C\", \"#1B5E20\")\n\n# View data\nhead(data)\n\n# Create visualization\n# Waterfalls Plot2\np <- waterfall(data, calc_total = T, rect_width = 0.7, fill_by_sign = F,\n fill_colours = data$fill, total_rect_color = \"#1E065D\") +\n theme_bw()\n\np\n```\n\n## Key Parameters\n- `width`: Controls element width\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/185-waterfalls-plot.html\n", - "source_file": "Hiplot/185-waterfalls-plot.qmd", - "skill_file": "skills/Hiplot/185-waterfalls-plot_skill.md" - }, - { - "name": "Waterfalls", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "waterfalls" - ], - "use_when": "The waterfall chart is used to display the cumulative effect of sequentially introduced positive or negative values . These intermediate values can either be time based or category based.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/186-waterfalls.html", - "skill": "# Skill: Waterfalls (R)\n\n## Category\nHiplot\n\n## When to Use\nThe waterfall chart is used to display the cumulative effect of sequentially introduced positive or negative values . These intermediate values can either be time based or category based.\n\n## Required R Packages\n- data.table\n- ggplot2\n- jsonlite\n- waterfalls\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(jsonlite)\nlibrary(waterfalls)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/waterfalls/data.json\")$exampleData$textarea[[1]])\ndata <- as.data.frame(data)\n\n# View data\nhead(data)\n\n# Create visualization\n# Waterfalls\np <- waterfall(data, rect_text_labels = data$value, rect_text_size = 1,\n rect_text_labels_anchor = \"centre\", calc_total = T,\n total_axis_text = \"Total\", total_rect_text = sum(data$value),\n total_rect_color = \"steelblue\", total_rect_text_color = \"black\",\n rect_width = 0.7, rect_border = \"black\", draw_lines = TRUE,\n linetype = 2, fill_by_sign = F, \n fill_colours = c(\"#E64B35FF\",\"#4DBBD5FF\",\"#00A087FF\",\"#3C5488FF\",\"#F39B7FFF\",\n \"#8491B4FF\"),\n scale_y_to_waterfall = T) +\n theme_bw() +\n theme(axis.text = element_text(size = 12),\n plot.title = element_text(hjust = 0.5)) +\n labs(title = \"Waterfalls Plot\")\n\np\n```\n\n## Key Parameters\n- `width`: Controls element width\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/186-waterfalls.html\n", - "source_file": "Hiplot/186-waterfalls.qmd", - "skill_file": "skills/Hiplot/186-waterfalls_skill.md" - }, - { - "name": "PCA", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggpubr", - "gmodels", - "jsonlite" - ], - "use_when": "Principal component analysis (PCA) is a data processing method with \"dimension reduction\" as the core, replacing multi-index data with a few comprehensive indicators (PCA), and restoring the most essential characteristics of data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/187-pca.html", - "skill": "# Skill: PCA (R)\n\n## Category\nHiplot\n\n## When to Use\nPrincipal component analysis (PCA) is a data processing method with \"dimension reduction\" as the core, replacing multi-index data with a few comprehensive indicators (PCA), and restoring the most essential characteristics of data.\n\n## Required R Packages\n- data.table\n- ggplot2\n- ggpubr\n- gmodels\n- jsonlite\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(ggpubr)\nlibrary(gmodels)\nlibrary(jsonlite)\n\n# Prepare data\n# Load data\ndata <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pca/data.json\")$exampleData[[1]]$textarea[[1]])\ndata <- as.data.frame(data)\ngroup <- data.table::fread(jsonlite::read_json(\"https://hiplot.cn/ui/basic/pca/data.json\")$exampleData[[1]]$textarea[[2]])\ngroup <- as.data.frame(group)\n\n# Convert data structure\nrownames(data) <- data[, 1]\ndata <- as.matrix(data[, -1])\npca_info <- fast.prcomp(data)\n## Create configuration\nconf <- list(\n dataArg = list(\n list(list(value = \"group\")), # Color by group\n list(list(value = \"\")) # No shape group\n ),\n general = list(\n title = \"Principal Component Analysis\",\n palette = \"Set1\"\n )\n)\n## Perform PCA - Note: data must be transposed because PCA analyzes samples (columns)\npca_info <- prcomp(t(data), scale. = TRUE)\n## Prepare plot data\naxis <- sapply(conf$dataArg[[1]], function(x) x$value)\n## Process color grouping\nif (is.null(axis[1]) || axis[1] == \"\") {\n colorBy <- rep('ALL', ncol(data))\n} else {\n ## Ensure sample order matches\n colorBy <- group[match(colnames(data), group$sample), axis[1]]\n}\ncolorBy <- factor(colorBy, levels = unique(colorBy))\n## Create PCA data frame\npca_data <- data.frame(\n sample = rownames(pca_info$x),\n PC1 = pca_info$x[, 1],\n PC2 = pca_info$x[, 2],\n colorBy = colorBy\n)\n## Calculate explained variance\nvariance_explained <- round(pca_info$sdev^2 / sum(pca_info$sdev^2) * 100, 1)\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `PC1` to the x aesthetic\n- `y`: Maps `PC2` to the y aesthetic\n- `color`: Maps `colorBy` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Hiplot/187-pca.html\n", - "source_file": "Hiplot/187-pca.qmd", - "skill_file": "skills/Hiplot/187-pca_skill.md" - }, - { - "name": "Heatmap (Julia)", - "category": "Julia", - "language": "Julia", - "packages": [ - "CairoMakie" - ], - "use_when": "A heatmap visualizes matrix data using color gradients. Julia's `CairoMakie` provides high-performance heatmap rendering suitable for large gene expression matrices and multi-omics data. The Makie ecosystem supports annotations, clustering, and complex layouts for publication-quality figures.", - "tutorial_url": "https://openbiox.github.io/Bizard/Julia/Heatmap.html", - "skill": "# Skill: Heatmap (Julia)\n\n## Category\nJulia\n\n## When to Use\nA heatmap visualizes matrix data using color gradients. Julia's `CairoMakie` provides high-performance heatmap rendering suitable for large gene expression matrices and multi-omics data. The Makie ecosystem supports annotations, clustering, and complex layouts for publication-quality figures.\n\n## Required Julia Packages\n- CairoMakie\n\n## Minimal Reproducible Code\n```julia\n# Load packages\nusing CairoMakie\nusing Random\n\n# Prepare data\nRandom.seed!(42)\nn_genes = 20\nn_samples = 10\nexpr_matrix = randn(n_genes, n_samples)\nexpr_matrix[1:8, 1:5] .+= 2.5\nexpr_matrix[9:15, 6:10] .+= 2.0\ngene_names = [\"Gene_$i\" for i in 1:n_genes]\nsample_names = [\"S$i\" for i in 1:n_samples]\n\n# Create visualization\nfig = Figure(size=(700, 600))\nax = Axis(fig[1,1], xlabel=\"Samples\", ylabel=\"Genes\",\n title=\"Gene Expression Heatmap\",\n xticks=(1:n_samples, sample_names),\n yticks=(1:n_genes, gene_names))\nhm = heatmap!(ax, 1:n_samples, 1:n_genes, expr_matrix',\n colormap=:RdBu, colorrange=(-3, 3))\nColorbar(fig[1,2], hm, label=\"Expression (z-score)\")\nfig\n```\n\n## Key Parameters\n- `colormap`: Color scheme for the plot (e.g., :viridis, :RdBu)\n- `color`: Color of plot elements (e.g., :steelblue or (:red, 0.5) for alpha)\n- `colorrange`: Range for color mapping as (min, max) tuple\n- `size`: Figure size as (width, height) in pixels\n- `alpha`: Transparency via color tuple syntax: color=(:steelblue, 0.7)\n\n## Tips\n- Save figures with `save(\"plot.png\", fig)` or `save(\"plot.pdf\", fig)`\n- Adjust figure resolution with `Figure(size=(800, 600), figure_padding=20)`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Julia/Heatmap.html\n", - "source_file": "Julia/Heatmap.qmd", - "skill_file": "skills/Julia/Heatmap_skill.md" - }, - { - "name": "Scatter Plot (Julia)", - "category": "Julia", - "language": "Julia", - "packages": [ - "CairoMakie", - "DataFrames" - ], - "use_when": "A scatter plot displays values for two continuous variables as a collection of points. Julia's `CairoMakie` package (part of the Makie.jl ecosystem) provides high-performance, GPU-accelerated plotting capabilities ideal for large biomedical datasets. Makie offers publication-quality rendering with a composable, declarative API.", - "tutorial_url": "https://openbiox.github.io/Bizard/Julia/ScatterPlot.html", - "skill": "# Skill: Scatter Plot (Julia)\n\n## Category\nJulia\n\n## When to Use\nA scatter plot displays values for two continuous variables as a collection of points. Julia's `CairoMakie` package (part of the Makie.jl ecosystem) provides high-performance, GPU-accelerated plotting capabilities ideal for large biomedical datasets. Makie offers publication-quality rendering with a composable, declarative API.\n\n## Required Julia Packages\n- CairoMakie\n- DataFrames\n\n## Minimal Reproducible Code\n```julia\n# Load packages\nusing CairoMakie\nusing DataFrames\nusing Random\n\n# Prepare data\nRandom.seed!(42)\nn = 150\nspecies = repeat([\"setosa\", \"versicolor\", \"virginica\"], inner=50)\nsepal_length = [randn(50) .* 0.35 .+ 5.0;\n randn(50) .* 0.52 .+ 5.9;\n randn(50) .* 0.64 .+ 6.6]\nsepal_width = [randn(50) .* 0.38 .+ 3.4;\n randn(50) .* 0.31 .+ 2.8;\n randn(50) .* 0.32 .+ 3.0]\niris_df = DataFrame(species=species, sepal_length=sepal_length, sepal_width=sepal_width)\n\n# Create visualization\nfig = Figure(size=(700, 500))\nax = Axis(fig[1,1], xlabel=\"Sepal Length (cm)\", ylabel=\"Sepal Width (cm)\",\n title=\"Iris Scatter Plot\")\ncolors_map = Dict(\"setosa\" => :steelblue, \"versicolor\" => :coral, \"virginica\" => :green)\nfor sp in unique(iris_df.species)\n mask = iris_df.species .== sp\n scatter!(ax, iris_df.sepal_length[mask], iris_df.sepal_width[mask],\n color=colors_map[sp], markersize=10, alpha=0.7, label=sp)\nend\naxislegend(ax, position=:rt)\nfig\n```\n\n## Key Parameters\n- `colormap`: Color scheme for the plot (e.g., :viridis, :RdBu)\n- `markersize`: Size of scatter plot markers\n- `color`: Color of plot elements (e.g., :steelblue or (:red, 0.5) for alpha)\n- `linewidth`: Width of lines in the plot\n- `alpha`: Transparency level (0–1) via color tuple (color, alpha)\n- `width`: Width of violin or box plot elements\n- `size`: Figure size as (width, height) in pixels\n\n## Tips\n- Save figures with `save(\"plot.png\", fig)` or `save(\"plot.pdf\", fig)`\n- Adjust figure resolution with `Figure(size=(800, 600), figure_padding=20)`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Julia/ScatterPlot.html\n", - "source_file": "Julia/ScatterPlot.qmd", - "skill_file": "skills/Julia/ScatterPlot_skill.md" - }, - { - "name": "Violin Plot (Julia)", - "category": "Julia", - "language": "Julia", - "packages": [ - "CairoMakie", - "DataFrames" - ], - "use_when": "A violin plot combines box plot statistics with kernel density estimation to show data distributions. Julia's `CairoMakie` makes it straightforward to create violin plots for comparing gene expression, biomarker levels, or clinical measurements across groups.", - "tutorial_url": "https://openbiox.github.io/Bizard/Julia/ViolinPlot.html", - "skill": "# Skill: Violin Plot (Julia)\n\n## Category\nJulia\n\n## When to Use\nA violin plot combines box plot statistics with kernel density estimation to show data distributions. Julia's `CairoMakie` makes it straightforward to create violin plots for comparing gene expression, biomarker levels, or clinical measurements across groups.\n\n## Required Julia Packages\n- CairoMakie\n- DataFrames\n\n## Minimal Reproducible Code\n```julia\n# Load packages\nusing CairoMakie\nusing DataFrames\nusing Random\n\n# Prepare data\nRandom.seed!(42)\nn_per = 80\ngroups = vcat(fill(\"Tumor\", n_per), fill(\"Normal\", n_per), fill(\"Adjacent\", n_per))\nexpression = vcat(\n randn(n_per) .* 1.5 .+ 8,\n randn(n_per) .* 1.2 .+ 5,\n randn(n_per) .* 1.8 .+ 6.5\n)\ngroup_idx = vcat(fill(1, n_per), fill(2, n_per), fill(3, n_per))\ndf = DataFrame(Group=groups, Expression=expression, GroupIdx=group_idx)\n\n# Create visualization\nfig = Figure(size=(700, 500))\nax = Axis(fig[1,1], xlabel=\"Group\", ylabel=\"Expression Level\",\n title=\"Gene Expression Distribution\",\n xticks=(1:3, [\"Tumor\", \"Normal\", \"Adjacent\"]))\nviolin!(ax, df.GroupIdx, df.Expression, color=(:steelblue, 0.7))\nfig\n```\n\n## Key Parameters\n- `markersize`: Size of scatter plot markers\n- `color`: Color of plot elements (e.g., :steelblue or (:red, 0.5) for alpha)\n- `side`: Side of violin to draw (:left, :right, or both)\n- `width`: Width of violin or box plot elements\n- `size`: Figure size as (width, height) in pixels\n- `alpha`: Transparency via color tuple syntax: color=(:steelblue, 0.7)\n\n## Tips\n- Save figures with `save(\"plot.png\", fig)` or `save(\"plot.pdf\", fig)`\n- Adjust figure resolution with `Figure(size=(800, 600), figure_padding=20)`\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Julia/ViolinPlot.html\n", - "source_file": "Julia/ViolinPlot.qmd", - "skill_file": "skills/Julia/ViolinPlot_skill.md" - }, - { - "name": "Cell-Cell Communication Circle Plot", - "category": "Omics", - "language": "R", - "packages": [ - "BiocManager", - "CellChat", - "Seurat", - "circlize", - "ggplot2", - "igraph", - "remotes" - ], - "use_when": "The Cell-Cell Communication Circle Plot (细胞-细胞通讯网络圈图) is a specialized visualization for depicting intercellular signaling interactions inferred from single-cell RNA sequencing (scRNA-seq) data. Using the **CellChat** R package, this plot presents a circular network where nodes represent cell populations (cell types or clusters) and directed edges indicate the strength and direction of ligand-receptor communication signals between them.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/CellChatCirclePlot.html", - "skill": "# Skill: Cell-Cell Communication Circle Plot (R)\n\n## Category\nOmics\n\n## When to Use\nThe Cell-Cell Communication Circle Plot (细胞-细胞通讯网络圈图) is a specialized visualization for depicting intercellular signaling interactions inferred from single-cell RNA sequencing (scRNA-seq) data. Using the **CellChat** R package, this plot presents a circular network where nodes represent cell populations (cell types or clusters) and directed edges indicate the strength and direction of ligand-receptor communication signals between them.\n\n## Required R Packages\n- BiocManager\n- CellChat\n- Seurat\n- circlize\n- ggplot2\n- igraph\n- remotes\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(BiocManager)\nlibrary(CellChat)\nlibrary(Seurat)\nlibrary(circlize)\nlibrary(ggplot2)\nlibrary(igraph)\n\n# Prepare data\n# Simulate a communication count/weight matrix\n# In real use, these come from cellchat@net$count and cellchat@net$weight\n\nset.seed(42)\ncell_types <- c(\"CD4 T\", \"CD8 T\", \"NK\", \"B cell\", \"Monocyte\",\n \"DC\", \"Fibroblast\", \"Epithelial\", \"Endothelial\")\nn <- length(cell_types)\n\nnet_count <- matrix(sample(0:50, n * n, replace = TRUE), n, n,\n dimnames = list(cell_types, cell_types))\nnet_weight <- matrix(runif(n * n, 0, 1), n, n,\n dimnames = list(cell_types, cell_types))\ndiag(net_count) <- 0 # remove self-communication\ndiag(net_weight) <- 0\n\n# Group size (proportional to number of cells per type, simulated)\ngroup_size <- sample(50:500, n, replace = TRUE)\nnames(group_size) <- cell_types\n\ncat(\"Simulated\", n, \"cell types with\", sum(net_count), \"total interactions\\n\")\nprint(net_count)\n\n# Create visualization\npar(mfrow = c(1, 2), xpd = TRUE)\n\n# Panel A: Number of interactions\nnetVisual_circle(\n net_count,\n vertex.weight = group_size,\n weight.scale = TRUE,\n label.edge = FALSE,\n title.name = \"Number of interactions\"\n)\n\n# Panel B: Interaction strength (weights)\nnetVisual_circle(\n net_weight,\n vertex.weight = group_size,\n weight.scale = TRUE,\n label.edge = FALSE,\n title.name = \"Interaction weights/strength\"\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `Receiver` to the x aesthetic\n- `y`: Maps `Sender` to the y aesthetic\n- `fill`: Maps `Weight` to the fill aesthetic\n- `width`: Controls element width\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/CellChatCirclePlot.html\n", - "source_file": "Omics/CellChatCirclePlot.qmd", - "skill_file": "skills/Omics/CellChatCirclePlot_skill.md" - }, - { - "name": "Chromosome Plot", - "category": "Omics", - "language": "R", - "packages": [ - "RIdeogram" - ], - "use_when": "An chromosome plot (ideogram) is a graphical tool used to visualize chromosome structure and various genomic features on chromosomes. It typically represents each chromosome individually, drawing the length and structures such as the centromere to scale. Additionally, it can annotate multiple types of information on the chromosomes, including gene density, genetic variations, expression levels, repetitive sequences, and functional markers.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/ChromosomePlot.html", - "skill": "# Skill: Chromosome Plot (R)\n\n## Category\nOmics\n\n## When to Use\nAn chromosome plot (ideogram) is a graphical tool used to visualize chromosome structure and various genomic features on chromosomes. It typically represents each chromosome individually, drawing the length and structures such as the centromere to scale. Additionally, it can annotate multiple types of information on the chromosomes, including gene density, genetic variations, expression levels, repetitive sequences, and functional markers.\n\n## Required R Packages\n- RIdeogram\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RIdeogram)\n\n# Prepare data\ndata(human_karyotype, package=\"RIdeogram\")\ndata(gene_density, package=\"RIdeogram\")\ndata(Random_RNAs_500, package=\"RIdeogram\")\n\n# Create visualization\n# Basic Chromosome Plot\nideogram(karyotype = human_karyotype)\nconvertSVG(\"chromosome.svg\", device = \"png\")\n```\n\n## Key Parameters\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/ChromosomePlot.html\n", - "source_file": "Omics/ChromosomePlot.qmd", - "skill_file": "skills/Omics/ChromosomePlot_skill.md" - }, - { - "name": "Collinearity Plot", - "category": "Omics", - "language": "R", - "packages": [ - "RIdeogram" - ], - "use_when": "Collinearity plot is often used to compare genome sequences of different species, identify conserved homologous gene blocks and their arrangement order, and reveal changes in chromosome structure during evolution. This plot is widely used in the study of genome evolution, functional gene localization, and species relationship analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/CollinearityPlot.html", - "skill": "# Skill: Collinearity Plot (R)\n\n## Category\nOmics\n\n## When to Use\nCollinearity plot is often used to compare genome sequences of different species, identify conserved homologous gene blocks and their arrangement order, and reveal changes in chromosome structure during evolution. This plot is widely used in the study of genome evolution, functional gene localization, and species relationship analysis.\n\n## Required R Packages\n- RIdeogram\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RIdeogram)\n\n# Prepare data\ndata(karyotype_ternary_comparison, package=\"RIdeogram\")\ndata(synteny_ternary_comparison, package=\"RIdeogram\")\n\n# Create visualization\n# Basic Collinearity Plot\nideogram(karyotype = karyotype_ternary_comparison, synteny = synteny_ternary_comparison)\nconvertSVG(\"chromosome.svg\", device = \"png\")\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/CollinearityPlot.html\n", - "source_file": "Omics/CollinearityPlot.qmd", - "skill_file": "skills/Omics/CollinearityPlot_skill.md" - }, - { - "name": "Gene Structure Plot", - "category": "Omics", - "language": "R", - "packages": [ - "gggenes", - "ggtree", - "tidyverse" - ], - "use_when": "In biology, especially in molecular biology research, analyzing the expression and regulation patterns of genes has always been a research focus. In this process, it is inevitable that there will be a need to draw the structure of a gene or the upstream and downstream relationships. Therefore, this tutorial will summarize some common gene structure drawing methods based on the R package gggenes.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/GeneStructurePlot.html", - "skill": "# Skill: Gene Structure Plot (R)\n\n## Category\nOmics\n\n## When to Use\nIn biology, especially in molecular biology research, analyzing the expression and regulation patterns of genes has always been a research focus. In this process, it is inevitable that there will be a need to draw the structure of a gene or the upstream and downstream relationships. Therefore, this tutorial will summarize some common gene structure drawing methods based on the R package gggenes.\n\n## Required R Packages\n- gggenes\n- ggtree\n- tidyverse\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(gggenes)\nlibrary(ggtree)\nlibrary(tidyverse)\n\n# Prepare data\nhead(example_genes)\n\n# Create visualization\n# Plotting the relative positions of a series of genes\nggplot(example_genes, aes(xmin = start, xmax = end, y = molecule)) +\n geom_gene_arrow() +\n facet_wrap(~ molecule, scales = \"free\", ncol = 1) # gggenes is usually used with the facet_wrap function for faceting. It should be noted that if the drawing interface is too small, an error message will be displayed: \"Viewport has zero dimension(s)\". Just enlarge the drawing window or set a larger interface.\n```\n\n## Key Parameters\n- `y`: Maps `molecule` to the y aesthetic\n- `fill`: Maps `gene` to the fill aesthetic\n- `x`: Maps `position` to the x aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_genes()`\n\n## Tips\n- The tutorial includes a '2. Beautification' section with advanced styling options\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/GeneStructurePlot.html\n", - "source_file": "Omics/GeneStructurePlot.qmd", - "skill_file": "skills/Omics/GeneStructurePlot_skill.md" - }, - { - "name": "GWAS Circos Plot", - "category": "Omics", - "language": "R", - "packages": [ - "CMplot" - ], - "use_when": "The visualization of Genome-Wide Association Study (GWAS) results mainly includes SNP circular plots displayed by chromosome positions, SNP density plots, Manhattan plots for significance screening, QQ plots comparing the distribution of observed p-values with expected p-values, etc., which are used to screen candidate variant genes at the genome-wide level.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/GwasSnpPlot.html", - "skill": "# Skill: GWAS Circos Plot (R)\n\n## Category\nOmics\n\n## When to Use\nThe visualization of Genome-Wide Association Study (GWAS) results mainly includes SNP circular plots displayed by chromosome positions, SNP density plots, Manhattan plots for significance screening, QQ plots comparing the distribution of observed p-values with expected p-values, etc., which are used to screen candidate variant genes at the genome-wide level.\n\n## Required R Packages\n- CMplot\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(CMplot)\n\n# Prepare data\n# Example data\ndata(pig60K)\ndata <- pig60K\n\n# Data preview\nhead(data, 5)\n\n# Create visualization\n# SNP screening genome circular map\nCMplot(\n data,\n type = \"p\",\n plot.type = \"c\",\n chr.labels = paste(\"Chr\", c(1:18, \"X\", \"Y\"), sep = \"\"),\n r = 8,\n cir.axis = TRUE,\n outward = TRUE,\n cir.axis.col = \"black\",\n cir.chr.h = 2,\n chr.den.col = \"black\",\n file.output = FALSE,\n verbose = FALSE,\n mar = c(0,0,0,0)\n)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/GwasSnpPlot.html\n", - "source_file": "Omics/GwasSnpPlot.qmd", - "skill_file": "skills/Omics/GwasSnpPlot_skill.md" - }, - { - "name": "KEGG Pathway Plot", - "category": "Omics", - "language": "R", - "packages": [ - "dbplyr", - "pathview" - ], - "use_when": "Create a KEGG Pathway Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/KeggPathwayPlot.html", - "skill": "# Skill: KEGG Pathway Plot (R)\n\n## Category\nOmics\n\n## When to Use\nCreate a KEGG Pathway Plot visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- dbplyr\n- pathview\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dbplyr)\nlibrary(pathview)\n\n# Prepare data\ndata(\"gse16873.d\")\nhead(gse16873.d)\ngene_data <- as.data.frame(gse16873.d)\nhead(gene_data)\n\n# Create visualization\np1 <- pathview(gene.data = gse16873.d[, 1], # Input gene matrix\n pathway.id = \"04110\", # Pathway ID\n species = \"hsa\", # Species: Human\n out.suffix = \"gse16873_KEGG\", # Output file suffix\n kegg.native = T, # Output in original KEGG view\n same.layer = T # Drawing a single layer\n )\np1\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/KeggPathwayPlot.html\n", - "source_file": "Omics/KeggPathwayPlot.qmd", - "skill_file": "skills/Omics/KeggPathwayPlot_skill.md" - }, - { - "name": "Manhattan Plot", - "category": "Omics", - "language": "R", - "packages": [ - "aplot", - "qqman", - "tidyverse" - ], - "use_when": "Manhattan plot is a graph used to describe the relationship between mutations on chromosomes and traits. It is named Manhattan plot because it resembles the urban landscape of Manhattan, USA. Manhattan plot is generally drawn in the form of scatter plot, but it can also be displayed in bar chart or line chart. It is usually drawn using R package qqman or directly using ggplot2.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/ManhattanPlot.html", - "skill": "# Skill: Manhattan Plot (R)\n\n## Category\nOmics\n\n## When to Use\nManhattan plot is a graph used to describe the relationship between mutations on chromosomes and traits. It is named Manhattan plot because it resembles the urban landscape of Manhattan, USA. Manhattan plot is generally drawn in the form of scatter plot, but it can also be displayed in bar chart or line chart. It is usually drawn using R package qqman or directly using ggplot2.\n\n## Required R Packages\n- aplot\n- qqman\n- tidyverse\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(aplot)\nlibrary(qqman)\nlibrary(tidyverse)\n\n# Prepare data\n# View the dataset\nhead(gwasResults)\n\n# Create visualization\n# Basic manhattan plot\nmanhattan(gwasResults)\n```\n\n## Key Parameters\n- `x`: Maps `BP` to the x aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_bw()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/ManhattanPlot.html\n", - "source_file": "Omics/ManhattanPlot.qmd", - "skill_file": "skills/Omics/ManhattanPlot_skill.md" - }, - { - "name": "Motif Plot", - "category": "Omics", - "language": "R", - "packages": [ - "cowplot", - "ggplot2", - "ggseqlogo", - "gridExtra" - ], - "use_when": "For visualizing motif logos, ggseqlogo is an R package based on ggplot2 specifically designed for plotting logos from sequence motifs. Compared to other motif visualization tools, ggseqlogo boasts advantages such as concise syntax, flexible output formats, and full compatibility with the ggplot2 ecosystem. The package supports various sequence input formats, including position-frequency matrices (PFM), position-weight matrices (PWM), and sequence vectors, and provides rich customization optio...", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/MotifPlot.html", - "skill": "# Skill: Motif Plot (R)\n\n## Category\nOmics\n\n## When to Use\nFor visualizing motif logos, ggseqlogo is an R package based on ggplot2 specifically designed for plotting logos from sequence motifs. Compared to other motif visualization tools, ggseqlogo boasts advantages such as concise syntax, flexible output formats, and full compatibility with the ggplot2 ecosystem. The package supports various sequence input formats, including position-frequency matrices (PFM), position-weight matrices (PWM), and sequence vectors, and provides rich customization optio...\n\n## Required R Packages\n- cowplot\n- ggplot2\n- ggseqlogo\n- gridExtra\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(ggplot2)\nlibrary(ggseqlogo)\nlibrary(gridExtra)\n\n# Prepare data\ndata(ggseqlogo_sample)\n\nhead(pfms_dna,n = 1)\n\nhead(seqs_aa, n = 1)[[1]][1:3]\n\n# Create visualization\n# Using sequence vectors\nggseqlogo(seqs_dna$MA0001.1)\n# Using PFM matrix\nggseqlogo(pfms_dna$MA0018.2)\n# Plotting using ggplot syntax\nggplot() + geom_logo( seqs_dna$MA0001.1 ) + theme_logo()\n```\n\n## Key Parameters\n- `color`: Maps `mut` to the color aesthetic\n- `size`: Maps `mut` to the size aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_logo()`\n\n## Tips\n- The tutorial includes a '3. Motif plot beautify' section with advanced styling options\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Use `facet_wrap()` or `facet_grid()` to create multi-panel plots by group\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/MotifPlot.html\n", - "source_file": "Omics/MotifPlot.qmd", - "skill_file": "skills/Omics/MotifPlot_skill.md" - }, - { - "name": "Multiple Sequences Alignment", - "category": "Omics", - "language": "R", - "packages": [ - "ggmsa" - ], - "use_when": "Multiple Sequence Alignment (MSA) is a fundamental and crucial technique in bioinformatics. It is used to align three or more biological sequences (DNA, RNA, or proteins) based on their evolutionary or structural similarities, so that homologous sites (i.e., sites derived from a common ancestor) are aligned as much as possible.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/MultiSeqsAlignment.html", - "skill": "# Skill: Multiple Sequences Alignment (R)\n\n## Category\nOmics\n\n## When to Use\nMultiple Sequence Alignment (MSA) is a fundamental and crucial technique in bioinformatics. It is used to align three or more biological sequences (DNA, RNA, or proteins) based on their evolutionary or structural similarities, so that homologous sites (i.e., sites derived from a common ancestor) are aligned as much as possible.\n\n## Required R Packages\n- ggmsa\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ggmsa)\n\n# Prepare data\n# Example data\nprotein_fasta <- system.file(\"extdata\", \"sample.fasta\", package = \"ggmsa\")\n\n# Data preview\nseqs <- readLines(protein_fasta)\nhead(seqs)\n\n# Create visualization\n# Multiple sequence alignment of proteins\np <- ggmsa(\n protein_fasta,\n start = 300,\n end = 330,\n font = \"DroidSansMono\",\n color = \"Chemistry_AA\",\n char_width = 0.5,\n seq_name = TRUE,\n consensus_views = FALSE\n)\n\np\n```\n\n## Key Parameters\n- `width`: Controls element width\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/MultiSeqsAlignment.html\n", - "source_file": "Omics/MultiSeqsAlignment.qmd", - "skill_file": "skills/Omics/MultiSeqsAlignment_skill.md" - }, - { - "name": "Multiple Volcano Plot", - "category": "Omics", - "language": "R", - "packages": [ - "corrplot", - "scRNAtoolVis" - ], - "use_when": "Multiple Volcano Plot is a graph used for differential expression analysis of high-throughput data (such as transcriptomes and proteomes). Compared with the traditional volcano plot, the multi-group volcano plot can display the results of multiple groups at the same time, making it easier to compare the consistency or specificity of differential features horizontally.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/MultiVolcanoPlot.html", - "skill": "# Skill: Multiple Volcano Plot (R)\n\n## Category\nOmics\n\n## When to Use\nMultiple Volcano Plot is a graph used for differential expression analysis of high-throughput data (such as transcriptomes and proteomes). Compared with the traditional volcano plot, the multi-group volcano plot can display the results of multiple groups at the same time, making it easier to compare the consistency or specificity of differential features horizontally.\n\n## Required R Packages\n- corrplot\n- scRNAtoolVis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(corrplot)\nlibrary(scRNAtoolVis)\n\n# Prepare data\n# Load data\ndata('pbmc.markers')\n# View data\nhead(pbmc.markers)\n\n# Create visualization\n# Basic Multiple Volcano Plot\np <- jjVolcano(\n diffData = pbmc.markers,\n topGeneN = 5,\n log2FC.cutoff = 0.5,\n col.type = \"updown\",\n aesCol = c('#0099CC','#CC3333'),\n tile.col = corrplot::COL2('PuOr', 15)[4:12],\n cluster.order = rev(unique(pbmc.markers$cluster)),\n size = 3.5,\n fontface = 'italic'\n )\n\np\n```\n\n## Key Parameters\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/MultiVolcanoPlot.html\n", - "source_file": "Omics/MultiVolcanoPlot.qmd", - "skill_file": "skills/Omics/MultiVolcanoPlot_skill.md" - }, - { - "name": "Network Plot", - "category": "Omics", - "language": "R", - "packages": [ - "MetaNet", - "dplyr", - "igraph", - "pcutils" - ], - "use_when": "In microbiome research, it is crucial to understand the interactions between microorganisms. Network analysis is a powerful method that can help us visualize and quantify these complex relationships. Next, we will introduce the network operation and annotation functions of the `MetaNet` package, which can make our network analysis more in-depth and intuitive.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/NetworkPlot.html", - "skill": "# Skill: Network Plot (R)\n\n## Category\nOmics\n\n## When to Use\nIn microbiome research, it is crucial to understand the interactions between microorganisms. Network analysis is a powerful method that can help us visualize and quantify these complex relationships. Next, we will introduce the network operation and annotation functions of the `MetaNet` package, which can make our network analysis more in-depth and intuitive.\n\n## Required R Packages\n- MetaNet\n- dplyr\n- igraph\n- pcutils\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(MetaNet)\nlibrary(dplyr)\nlibrary(igraph)\nlibrary(pcutils)\n\n# Prepare data\ndata(otutab, package = \"pcutils\")\nt(otutab) -> totu\nc_net_calculate(totu, method = \"spearman\") -> corr\nc_net_build(corr, r_threshold = 0.6, p_threshold = 0.05, delete_single = T) -> co_net\nclass(co_net)\n\n# Create visualization\n# Basic Network\ndata(\"multi_test\", package = \"MetaNet\")\ndata(\"c_net\", package = \"MetaNet\")\nmulti1 <- multi_net_build(list(Microbiome = micro, Metabolome = metab, Transcriptome = transc))\nplot(multi1)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/NetworkPlot.html\n", - "source_file": "Omics/NetworkPlot.qmd", - "skill_file": "skills/Omics/NetworkPlot_skill.md" - }, - { - "name": "Population Map Plot", - "category": "Omics", - "language": "R", - "packages": [ - "doParallel", - "dplyr", - "ggfx", - "ggnewscale", - "ggplot2", - "ggrepel", - "ggspatial", - "gstat", - "rnaturalearth", - "rnaturalearthdata", - "sf", - "viridis" - ], - "use_when": "Create a Population Map Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/PopulationMapPlot.html", - "skill": "# Skill: Population Map Plot (R)\n\n## Category\nOmics\n\n## When to Use\nCreate a Population Map Plot visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- doParallel\n- dplyr\n- ggfx\n- ggnewscale\n- ggplot2\n- ggrepel\n- ggspatial\n- gstat\n- rnaturalearth\n- rnaturalearthdata\n- sf\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(doParallel)\nlibrary(dplyr)\nlibrary(ggfx)\nlibrary(ggnewscale)\nlibrary(ggplot2)\nlibrary(ggrepel)\n\n# Prepare data\n# Global geographic data\nworld <- ne_countries(scale = \"medium\", returnclass = \"sf\")\n# Simulating epidemiological data\nset.seed(123)\nworld$incidence <- runif(nrow(world), 0, 100) # Randomly generate incidence data\n\n# Create visualization\n# Basic map of global disease incidence distribution\np1 <- ggplot(data = world) +\n geom_sf(aes(fill = incidence)) +\n scale_fill_viridis(option = \"C\") +\n labs(title = \"Global Disease Incidence\",\n fill = \"Incidence Rate\\n(per 100k)\")\n\np1\n```\n\n## Key Parameters\n- `fill`: Maps `incidence` to the fill aesthetic\n- `color`: Maps `var1` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- The tutorial includes a '2. Advanced plot' section with advanced styling options\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/PopulationMapPlot.html\n", - "source_file": "Omics/PopulationMapPlot.qmd", - "skill_file": "skills/Omics/PopulationMapPlot_skill.md" - }, - { - "name": "Sankey Bubble plot", - "category": "Omics", - "language": "R", - "packages": [ - "ggalluvial", - "patchwork", - "readr", - "tidyverse" - ], - "use_when": "Create a Sankey Bubble plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/SankeyBubblePlot.html", - "skill": "# Skill: Sankey Bubble plot (R)\n\n## Category\nOmics\n\n## When to Use\nCreate a Sankey Bubble plot visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- ggalluvial\n- patchwork\n- readr\n- tidyverse\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ggalluvial)\nlibrary(patchwork)\nlibrary(readr)\nlibrary(tidyverse)\n\n# Prepare data\n# Load data\ndata <- read_tsv(\"files/DAVID.txt\")\n\n# Add a new categorical column\nget_category <- function(cat) {\n if (grepl(\"BP\", cat)) return(\"BP\")\n if (grepl(\"MF\", cat)) return(\"MF\")\n if (grepl(\"CC\", cat)) return(\"CC\")\n if (grepl(\"KEGG\", cat)) return(\"KEGG\")\n return(NA)\n}\ndata$MainCategory <- sapply(data$Category, get_category)\n\n# Remove SMART and NA\ndata2 <- data %>%\n filter(!grepl(\"SMART\", Category)) %>%\n filter(!is.na(MainCategory))\n\n# Sort each category and take the top 10\ntopN <- function(data, n=10) {\n data %>%\n arrange(desc(Count), PValue) %>%\n head(n)\n}\nresult <- data2 %>%\n group_by(MainCategory) %>%\n group_modify(~topN(.x, 10)) %>%\n ungroup()\n\n# KEGG pathway annotation\nresult <- result %>%\n mutate(\n Source = ifelse(MainCategory == \"KEGG\", \"KEGG\", \"GO\"),\n KEGG_Group = case_when(\n MainCategory == \"KEGG\" & str_detect(Term,\"Neuro|synapse|neurodegeneration|Alzheimer|Parkinson|Prion\") ~ \"Nervous system\",\n MainCategory == \"KEGG\" & str_detect(Term, \"Cytokine|inflammatory\") ~ \"Immune system\",\n MainCategory == \"KEGG\" & str_detect(Term, \"Lipid|atherosclerosis\") ~ \"Lipid metabolism\",\n MainCategory == \"KEGG\" ~ \"Other KEGG\",\n TRUE ~ NA_character_\n ),\n GO_Group = ifelse(MainCategory != \"KEGG\", MainCategory, NA)\n )\nalluvial_data <- result %>%\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `y`: Maps `1` to the y aesthetic\n- `fill`: Maps `Group` to the fill aesthetic\n- `x`: Maps `min` to the x aesthetic\n- `size`: Maps `Count` to the size aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/SankeyBubblePlot.html\n", - "source_file": "Omics/SankeyBubblePlot.qmd", - "skill_file": "skills/Omics/SankeyBubblePlot_skill.md" - }, - { - "name": "Synteny Blocks Plot", - "category": "Omics", - "language": "R", - "packages": [ - "syntR" - ], - "use_when": "Collinearity is widely used in the study of complex genomes. This tutorial, based on the R package syntR, summarizes the identification of shared collinearity blocks between two genetic maps, chromosomal rearrangements, and their mapping.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/SyntenyBlocksPlot.html", - "skill": "# Skill: Synteny Blocks Plot (R)\n\n## Category\nOmics\n\n## When to Use\nCollinearity is widely used in the study of complex genomes. This tutorial, based on the R package syntR, summarizes the identification of shared collinearity blocks between two genetic maps, chromosomal rearrangements, and their mapping.\n\n## Required R Packages\n- syntR\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(syntR)\n\n# Prepare data\n# load the example marker data\ndata(ann_pet_map)\nhead(ann_pet_map)\n\n# Create visualization\n# Adjust the order of the graphs\nplot_maps(map_df = map_list[[1]], map1_chrom_breaks = map_list[[2]], map2_chrom_breaks = map_list[[3]])\n```\n\n## Key Parameters\n- `stat`: Statistical transformation to use\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/SyntenyBlocksPlot.html\n", - "source_file": "Omics/SyntenyBlocksPlot.qmd", - "skill_file": "skills/Omics/SyntenyBlocksPlot_skill.md" - }, - { - "name": "Text-Overlaid Enrichment Barplot", - "category": "Omics", - "language": "R", - "packages": [ - "clusterProfiler", - "ggprism", - "gground", - "org.Hs.eg.db", - "tidyverse" - ], - "use_when": "The Text-Overlaid Enrichment Barplot is a visualization tool designed for the high-density display of functional enrichment analysis results (e.g., GO, KEGG). It typically maps enrichment significance (adjusted p-value) to the length of rounded bars and utilizes the internal space of the graphics to directly overlay annotations of pathway names and core gene lists. Additionally, it uses colored blocks and bubbles on the left side to distinguish functional categories and gene counts.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/TextEnrichmentBarPlot.html", - "skill": "# Skill: Text-Overlaid Enrichment Barplot (R)\n\n## Category\nOmics\n\n## When to Use\nThe Text-Overlaid Enrichment Barplot is a visualization tool designed for the high-density display of functional enrichment analysis results (e.g., GO, KEGG). It typically maps enrichment significance (adjusted p-value) to the length of rounded bars and utilizes the internal space of the graphics to directly overlay annotations of pathway names and core gene lists. Additionally, it uses colored blocks and bubbles on the left side to distinguish functional categories and gene counts.\n\n## Required R Packages\n- clusterProfiler\n- ggprism\n- gground\n- org.Hs.eg.db\n- tidyverse\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(clusterProfiler)\nlibrary(ggprism)\nlibrary(gground)\nlibrary(org.Hs.eg.db)\nlibrary(tidyverse)\n\n# Prepare data\n# 1. Read Data\nraw_data <- read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/DAVID.txt\")\n\n# 2. Data Cleaning\n# Convert DAVID format to the standard format required for plotting\nraw_data <- raw_data %>%\n # 2.1 Extract Category Labels\n mutate(Category = case_when(\n grepl(\"BP_DIRECT\", Category) ~ \"BP\",\n grepl(\"CC_DIRECT\", Category) ~ \"CC\",\n grepl(\"MF_DIRECT\", Category) ~ \"MF\",\n grepl(\"KEGG_PATHWAY\", Category) ~ \"KEGG\",\n TRUE ~ \"Other\"\n )) %>%\n # Keep only GO and KEGG results\n filter(Category %in% c(\"BP\", \"CC\", \"MF\", \"KEGG\")) %>%\n \n # 2.2 Clean Pathway Names (Remove IDs, e.g., \"GO:001~Name\" -> \"Name\")\n mutate(Description = sub(\"^.*~|.*:\", \"\", Term)) %>%\n \n # 2.3 Rename Columns (Unified variable names for plotting code)\n # FDR -> p.adjust (Significance)\n # Genes -> geneID (Gene List)\n rename(\n p.adjust = FDR,\n geneID = Genes\n ) %>%\n \n # 2.4 Format Gene Lists (Replace commas with slashes)\n mutate(geneID = gsub(\", \", \"/\", geneID))\n\n# Create visualization\n# Define color palette\npal <- c('#eaa052', '#b74147', '#90ad5b', '#23929c')\n\n# Other recommended palettes\n#pal <- c('#c3e1e6', '#f3dfb7', '#dcc6dc', '#96c38e')\n#pal <- c('#7bc4e2', '#acd372', '#fbb05b', '#ed6ca4')\n\n# Adjust position parameters for left blocks in the simplified version\nrect.data.simple <- rect.data %>%\n mutate(\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `y`: Maps `Description` to the y aesthetic\n- `x`: Maps `0` to the x aesthetic\n- `fill`: Maps `Category` to the fill aesthetic\n- `colour`: Maps `Category` to the colour aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_prism()`\n\n## Tips\n- The tutorial includes a '2. Advanced Plotting (Detailed Version)' section with advanced styling options\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/TextEnrichmentBarPlot.html\n", - "source_file": "Omics/TextEnrichmentBarPlot.qmd", - "skill_file": "skills/Omics/TextEnrichmentBarPlot_skill.md" - }, - { - "name": "Volcano Plot", - "category": "Omics", - "language": "R", - "packages": [ - "ggrepel", - "readxl", - "tidyverse" - ], - "use_when": "The volcano plot is used to compare the two groups and obtain the up-regulation/down-regulation between the two groups. The screening basis is the p value and FC value, which are converted to -logP value and log2(FC) value. The imported data can be the OTU table or ASV table of the microbiome, the table of transcriptome gene expression, or the features table of metabolomics and other multi-omics data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/VolcanoPlot.html", - "skill": "# Skill: Volcano Plot (R)\n\n## Category\nOmics\n\n## When to Use\nThe volcano plot is used to compare the two groups and obtain the up-regulation/down-regulation between the two groups. The screening basis is the p value and FC value, which are converted to -logP value and log2(FC) value. The imported data can be the OTU table or ASV table of the microbiome, the table of transcriptome gene expression, or the features table of metabolomics and other multi-omics data.\n\n## Required R Packages\n- ggrepel\n- readxl\n- tidyverse\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(ggrepel)\nlibrary(readxl)\nlibrary(tidyverse)\n\n# Prepare data\n# Load excel data\ndata <- read_excel(\"files/volcano.eg.xlsx\")\n\n# Rename column names (handle special characters)\ndata <- data %>%\n rename(log2FC = \"log2 Ratio(WT0/LOG)\", Pvalue = \"Pvalue\")\n# Handle the case where the p-value is 0 (avoid calculating -Inf)\ndata <- data %>%\n mutate(log10P = -log10(Pvalue + 1e-300)) # Make sure to handle the case where P=0\n# Convert to numeric type and handle values that fail to convert (such as invalid characters)\ndata <- data %>%\n mutate(\n log2FC = as.numeric(log2FC) # Values that fail the conversion become NA\n )\n\n# Find the original value that caused the conversion to fail\ndata %>%\n filter(is.na(log2FC)) %>%\n select(log2FC) # View the raw log2FC values for these lines\n# Repair the data as needed (e.g. replace or remove outliers)\n# Example: Replace \"Inf\" with an actual value or filter out\ndata <- data %>%\n mutate(\n log2FC = ifelse(log2FC == \"Inf\", 100, log2FC), # Adjust according to needs\n log2FC = as.numeric(log2FC)\n ) %>%\n filter(!is.na(log2FC)) # Delete the rows that cannot be repaired\n\n# Defining significance (satisfying both P value < 0.05 and |log2FC| > 1)\n# Define significance categories (upregulated, downregulated, not significant)\ndata <- data %>%\n mutate(\n significant = case_when(\n Pvalue < 0.05 & log2FC > 2 ~ \"Upregulated\", # Up (red)\n Pvalue < 0.05 & log2FC < -2 ~ \"Downregulated\", # Down (green)\n TRUE ~ \"Not significant\" # Not significant (grey)\n )\n )\n\n# View data structure\nhead(data, 5)\n\n# Create visualization\n# Basic volcano plot\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `log2FC` to the x aesthetic\n- `color`: Maps `significant` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Include appropriate statistical thresholds (e.g., FDR < 0.05, |log2FC| > 1) in the visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Omics/VolcanoPlot.html\n", - "source_file": "Omics/VolcanoPlot.qmd", - "skill_file": "skills/Omics/VolcanoPlot_skill.md" - }, - { - "name": "Arc Diagram", - "category": "Proportion", - "language": "R", - "packages": [ - "colormap", - "ggraph", - "igraph", - "patchwork", - "tidyverse", - "viridis" - ], - "use_when": "The arc diagram is a diagram connected by arcs, showing the relationships between nodes.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/ArcDiagram.html", - "skill": "# Skill: Arc Diagram (R)\n\n## Category\nProportion\n\n## When to Use\nThe arc diagram is a diagram connected by arcs, showing the relationships between nodes.\n\n## Required R Packages\n- colormap\n- ggraph\n- igraph\n- patchwork\n- tidyverse\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(colormap)\nlibrary(ggraph)\nlibrary(igraph)\nlibrary(patchwork)\nlibrary(tidyverse)\nlibrary(viridis)\n\n# Prepare data\n# 1.Custom data\n# `links` stores edge information, and `nodes` stores node information and node grouping information.\nlinks <- data.frame(\nsource = c(\"A\", \"A\", \"A\", \"A\", \"B\", \"G\", \"G\", \"G\", \"G\"),\n target = c(\"B\", \"C\", \"D\", \"F\", \"E\", \"H\", \"I\", \"J\", \"F\")\n)\nnodes <- data.frame(\n point = c(\"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\", \"I\", \"J\"),\n groups = c(\n \"group-one\", \"group-one\", \"group-one\", \"group-one\", \"group-one\",\n \"group-one\", \"group-two\", \"group-two\", \"group-two\", \"group-two\"\n )\n)\n\nhead(links)\nhead(nodes)\n\n# 2.Researchers co-authored network\n# Copy the link information to a txt file, read it, and draw the plot.\ndata_dif <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/Arc.txt\", header = T, sep = \" \")\n\nhead(data_dif[,1:5])\n\n# 3.PPI network node and edge data\n# Read PPI network information downloaded from GitHub\ndata_ppi <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/string_interactions_short.tsv_1%20default%20edge.csv\", header = TRUE)\n\nhead(data_ppi[,c(9,3)])\n\n# Create visualization\n# Basic arc diagram\nmygraph <- graph_from_data_frame(links, vertices = nodes) # Generate graph structure\n\np <- ggraph(mygraph, layout = \"linear\") +\n geom_edge_arc(edge_colour = \"black\", edge_alpha = 0.3, edge_width = 0.4) +\n geom_node_point(color = \"grey\", size = 5) +\n geom_node_text(aes(label = name), repel = FALSE, size = 6, nudge_y = -0.15) +\n theme_void() +\n theme(\n legend.position = \"none\",\n plot.margin = unit(rep(2, 4), \"cm\")\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `color`: Maps `as` to the color aesthetic\n- `size`: Maps `n` to the size aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Proportion/ArcDiagram.html\n", - "source_file": "Proportion/ArcDiagram.qmd", - "skill_file": "skills/Proportion/ArcDiagram_skill.md" - }, - { - "name": "Chord Diagram", - "category": "Proportion", - "language": "R", - "packages": [ - "chorddiag", - "circlize", - "dplyr", - "ggraph", - "htmlwidgets", - "igraph", - "readr", - "readxl", - "tidygraph", - "tidyverse", - "viridis" - ], - "use_when": "Chord diagrams can use connecting lines or bars to represent the relationships between different objects. The connections in a chord diagram directly show the relationships between different objects; the width of the connection is proportional to the strength of the relationship, and the color of the connection can represent another mapping of the relationship, such as the type of relationship. The size of the sectors in the diagram represents the measurement of the objects.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/ChordDiagram.html", - "skill": "# Skill: Chord Diagram (R)\n\n## Category\nProportion\n\n## When to Use\nChord diagrams can use connecting lines or bars to represent the relationships between different objects. The connections in a chord diagram directly show the relationships between different objects; the width of the connection is proportional to the strength of the relationship, and the color of the connection can represent another mapping of the relationship, such as the type of relationship. The size of the sectors in the diagram represents the measurement of the objects.\n\n## Required R Packages\n- chorddiag\n- circlize\n- dplyr\n- ggraph\n- htmlwidgets\n- igraph\n- readr\n- readxl\n- tidygraph\n- tidyverse\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(chorddiag)\nlibrary(circlize)\nlibrary(dplyr)\nlibrary(ggraph)\nlibrary(htmlwidgets)\nlibrary(igraph)\n\n# Prepare data\n# TCGA-BRCA.star_counts.tsv\ntcga_brca_star_counts <- readr::read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.star_counts.tsv\")\ntarget_ensembl_ids <- c(\"ENSG00000012048.23\", # BRCA1\n \"ENSG00000139618.16\", # BRCA2\n \"ENSG00000141736.14\", # ERBB2\n \"ENSG00000121879.6\", # PIK3CA\n \"ENSG00000171862.11\", # PTEN\n \"ENSG00000111537.5\") # AKT1\ngene_data <- tcga_brca_star_counts[tcga_brca_star_counts$Ensembl_ID %in% target_ensembl_ids, ]\ngene_data <- gene_data[,2:101]\ngene_data_t <- t(gene_data)\n\nx <- c(gene_data_t[, 1], gene_data_t[, 3], gene_data_t[, 5])\ny <- c(gene_data_t[, 2], gene_data_t[, 4], gene_data_t[, 6])\nfactor <- rep(c(\"a\", \"b\", \"c\"), each = 100)\nplot_data <- data.frame(x = x, y = y, factor = factor)\n\n# Berberine_new\nberberine_blood_glucose <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/Berberine_new.csv\")\nberberine_blood_glucose <- berberine_blood_glucose %>% na.omit()\n\nblood_glucose_category <- function(value) {\n if (value < 4.5) {\n return(\"Low\")\n } else if (value >= 4.5 & value < 6.5) {\n return(\"Normal\")\n } else if (value >= 6.5 & value <= 11.0) {\n return(\"Slightly High\")\n } else {\n return(\"High\")\n }\n}\n\nberberine_blood_glucose$before_category <- sapply(berberine_blood_glucose$before, blood_glucose_category)\nberberine_blood_glucose$after_category <- sapply(berberine_blood_glucose$after, blood_glucose_category)\n\nadj_matrix <- table(berberine_blood_glucose$before_category, berberine_blood_glucose$after_category) # Generate adjacency matrix\nadj_matrix_df <- as.data.frame(as.table(adj_matrix))\n\nadj_matrix_wide <- adj_matrix_df %>%\n pivot_wider(names_from = Var2, values_from = Freq, values_fill = list(Freq = 0))\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- The tutorial includes a '4. Highly customized chord diagrams' section with advanced styling options\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Proportion/ChordDiagram.html\n", - "source_file": "Proportion/ChordDiagram.qmd", - "skill_file": "skills/Proportion/ChordDiagram_skill.md" - }, - { - "name": "Dice Plot", - "category": "Proportion", - "language": "R", - "packages": [ - "dplyr", - "ggdiceplot", - "ggplot2" - ], - "use_when": "Dice plots are a visualization technique for representing high-dimensional categorical data. The ggdiceplot package provides ggplot2 extensions for creating dice-based visualizations where each dot position on a dice represents a specific categorical variable. This allows intuitive visualization of up to 6 categorical variables simultaneously using traditional dice patterns. Each dice position (1-6) represents a different category, with dots shown only when that category is present.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/DicePlot.html", - "skill": "# Skill: Dice Plot (R)\n\n## Category\nProportion\n\n## When to Use\nDice plots are a visualization technique for representing high-dimensional categorical data. The ggdiceplot package provides ggplot2 extensions for creating dice-based visualizations where each dot position on a dice represents a specific categorical variable. This allows intuitive visualization of up to 6 categorical variables simultaneously using traditional dice patterns. Each dice position (1-6) represents a different category, with dots shown only when that category is present.\n\n## Required R Packages\n- dplyr\n- ggdiceplot\n- ggplot2\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggdiceplot)\nlibrary(ggplot2)\n\n# Prepare data\n# Load sample data from package\ndata(\"sample_dice_miRNA\", package = \"ggdiceplot\")\ndf_dice <- sample_dice_miRNA\n\n# View data structure\nhead(df_dice)\n\n# Check data dimensions\nstr(df_dice)\n\n# Create visualization\n# Define colors for regulation direction\ndirection_colors <- c(\n Down = \"#2166ac\",\n Unchanged = \"grey80\",\n Up = \"#b2182b\"\n)\n\n# Create basic dice plot\np1 <- ggplot(df_dice, aes(x = miRNA, y = Compound)) +\n geom_dice(\n aes(\n dots = Organ,\n fill = direction,\n width = 0.8,\n height = 0.8\n ),\n show.legend = TRUE,\n ndots = length(levels(df_dice$Organ)),\n x_length = length(levels(df_dice$miRNA)),\n y_length = length(levels(df_dice$Compound))\n ) +\n scale_fill_manual(values = direction_colors, name = \"Regulation\") +\n theme_minimal() +\n theme(\n axis.text.x = element_text(angle = 0, hjust = 0.5),\n axis.text.y = element_text(hjust = 1),\n panel.grid = element_blank()\n ) +\n labs(\n x = \"miRNA\",\n y = \"Compound\"\n )\n\n# ... (see full tutorial for more)\n```\n\n## Key Parameters\n- `x`: Maps `miRNA` to the x aesthetic\n- `y`: Maps `Compound` to the y aesthetic\n- `fill`: Maps `direction` to the fill aesthetic\n- `width`: Controls element width\n- `theme`: Plot theme; tutorial uses `theme_minimal()`\n\n## Tips\n- The tutorial includes a '2. Advanced Dice Plot with Continuous Variables' section with advanced styling options\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Proportion/DicePlot.html\n", - "source_file": "Proportion/DicePlot.qmd", - "skill_file": "skills/Proportion/DicePlot_skill.md" - }, - { - "name": "Hierarchical Edge Bundling", - "category": "Proportion", - "language": "R", - "packages": [], - "use_when": "Create a Hierarchical Edge Bundling visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/EdgeBundling.html", - "skill": "# Skill: Hierarchical Edge Bundling (R)\n\n## Category\nProportion\n\n## When to Use\nCreate a Hierarchical Edge Bundling visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- (see tutorial)\n\n## Minimal Reproducible Code\n(See full tutorial for code)\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Proportion/EdgeBundling.html\n", - "source_file": "Proportion/EdgeBundling.qmd", - "skill_file": "skills/Proportion/EdgeBundling_skill.md" - }, - { - "name": "Network Graph", - "category": "Proportion", - "language": "R", - "packages": [ - "RColorBrewer", - "cowplot", - "igraph", - "networkD3" - ], - "use_when": "A network graph is a graphical model that resembles a network and consists of nodes and links, where links can be directed or undirected.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/Network.html", - "skill": "# Skill: Network Graph (R)\n\n## Category\nProportion\n\n## When to Use\nA network graph is a graphical model that resembles a network and consists of nodes and links, where links can be directed or undirected.\n\n## Required R Packages\n- RColorBrewer\n- cowplot\n- igraph\n- networkD3\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(RColorBrewer)\nlibrary(cowplot)\nlibrary(igraph)\nlibrary(networkD3)\n\n# Prepare data\n# network_pmat\n## Correlation analysis results of various indicators in the Matcars dataset\ndata_pmat_links<- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/data_mat.csv\")\ndata_pmat_links <- na.omit(data_pmat_links)\ncolnames(data_pmat_links) <- c(\"from\", \"to\", \"p.log\")\n\ndata_pmat_node <- colnames(mtcars)\nnetwork_pmat <- graph_from_data_frame(d=data_pmat_links, vertices=data_pmat_node, directed=F) \n\n# data_mat\n## mtcars clustering analysis\n## Calculate the correlation coefficient matrix\ndata_mat <- cor(t(mtcars[,c(1,3:6)]))\n## Filtering highly relevant data\ndata_mat[data_mat<0.995] <- 0\n\n# Create visualization\n# plot----\npar(mfrow=c(2,2), mar=c(1,1,1,1))\nplot(network1, main=\"Adjacency matrix (square matrix)\")\nplot(network2, main=\"Incident matrix\")\nplot(network3, main=\"Edge List\")\nplot(network4, main=\"Linked text list\")\n```\n\n## Key Parameters\n- `width`: Controls element width\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Proportion/Network.html\n", - "source_file": "Proportion/Network.qmd", - "skill_file": "skills/Proportion/Network_skill.md" - }, - { - "name": "Sankey Diagram", - "category": "Proportion", - "language": "R", - "packages": [ - "dplyr", - "ggalluvial", - "ggplot2", - "networkD3", - "openxlsx", - "readxl", - "tidyverse", - "webshot" - ], - "use_when": "A [Sankey diagram](https://www.data-to-viz.com/graph/sankey.html) allows to study flows. Entities (nodes) are represented by rectangles or text. Arrows or arcs are used to show flows between them. In `R`, the `networkD3` package is the best way to build them.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/Sankey.html", - "skill": "# Skill: Sankey Diagram (R)\n\n## Category\nProportion\n\n## When to Use\nA [Sankey diagram](https://www.data-to-viz.com/graph/sankey.html) allows to study flows. Entities (nodes) are represented by rectangles or text. Arrows or arcs are used to show flows between them. In `R`, the `networkD3` package is the best way to build them.\n\n## Required R Packages\n- dplyr\n- ggalluvial\n- ggplot2\n- networkD3\n- openxlsx\n- readxl\n- tidyverse\n- webshot\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(ggalluvial)\nlibrary(ggplot2)\nlibrary(networkD3)\nlibrary(openxlsx)\nlibrary(readxl)\n\n# Prepare data\n#Read drug clinical dataset\ndrugs <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/drugs.csv\", stringsAsFactors = FALSE)\n# Create a node data frame\nnodes <- data.frame(\n name=c(as.character(drugs$source), \n as.character(drugs$target)) %>% unique())\n# Reformat\ndrugs$IDsource <- match(drugs$source, nodes$name)-1 \ndrugs$IDtarget <- match(drugs$target, nodes$name)-1\n\n\n#Read drug clinical dataset\ndrug <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/drug.csv\", stringsAsFactors = FALSE)\nlevels(drug$`glucose(mmol/L)`) <- rev(levels(drug$`glucose(mmol/L)`))\n\n# Create visualization\n# Basic plotting\np1 <- sankeyNetwork(Links = drugs, Nodes = nodes,\n Source = \"IDsource\", Target = \"IDtarget\",\n Value = \"value\", NodeID = \"name\") \n \np1\n```\n\n## Key Parameters\n- `x`: Maps `time` to the x aesthetic\n- `y`: Maps `value` to the y aesthetic\n- `fill`: Maps `level` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Proportion/Sankey.html\n", - "source_file": "Proportion/Sankey.qmd", - "skill_file": "skills/Proportion/Sankey_skill.md" - }, - { - "name": "Heatmap (Python)", - "category": "Python", - "language": "Python", - "packages": [ - "matplotlib", - "numpy", - "pandas", - "scipy", - "seaborn" - ], - "use_when": "A heatmap is a data visualization technique that uses color to represent values in a matrix. In biomedical research, heatmaps are essential for visualizing gene expression profiles, correlation matrices, methylation data, and drug response panels. Python's `seaborn` and `matplotlib` libraries offer powerful heatmap capabilities with built-in clustering support.", - "tutorial_url": "https://openbiox.github.io/Bizard/Python/Heatmap.html", - "skill": "# Skill: Heatmap (Python)\n\n## Category\nPython\n\n## When to Use\nA heatmap is a data visualization technique that uses color to represent values in a matrix. In biomedical research, heatmaps are essential for visualizing gene expression profiles, correlation matrices, methylation data, and drug response panels. Python's `seaborn` and `matplotlib` libraries offer powerful heatmap capabilities with built-in clustering support.\n\n## Required Python Packages\n- matplotlib\n- numpy\n- pandas\n- scipy\n- seaborn\n\n## Minimal Reproducible Code\n```python\n# Load packages\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport pandas as pd\nimport numpy as np\nfrom scipy.cluster.hierarchy import linkage\n\n# Prepare data\nnp.random.seed(42)\nn_genes = 30\nn_samples = 12\ngene_names = [f'Gene_{i+1}' for i in range(n_genes)]\nsample_names = [f'Sample_{i+1}' for i in range(n_samples)]\ngroups = ['Tumor'] * 6 + ['Normal'] * 6\n\nexpr_matrix = np.random.randn(n_genes, n_samples)\nexpr_matrix[:10, :6] += 2.5\nexpr_matrix[10:20, 6:] += 2.0\n\nexpr_df = pd.DataFrame(expr_matrix, index=gene_names, columns=sample_names)\n\n# Create visualization\nfig, ax = plt.subplots(figsize=(10, 8))\nsns.heatmap(expr_df, cmap='RdBu_r', center=0, xticklabels=True,\n yticklabels=True, linewidths=0.5, ax=ax)\nax.set_title('Gene Expression Heatmap')\nax.set_xlabel('Samples')\nax.set_ylabel('Genes')\nplt.tight_layout()\nplt.show()\n```\n\n## Key Parameters\n- `figsize`: Figure dimensions as (width, height) in inches\n- `cmap`: Colormap for continuous color mapping\n- `annot`: Whether to annotate cells with values (True/False)\n\n## Tips\n- Call `plt.tight_layout()` to prevent label overlap\n- Seaborn integrates with pandas DataFrames for convenient column-based plotting\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Python/Heatmap.html\n", - "source_file": "Python/Heatmap.qmd", - "skill_file": "skills/Python/Heatmap_skill.md" - }, - { - "name": "Scatter Plot (Python)", - "category": "Python", - "language": "Python", - "packages": [ - "matplotlib", - "numpy", - "pandas", - "scipy", - "seaborn" - ], - "use_when": "A scatter plot displays values for two continuous variables as a collection of points. In biomedical research, scatter plots are widely used for visualizing correlations between gene expression levels, comparing biomarkers, and exploring relationships in multi-omics datasets. Python's `matplotlib` and `seaborn` libraries provide flexible and publication-quality scatter plot capabilities.", - "tutorial_url": "https://openbiox.github.io/Bizard/Python/ScatterPlot.html", - "skill": "# Skill: Scatter Plot (Python)\n\n## Category\nPython\n\n## When to Use\nA scatter plot displays values for two continuous variables as a collection of points. In biomedical research, scatter plots are widely used for visualizing correlations between gene expression levels, comparing biomarkers, and exploring relationships in multi-omics datasets. Python's `matplotlib` and `seaborn` libraries provide flexible and publication-quality scatter plot capabilities.\n\n## Required Python Packages\n- matplotlib\n- numpy\n- pandas\n- scipy\n- seaborn\n\n## Minimal Reproducible Code\n```python\n# Load packages\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport pandas as pd\nimport numpy as np\nfrom scipy import stats\n\n# Prepare data\niris = sns.load_dataset(\"iris\")\n\nnp.random.seed(42)\nn = 200\ngene_data = pd.DataFrame({\n 'GeneA': np.random.normal(5, 2, n),\n 'GeneB': np.random.normal(5, 2, n),\n 'Group': np.random.choice(['Tumor', 'Normal'], n)\n})\ngene_data.loc[gene_data['Group'] == 'Tumor', 'GeneA'] += 2\ngene_data.loc[gene_data['Group'] == 'Tumor', 'GeneB'] += 1.5\n\n# Create visualization\nfig, ax = plt.subplots(figsize=(8, 6))\nfor species in iris['species'].unique():\n subset = iris[iris['species'] == species]\n ax.scatter(subset['sepal_length'], subset['sepal_width'],\n label=species, alpha=0.7, edgecolors='white', linewidth=0.5)\nax.set_xlabel('Sepal Length (cm)')\nax.set_ylabel('Sepal Width (cm)')\nax.set_title('Iris Scatter Plot')\nax.legend(title='Species')\nax.spines[['top', 'right']].set_visible(False)\nplt.tight_layout()\nplt.show()\n```\n\n## Key Parameters\n- `palette`: Color palette for the plot (e.g., Set2, viridis, coolwarm)\n- `figsize`: Figure dimensions as (width, height) in inches\n- `alpha`: Transparency level (0–1)\n- `hue`: Variable for color grouping\n\n## Tips\n- Call `plt.tight_layout()` to prevent label overlap\n- Seaborn integrates with pandas DataFrames for convenient column-based plotting\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Python/ScatterPlot.html\n", - "source_file": "Python/ScatterPlot.qmd", - "skill_file": "skills/Python/ScatterPlot_skill.md" - }, - { - "name": "Violin Plot (Python)", - "category": "Python", - "language": "Python", - "packages": [ - "matplotlib", - "numpy", - "pandas", - "seaborn" - ], - "use_when": "A violin plot combines a box plot and a kernel density estimation to show the distribution of continuous data across categories. In biomedical research, violin plots are ideal for comparing gene expression distributions, drug response measurements, or clinical biomarker levels across patient groups. Python's `seaborn` library makes it simple to create beautiful violin plots.", - "tutorial_url": "https://openbiox.github.io/Bizard/Python/ViolinPlot.html", - "skill": "# Skill: Violin Plot (Python)\n\n## Category\nPython\n\n## When to Use\nA violin plot combines a box plot and a kernel density estimation to show the distribution of continuous data across categories. In biomedical research, violin plots are ideal for comparing gene expression distributions, drug response measurements, or clinical biomarker levels across patient groups. Python's `seaborn` library makes it simple to create beautiful violin plots.\n\n## Required Python Packages\n- matplotlib\n- numpy\n- pandas\n- seaborn\n\n## Minimal Reproducible Code\n```python\n# Load packages\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport pandas as pd\nimport numpy as np\n\n# Prepare data\niris = sns.load_dataset(\"iris\")\n\nnp.random.seed(42)\nn_per_group = 80\ngroups = ['Tumor', 'Normal', 'Adjacent']\ngene_expr = pd.DataFrame({\n 'Expression': np.concatenate([\n np.random.normal(8, 1.5, n_per_group),\n np.random.normal(5, 1.2, n_per_group),\n np.random.normal(6.5, 1.8, n_per_group)\n ]),\n 'Group': np.repeat(groups, n_per_group),\n 'Gene': np.tile(np.repeat(['TP53', 'BRCA1'], n_per_group // 2), 3)\n})\n\n# Create visualization\nfig, ax = plt.subplots(figsize=(8, 6))\nsns.violinplot(data=iris, x='species', y='sepal_length', palette='Set2',\n inner='box', ax=ax)\nax.set_xlabel('Species')\nax.set_ylabel('Sepal Length (cm)')\nax.set_title('Distribution of Sepal Length by Species')\nax.spines[['top', 'right']].set_visible(False)\nplt.tight_layout()\nplt.show()\n```\n\n## Key Parameters\n- `palette`: Color palette for the plot (e.g., Set2, viridis, coolwarm)\n- `figsize`: Figure dimensions as (width, height) in inches\n- `alpha`: Transparency level (0–1)\n- `inner`: Representation inside violin (box, quartile, point, stick, None)\n- `hue`: Variable for color grouping\n\n## Tips\n- Call `plt.tight_layout()` to prevent label overlap\n- Seaborn integrates with pandas DataFrames for convenient column-based plotting\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Python/ViolinPlot.html\n", - "source_file": "Python/ViolinPlot.qmd", - "skill_file": "skills/Python/ViolinPlot_skill.md" - }, - { - "name": "Volcano Plot (Python)", - "category": "Python", - "language": "Python", - "packages": [ - "matplotlib", - "numpy", - "pandas" - ], - "use_when": "A volcano plot displays statistical significance (-log10 p-value) versus fold-change (log2 FC) for thousands of features simultaneously. In biomedical research, volcano plots are the standard visualization for differential gene expression results from RNA-seq, proteomics, and metabolomics. Python's `matplotlib` provides full control over customizing these publication-ready plots.", - "tutorial_url": "https://openbiox.github.io/Bizard/Python/VolcanoPlot.html", - "skill": "# Skill: Volcano Plot (Python)\n\n## Category\nPython\n\n## When to Use\nA volcano plot displays statistical significance (-log10 p-value) versus fold-change (log2 FC) for thousands of features simultaneously. In biomedical research, volcano plots are the standard visualization for differential gene expression results from RNA-seq, proteomics, and metabolomics. Python's `matplotlib` provides full control over customizing these publication-ready plots.\n\n## Required Python Packages\n- matplotlib\n- numpy\n- pandas\n\n## Minimal Reproducible Code\n```python\n# Load packages\nimport matplotlib.pyplot as plt\nimport pandas as pd\nimport numpy as np\n\n# Prepare data\nnp.random.seed(42)\nn_genes = 5000\ndf = pd.DataFrame({\n 'gene': [f'Gene{i+1}' for i in range(n_genes)],\n 'log2FC': np.random.normal(0, 1.5, n_genes),\n 'pvalue': np.random.uniform(1e-10, 1, n_genes)\n})\ndf['neg_log10p'] = -np.log10(df['pvalue'])\n\nfc_thresh = 1.0\np_thresh = 0.05\n\nconditions = [\n (df['log2FC'] > fc_thresh) & (df['pvalue'] < p_thresh),\n (df['log2FC'] < -fc_thresh) & (df['pvalue'] < p_thresh),\n]\nchoices = ['Up', 'Down']\ndf['regulation'] = np.select(conditions, choices, default='NS')\n\n# Create visualization\ncolors = {'Up': '#e63946', 'Down': '#457b9d', 'NS': '#cccccc'}\nfig, ax = plt.subplots(figsize=(8, 6))\nfor reg, color in colors.items():\n subset = df[df['regulation'] == reg]\n ax.scatter(subset['log2FC'], subset['neg_log10p'],\n c=color, s=8, alpha=0.6, label=f'{reg} ({len(subset)})')\nax.axhline(-np.log10(p_thresh), color='grey', linestyle='--', linewidth=0.8)\nax.axvline(fc_thresh, color='grey', linestyle='--', linewidth=0.8)\nax.axvline(-fc_thresh, color='grey', linestyle='--', linewidth=0.8)\nax.set_xlabel('log₂(Fold Change)')\nax.set_ylabel('-log₁₀(P-value)')\nax.set_title('Volcano Plot')\nax.legend(frameon=False)\nax.spines[['top', 'right']].set_visible(False)\nplt.tight_layout()\nplt.show()\n```\n\n## Key Parameters\n- `figsize`: Figure dimensions as (width, height) in inches\n- `alpha`: Transparency level (0–1)\n- `annot`: Whether to annotate cells with values (True/False)\n\n## Tips\n- The tutorial includes a 'Enhanced Volcano with Significance Regions' section with advanced styling options\n- Call `plt.tight_layout()` to prevent label overlap\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Python/VolcanoPlot.html\n", - "source_file": "Python/VolcanoPlot.qmd", - "skill_file": "skills/Python/VolcanoPlot_skill.md" - }, - { - "name": "Bar Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "cowplot", - "dplyr", - "forcats", - "ggpattern", - "ggplot2", - "ggpubr", - "hrbrthemes", - "magrittr", - "palmerpenguins", - "rstatix", - "tidyr" - ], - "use_when": "A bar plot is a graph that uses the height or length of the bars to represent the amount of data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/BarPlot.html", - "skill": "# Skill: Bar Plot (R)\n\n## Category\nRanking\n\n## When to Use\nA bar plot is a graph that uses the height or length of the bars to represent the amount of data.\n\n## Required R Packages\n- cowplot\n- dplyr\n- forcats\n- ggpattern\n- ggplot2\n- ggpubr\n- hrbrthemes\n- magrittr\n- palmerpenguins\n- rstatix\n- tidyr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(dplyr)\nlibrary(forcats)\nlibrary(ggpattern)\nlibrary(ggplot2)\nlibrary(ggpubr)\n\n# Prepare data\ndata_TCGA <- readr::read_csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.htseq_counts_processed.csv\")\n\ndata_TCGA1 <- data_TCGA[1:5,] %>%\n gather(key = \"sample\",value = \"gene_expression\",3:1219)\n\ndata_tcga_mean <- aggregate(data_TCGA1$gene_expression, \n by=list(data_TCGA1$gene_name), mean) # mean\ncolnames(data_tcga_mean) <- c(\"gene\",\"expression\")\n\ndata_tcga_sd <- aggregate(data_TCGA1$gene_expression, \n by=list(data_TCGA1$gene_name), sd)\ncolnames(data_tcga_sd) <- c(\"gene\",\"sd\")\n\ndata_tcga <- merge(data_tcga_mean, data_tcga_sd, by=\"gene\")\n\ndata_penguins <- penguins\n\ndata_penguins_flipper_length <- aggregate(data_penguins$flipper_length_mm,\n by=list(data_penguins$species,data_penguins$sex),\n mean)\ncolnames(data_penguins_flipper_length) <- c(\"species\",\"sex\",\"flipper_length_mm\")\n\ndata_mpg <- mpg\n\n# Create visualization\n# Basic bar plot\np <- ggplot(data_tcga_mean, aes(x=gene, y=expression)) + \n geom_bar(stat = \"identity\")\n\np\n```\n\n## Key Parameters\n- `x`: Maps `gene` to the x aesthetic\n- `y`: Maps `expression` to the y aesthetic\n- `fill`: Maps `group` to the fill aesthetic\n- `colour`: Maps `group` to the colour aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Use `coord_flip()` for horizontal orientation when labels are long\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Sort categories by value rather than alphabetically for clearer ranking visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Ranking/BarPlot.html\n", - "source_file": "Ranking/BarPlot.qmd", - "skill_file": "skills/Ranking/BarPlot_skill.md" - }, - { - "name": "Circular Barplot", - "category": "Ranking", - "language": "R", - "packages": [ - "tidyverse" - ], - "use_when": "Circular Barplot is a variation of the well-known bar chart where bars are displayed along a circle instead of a straight line. Note that while visually appealing, circular bar charts must be used with caution because the groups do not share the same Y-axis. However, they are well-suited for periodic data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/CircularBarplot.html", - "skill": "# Skill: Circular Barplot (R)\n\n## Category\nRanking\n\n## When to Use\nCircular Barplot is a variation of the well-known bar chart where bars are displayed along a circle instead of a straight line. Note that while visually appealing, circular bar charts must be used with caution because the groups do not share the same Y-axis. However, they are well-suited for periodic data.\n\n## Required R Packages\n- tidyverse\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(tidyverse)\n\n# Prepare data\n# 1.R's built-in data—iris\nhead(iris)\n\n# 2.Self-built dataset\ndata_customize <- data.frame(\n individual=paste( \"Mister \", seq(1,60), sep=\"\"),\n group=c( rep('A', 10), rep('B', 30), rep('C', 14), rep('D', 6)) ,\n value=sample( seq(10,100), 60, replace=T)\n)\n\n# 3.TCGA database (gene expression data for liver cancer)\ntcga_circle <- readr::read_csv(\n\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/tcga_circle.csv\")\n\n# Create visualization\niris_id <- iris[order(iris$Species),]\niris_id$new_column <- 1:nrow(iris_id)\np <- ggplot(iris_id, aes(x = new_column, y = Sepal.Length, fill = Species)) +\n geom_bar(stat = \"identity\", width = 1) +\n coord_polar(start = 0) +\n theme_void() + \n labs(fill = \"Species\", y = \"Sepal.Length\", x = NULL) +\n theme(legend.title = element_blank()) \n\np\n```\n\n## Key Parameters\n- `x`: Maps `title` to the x aesthetic\n- `y`: Maps `value` to the y aesthetic\n- `fill`: Maps `group` to the fill aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `width`: Controls element width\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_void()`\n\n## Tips\n- The tutorial includes a '3. Beautify plot' section with advanced styling options\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Sort categories by value rather than alphabetically for clearer ranking visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Ranking/CircularBarplot.html\n", - "source_file": "Ranking/CircularBarplot.qmd", - "skill_file": "skills/Ranking/CircularBarplot_skill.md" - }, - { - "name": "Lollipop Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "cowplot", - "ggalt", - "ggplot2", - "ggpubr", - "hrbrthemes", - "palmerpenguins", - "rstatix", - "tidyr" - ], - "use_when": "A lollipop plot is a variation of a bar chart and a scatter plot. It consists of a line segment and a point, which can clearly display data while reducing the amount of graphics. At the same time, the lollipop plot can help align values with categories and is very suitable for comparing the differences between values of multiple categories.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/Lollipop.html", - "skill": "# Skill: Lollipop Plot (R)\n\n## Category\nRanking\n\n## When to Use\nA lollipop plot is a variation of a bar chart and a scatter plot. It consists of a line segment and a point, which can clearly display data while reducing the amount of graphics. At the same time, the lollipop plot can help align values with categories and is very suitable for comparing the differences between values of multiple categories.\n\n## Required R Packages\n- cowplot\n- ggalt\n- ggplot2\n- ggpubr\n- hrbrthemes\n- palmerpenguins\n- rstatix\n- tidyr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(cowplot)\nlibrary(ggalt)\nlibrary(ggplot2)\nlibrary(ggpubr)\nlibrary(hrbrthemes)\nlibrary(palmerpenguins)\n\n# Prepare data\ndata_TCGA <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-BRCA.htseq_counts_processed.csv\")\n\ndata_TCGA1 <- data_TCGA[1:25,] %>%\n gather(key = \"sample\",value = \"gene_expression\",3:1219)\n\ndata_tcga_mean <- aggregate(data_TCGA1$gene_expression, \n by=list(data_TCGA1$gene_name), mean) # mean\ncolnames(data_tcga_mean) <- c(\"gene\",\"expression\")\n\ndata_tcga_sd <- aggregate(data_TCGA1$gene_expression, \n by=list(data_TCGA1$gene_name), sd)\ncolnames(data_tcga_sd) <- c(\"gene\",\"sd\")\n\ndata_tcga <- merge(data_tcga_mean, data_tcga_sd, by=\"gene\")\n\ndata_penguins <- penguins\n\ndata_penguins_mean <- aggregate(data_penguins$flipper_length_mm, \n by=list(data_penguins$species,data_penguins$sex), \n mean)\ncolnames(data_penguins_mean) <- c(\"species\",\"sex\",\"flipper_length\")\n\n# Convert long format data to wide format\ndata_penguins_mean <- spread(data_penguins_mean, key=\"sex\", value=\"flipper_length\")\n\nrow_mean = apply(data_penguins_mean[,2:3],1,mean)\n\ndata_penguins_mean$mean <- row_mean\n\n# Create visualization\n# `TCGA` data\np <- ggplot(data_tcga, aes(x=gene, y=expression)) +\n geom_point() + \n geom_segment( aes(x=gene, xend=gene, y=0, yend=expression)) +\n theme(axis.text.x = element_text(angle = 30,vjust = 0.85,hjust = 0.85))\n\np\n```\n\n## Key Parameters\n- `x`: Maps `mean` to the x aesthetic\n- `y`: Maps `species` to the y aesthetic\n- `size`: Maps `mean` to the size aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `stat`: Statistical transformation to use\n- `theme`: Plot theme; tutorial uses `theme_light()`\n\n## Tips\n- The tutorial includes a '2. Customize appearance' section with advanced styling options\n- Use `coord_flip()` for horizontal orientation when labels are long\n- Sort categories by value rather than alphabetically for clearer ranking visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Ranking/Lollipop.html\n", - "source_file": "Ranking/Lollipop.qmd", - "skill_file": "skills/Ranking/Lollipop_skill.md" - }, - { - "name": "Parallel Coordinates Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "GGally", - "MASS", - "RColorBrewer", - "dplyr", - "ggbump", - "hrbrthemes", - "patchwork", - "tibble", - "tidyr", - "viridis" - ], - "use_when": "Parallel coordinate plots are a common method for visualizing high-dimensional multivariate data. To display a set of objects in a multidimensional space, multiple parallel and equally spaced axes are drawn, and the objects in the multidimensional space are represented as broken lines with vertices on the parallel axes. Although parallel line plots are a special type of line plot, they differ significantly from ordinary line plots. This is because parallel line plots are not limited to descri...", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/Parallel.html", - "skill": "# Skill: Parallel Coordinates Plot (R)\n\n## Category\nRanking\n\n## When to Use\nParallel coordinate plots are a common method for visualizing high-dimensional multivariate data. To display a set of objects in a multidimensional space, multiple parallel and equally spaced axes are drawn, and the objects in the multidimensional space are represented as broken lines with vertices on the parallel axes. Although parallel line plots are a special type of line plot, they differ significantly from ordinary line plots. This is because parallel line plots are not limited to descri...\n\n## Required R Packages\n- GGally\n- MASS\n- RColorBrewer\n- dplyr\n- ggbump\n- hrbrthemes\n- patchwork\n- tibble\n- tidyr\n- viridis\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(GGally)\nlibrary(MASS)\nlibrary(RColorBrewer)\nlibrary(dplyr)\nlibrary(ggbump)\nlibrary(hrbrthemes)\n\n# Prepare data\n# iris\ndata_iris <- iris\ndata_iris <- data_iris %>%\n group_by(Species) %>%\n sample_n(size = 20, replace = FALSE)\n\n# TCGA-CHOL.methylation450\nmethylation_raw <- readr::read_tsv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-CHOL.methylation450_.tsv\")\nmethylation_selected <- methylation_raw[c(5,7,11),c(4:6)]\nrownames(methylation_selected) <- c(\"cg236\", \"cg292\", \"cg658\")\ncolnames(methylation_selected) <- substr(colnames(methylation_selected), 9, 12)\ndata_tcga <- methylation_selected %>%\n rownames_to_column(var = \"Composite\") %>%\n pivot_longer(cols = -Composite, names_to = \"sample\", values_to = \"value\")\ndata_tcga <- data_tcga %>%\n mutate(sample = as.numeric(factor(sample))) # Convert the sample to a numerical value\n\n# Create visualization\n# Basic parallel graph\np <- ggparcoord(data_iris, columns = 1:4, groupColumn = 5) \n\np\n```\n\n## Key Parameters\n- `x`: Maps `sample` to the x aesthetic\n- `y`: Maps `value` to the y aesthetic\n- `color`: Maps `Composite` to the color aesthetic\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `theme`: Plot theme; tutorial uses `theme_ipsum()`\n\n## Tips\n- Use `theme_minimal()` or `theme_bw()` for clean, publication-ready plots\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Sort categories by value rather than alphabetically for clearer ranking visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Ranking/Parallel.html\n", - "source_file": "Ranking/Parallel.qmd", - "skill_file": "skills/Ranking/Parallel_skill.md" - }, - { - "name": "Radar/Spider Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "fmsb" - ], - "use_when": "A radar chart, spider chart, or web chart is a two-dimensional chart type used to plot a series of values over one or more quantitative variables. The fmsb library is an excellent tool for building this type of chart in R.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/Radar.html", - "skill": "# Skill: Radar/Spider Plot (R)\n\n## Category\nRanking\n\n## When to Use\nA radar chart, spider chart, or web chart is a two-dimensional chart type used to plot a series of values over one or more quantitative variables. The fmsb library is an excellent tool for building this type of chart in R.\n\n## Required R Packages\n- fmsb\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(fmsb)\n\n# Prepare data\n# 1.R built-in data - iris\nhead(iris)\n\n# 2.Self-built dataset\n## Here we create a data set about the performance of three students in different subjects\nset.seed(99) \ndata <- as.data.frame(matrix( sample( 0:20 , 15 , replace=F) , ncol=5))\ncolnames(data) <- c(\"math\" , \"english\" , \"biology\" , \"music\" , \"R-coding\" )\nrownames(data) <- paste(\"mister\" , letters[1:3] , sep=\"-\")\ndata <- rbind(rep(20,5) , rep(0,5) , data) \n\n# 3.TCGA database (gene expression data of liver cancer)\ntcga_group_radar <- readr::read_csv(\n\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/tcga_group_radar.csv\")\ntcga_simple_bar <- data.frame(tcga_group_radar[3,])\n\n# Create visualization\n# Data collation\niris_setosa <- iris[c(1:50),]\niris_setosa <- iris_setosa[,-5]\niris_setosa_radar <- rbind(rep(6,4),rep(0,4),iris_setosa)\n# plot\npar(mar = c(1, 1, 1, 1))\nradarchart(iris_setosa_radar)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Sort categories by value rather than alphabetically for clearer ranking visualization\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Ranking/Radar.html\n", - "source_file": "Ranking/Radar.qmd", - "skill_file": "skills/Ranking/Radar_skill.md" - }, - { - "name": "Table", - "category": "Ranking", - "language": "R", - "packages": [ - "dplyr", - "gt", - "gtExtras", - "readr" - ], - "use_when": "Tables are both a visual communication mode and a means of organizing and collating data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/Table.html", - "skill": "# Skill: Table (R)\n\n## Category\nRanking\n\n## When to Use\nTables are both a visual communication mode and a means of organizing and collating data.\n\n## Required R Packages\n- dplyr\n- gt\n- gtExtras\n- readr\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(gt)\nlibrary(gtExtras)\nlibrary(readr)\n\n# Prepare data\n# 1.Select the first 7 rows of the iris dataset\ndata <- iris[1:7,]\n\nhead(data)\n\n# 2.The first 7 rows of clinical data on gastric cancer from the UCSC Xena database (this clinical data was only used when creating the three-line table).\ndata_clinical <- read.table(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/TCGA-STAD.survival.tsv\", header = TRUE, sep = \"\\t\")\ndata_clinical <- data_clinical[1:7,]\n\nhead(data_clinical)\n\n# Create visualization\n# You can draw the graph by calling the gt() function.\ngt(data)\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `position`: Position adjustment (identity, dodge, stack, fill)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Sort categories by value rather than alphabetically for clearer ranking visualization\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Ranking/Table.html\n", - "source_file": "Ranking/Table.qmd", - "skill_file": "skills/Ranking/Table_skill.md" - }, - { - "name": "Upset Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "UpSetR", - "ggupset" - ], - "use_when": "The Upset diagram is similar to the Venn diagram, mainly showing the number of elements in the intersection of different sets. However, when the number of sets in the Venn diagram reaches 5, the readability begins to drop sharply. The Upset diagram can well solve the problem of poor readability of the Venn diagram and can also provide additional statistical information on element properties.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/UpsetPlot.html", - "skill": "# Skill: Upset Plot (R)\n\n## Category\nRanking\n\n## When to Use\nThe Upset diagram is similar to the Venn diagram, mainly showing the number of elements in the intersection of different sets. However, when the number of sets in the Venn diagram reaches 5, the readability begins to drop sharply. The Upset diagram can well solve the problem of poor readability of the Venn diagram and can also provide additional statistical information on element properties.\n\n## Required R Packages\n- UpSetR\n- ggupset\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(UpSetR)\nlibrary(ggupset)\n\n# Prepare data\n# UpSetR can accept three formats of data. The first is a list with named vectors (see listInput variable), the second is an expression vector (see expressionInput variable), and the third is a data frame consisting of 0,1 (see movies and mutations variables)\n# Reading CSV data\n# The list format requires each vector in the list to be a set. UpSetR requires each set to be named, and the elements in the vector are members of the corresponding set. When using the upset function to draw, you need to use the fromList function to convert the list data format.\nlistInput <- list(one = c(1, 2, 3, 5, 7, 8, 11, 12, 13), two = c(1, 2, 4, 5, 10), three = c(1, 5, 6, 7, 8, 9, 10, 12, 13))\n# The expression format accepts a vector of expressions. The elements of the expression vector are the names of the sets in the intersection (separated by &), and the numeric elements in the intersection. When using the upset function to draw, you need to use the fromExpression function to convert the list data format.\nexpressionInput <- c(one = 2, two = 1, three = 2, `one&two` = 1, `one&three` = 4, `two&three` = 1, `one&two&three` = 2)\n\n# In the data frame format, each column is a set and each row is an element. The data frame is required to consist of 0 and 1, which respectively indicate whether the element exists in the set. When a column has a value other than 0 or 1, the column is considered to be an attribute of the element.\nmovies <- read.csv( system.file(\"extdata\", \"movies.csv\", package = \"UpSetR\"), header=T, sep=\";\" )\nmutations <- read.csv( system.file(\"extdata\", \"mutations.csv\", package = \"UpSetR\"), header=T, sep = \",\")\n\n# Create visualization\n# Use the above three data types to draw the Upset graph\nupset(fromList(listInput))\nupset(fromExpression(expressionInput))\nupset(movies)\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- The tutorial includes a '3. Advanced Upset Plot' section with advanced styling options\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Sort categories by value rather than alphabetically for clearer ranking visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Ranking/UpsetPlot.html\n", - "source_file": "Ranking/UpsetPlot.qmd", - "skill_file": "skills/Ranking/UpsetPlot_skill.md" - }, - { - "name": "Veen Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "VennDiagram", - "ggVennDiagram", - "ggplot2" - ], - "use_when": "For the visualization of Venn diagrams, the commonly used R packages are ggVennDiagram and VennDiagram. Compared with the VennDiagram package, ggVennDiagram has the advantages of being applicable to more groups, adapting to ggplot2 syntax, and flexibly setting output formats, and is easier to learn and post-process. However, the set color of ggVennDiagram can only be set to a continuous gradient color related to the number of elements, and cannot be set to a discrete color with one color for...", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/VennPlot.html", - "skill": "# Skill: Veen Plot (R)\n\n## Category\nRanking\n\n## When to Use\nFor the visualization of Venn diagrams, the commonly used R packages are ggVennDiagram and VennDiagram. Compared with the VennDiagram package, ggVennDiagram has the advantages of being applicable to more groups, adapting to ggplot2 syntax, and flexibly setting output formats, and is easier to learn and post-process. However, the set color of ggVennDiagram can only be set to a continuous gradient color related to the number of elements, and cannot be set to a discrete color with one color for...\n\n## Required R Packages\n- VennDiagram\n- ggVennDiagram\n- ggplot2\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(VennDiagram)\nlibrary(ggVennDiagram)\nlibrary(ggplot2)\n\n# Prepare data\ngenes <- paste(\"gene\",1:1000,sep=\"\")\nset.seed(123)\nx <- list(A=sample(genes,300),\n B=sample(genes,525),\n C=sample(genes,440),\n D=sample(genes,350))\n\n# Create visualization\n# Basic Venn Diagram\nggVennDiagram(x)\n```\n\n## Key Parameters\n- `alpha`: Controls transparency (0 = fully transparent, 1 = opaque)\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- The tutorial includes a '2. Beautify the Venn diagram' section with advanced styling options\n- Customize color scales with `scale_fill_manual()` or `scale_color_brewer()`\n- Sort categories by value rather than alphabetically for clearer ranking visualization\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Ranking/VennPlot.html\n", - "source_file": "Ranking/VennPlot.qmd", - "skill_file": "skills/Ranking/VennPlot_skill.md" - }, - { - "name": "Wordcloud", - "category": "Ranking", - "language": "R", - "packages": [ - "dplyr", - "htmlwidgets", - "jiebaR", - "jiebaRD", - "tidyverse", - "webshot2", - "wordcloud2" - ], - "use_when": "A word cloud is a visual representation of text words, which allows you to clearly see the keywords (high-frequency words) in a large amount of text data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/Wordcloud.html", - "skill": "# Skill: Wordcloud (R)\n\n## Category\nRanking\n\n## When to Use\nA word cloud is a visual representation of text words, which allows you to clearly see the keywords (high-frequency words) in a large amount of text data.\n\n## Required R Packages\n- dplyr\n- htmlwidgets\n- jiebaR\n- jiebaRD\n- tidyverse\n- webshot2\n- wordcloud2\n\n## Minimal Reproducible Code\n```r\n# Load packages\nlibrary(dplyr)\nlibrary(htmlwidgets)\nlibrary(jiebaR)\nlibrary(jiebaRD)\nlibrary(tidyverse)\nlibrary(webshot2)\n\n# Prepare data\n# 1.Chinese abstract text\nwords <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/words.txt\",header = FALSE,sep=\"\\n\")\nwords <- as.character(words)\n\nhead_words <- substr(words, start = 1, stop = 20)\n\nhead_words\n\n# 2.demoFreq dataset\ndata <- demoFreq\n\nhead(data)\n\n# 3.English abstract text\nwords_english <- read.csv(\"https://bizard-1301043367.cos.ap-guangzhou.myqcloud.com/words_english.txt\",header = FALSE,sep=\"\\n\")\n\nwords_english <- as.character(words_english)\n\nhead_words_english <- substr(words_english, start = 1, stop = 20)\n\nhead_words_english\n\n# Create visualization\n# Basic Plotting\nBasicPlot <- wordcloud2(data = words_seg, size = 1)\nBasicPlot\n```\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- Sort categories by value rather than alphabetically for clearer ranking visualization\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/Ranking/Wordcloud.html\n", - "source_file": "Ranking/Wordcloud.qmd", - "skill_file": "skills/Ranking/Wordcloud_skill.md" - }, - { - "name": "About Us", - "category": "Misc", - "language": "R", - "packages": [], - "use_when": "Create a About Us visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/About.html", - "skill": "# Skill: About Us (R)\n\n## Category\nMisc\n\n## When to Use\nCreate a About Us visualization in R for biomedical data analysis and research publications.\n\n## Required R Packages\n- (see tutorial)\n\n## Minimal Reproducible Code\n(See full tutorial for code)\n\n## Key Parameters\n- `fill`: Maps a variable to fill color for group comparison\n- `color`: Maps a variable to outline/point color\n\n## Tips\n- Adjust text size with `theme(text = element_text(size = 14))` for presentations\n- See the full tutorial for additional customization options and advanced examples\n\n## Full Tutorial\nhttps://openbiox.github.io/Bizard/About.html\n", - "source_file": "About.qmd", - "skill_file": "skills/Misc/About_skill.md" - } -] \ No newline at end of file diff --git a/skills/index.json b/skills/index.json deleted file mode 100644 index 041bbac15b..0000000000 --- a/skills/index.json +++ /dev/null @@ -1,3965 +0,0 @@ -[ - { - "name": "Animation", - "category": "Animation", - "language": "R", - "packages": [ - "Cairo", - "babynames", - "dplyr", - "gapminder", - "gganimate", - "ggplot2", - "gifski", - "hrbrthemes", - "tidyr", - "viridis" - ], - "use_when": "Create a Animation visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Animation/Animation.html", - "source_file": "Animation/Animation.qmd", - "skill_file": "skills/Animation/Animation_skill.md" - }, - { - "name": "Interactivity", - "category": "Animation", - "language": "R", - "packages": [ - "chorddiag", - "d3heatmap", - "dygraphs", - "gapminder", - "ggiraph", - "htmlwidgets", - "patchwork", - "plotly", - "streamgraph", - "tidyverse", - "webshot", - "xts" - ], - "use_when": "Interactive charts allow users to perform actions: zoom, hover the mouse over markers for tooltips, select variables to display, and so on. R provides a set of packages called HTML widgets: these allow you to build interactive data visualizations directly from R.", - "tutorial_url": "https://openbiox.github.io/Bizard/Animation/Interactivity.html", - "source_file": "Animation/Interactivity.qmd", - "skill_file": "skills/Animation/Interactivity_skill.md" - }, - { - "name": "Kaplan Meier Plot", - "category": "Clinics", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "patchwork", - "survival", - "survminer", - "tidyr", - "zoo" - ], - "use_when": "Create a Kaplan Meier Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/KaplanMeierPlot.html", - "source_file": "Clinics/KaplanMeierPlot.qmd", - "skill_file": "skills/Clinics/KaplanMeierPlot_skill.md" - }, - { - "name": "Lollipop Plot", - "category": "Clinics", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "ggpubr", - "patchwork" - ], - "use_when": "Create a Lollipop Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/LollipopPlot.html", - "source_file": "Clinics/LollipopPlot.qmd", - "skill_file": "skills/Clinics/LollipopPlot_skill.md" - }, - { - "name": "Meta-Analysis Forest Plot", - "category": "Clinics", - "language": "R", - "packages": [ - "dplyr", - "forestplot", - "ggplot2", - "grid", - "meta", - "metafor", - "tidyr" - ], - "use_when": "Create a Meta-Analysis Forest Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/MetaForestPlot.html", - "source_file": "Clinics/MetaForestPlot.qmd", - "skill_file": "skills/Clinics/MetaForestPlot_skill.md" - }, - { - "name": "Mosaic Plot", - "category": "Clinics", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "plyr", - "reshape2", - "tidyr", - "vcd", - "wesanderson" - ], - "use_when": "Create a Mosaic Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/MosaicPlot.html", - "source_file": "Clinics/MosaicPlot.qmd", - "skill_file": "skills/Clinics/MosaicPlot_skill.md" - }, - { - "name": "Nomogram", - "category": "Clinics", - "language": "R", - "packages": [ - "readr", - "regplot", - "rms", - "survival" - ], - "use_when": "Simply put, a nomogram graphically displays the results of logistic regression or Cox regression. It uses the regression coefficient of each independent variable to develop a scoring criteria, assigning a score to each independent variable value. A total score is then calculated for each patient, and a conversion function is used to convert this score into the probability of a specific outcome for that patient.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/Nomogram.html", - "source_file": "Clinics/Nomogram.qmd", - "skill_file": "skills/Clinics/Nomogram_skill.md" - }, - { - "name": "Regression Analysis Table", - "category": "Clinics", - "language": "R", - "packages": [ - "broom.helpers", - "datawizard", - "dplyr", - "gtsummary", - "survival" - ], - "use_when": "The regression analysis table is used to display the results of the regression model. It provides statistical information about the variables in the model and helps explain the relationship between the variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Clinics/RegressionTable.html", - "source_file": "Clinics/RegressionTable.qmd", - "skill_file": "skills/Clinics/RegressionTable_skill.md" - }, - { - "name": "Circular Packing Chart", - "category": "Composition", - "language": "R", - "packages": [ - "circlepackeR", - "cowplot", - "data.tree", - "dplyr", - "flare", - "ggiraph", - "ggplot2", - "ggraph", - "htmlwidgets", - "igraph", - "packcircles", - "tidyr", - "tidyverse", - "viridis" - ], - "use_when": "Circular Packing can be viewed as a special type of classification tree diagram, which is particularly suitable for displaying classification data with hierarchical relationships.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/CircularPacking.html", - "source_file": "Composition/CircularPacking.qmd", - "skill_file": "skills/Composition/CircularPacking_skill.md" - }, - { - "name": "Dendrogram", - "category": "Composition", - "language": "R", - "packages": [ - "collapsibleTree", - "dendextend", - "ggraph", - "igraph", - "tidyverse" - ], - "use_when": "A dendrogram is a graphical representation of hierarchical relationships between objects. It is widely used in cluster analysis, especially hierarchical clustering, to visualize the similarity or distance between data points.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/Dendrogram.html", - "source_file": "Composition/Dendrogram.qmd", - "skill_file": "skills/Composition/Dendrogram_skill.md" - }, - { - "name": "Donut Chart", - "category": "Composition", - "language": "R", - "packages": [ - "ggplot2" - ], - "use_when": "A donut chart is a circular plot divided into sectors, each sector representing a part of the whole. It is very similar to a pie chart and can be constructed in ggplot2 and basic R.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/Donut.html", - "source_file": "Composition/Donut.qmd", - "skill_file": "skills/Composition/Donut_skill.md" - }, - { - "name": "Grouped and Stacked Barplot", - "category": "Composition", - "language": "R", - "packages": [ - "RColorBrewer", - "dplyr", - "ggplot2", - "hrbrthemes", - "streamgraph", - "tibble", - "tidyr", - "viridis" - ], - "use_when": "Grouped bar charts, or clustered bar charts, extend the functionality of univariate or single-category bar charts to multivariate bar charts. In these charts, bars are grouped according to their categories, and colors represent distinguishing factors for other categorical variables. The bars are positioned to cater to a group or primary group, with colors representing secondary categories. Grouped bar charts are particularly suitable for displaying the distribution of multiple groups of categ...", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/GroupedBarplot.html", - "source_file": "Composition/GroupedBarplot.qmd", - "skill_file": "skills/Composition/GroupedBarplot_skill.md" - }, - { - "name": "Part highlights the pie chart", - "category": "Composition", - "language": "R", - "packages": [ - "dplyr", - "ggforce", - "ggplot2", - "ggpubr", - "patchwork", - "plotrix" - ], - "use_when": "Create a Part highlights the pie chart visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/PartPieChart.html", - "source_file": "Composition/PartPieChart.qmd", - "skill_file": "skills/Composition/PartPieChart_skill.md" - }, - { - "name": "Pie Chart", - "category": "Composition", - "language": "R", - "packages": [ - "ggplot2" - ], - "use_when": "A pie chart is a basic chart in statistics, using sectors of different sizes to represent the magnitude of each item. A pie chart provides a visual understanding of the proportion of each data point within the overall data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/PieChart.html", - "source_file": "Composition/PieChart.qmd", - "skill_file": "skills/Composition/PieChart_skill.md" - }, - { - "name": "Treemap", - "category": "Composition", - "language": "R", - "packages": [ - "DOSE", - "palmerpenguins", - "tidyverse", - "treemap" - ], - "use_when": "A treemap, also known as a rectangular tree structure diagram, is composed of multiple nested rectangles of varying areas. The sum of the areas of all rectangles represents the overall data. The area of each smaller rectangle represents the proportion of each sub-item; the larger the rectangle's area, the larger the proportion of that sub-item within the whole.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/Treemap.html", - "source_file": "Composition/Treemap.qmd", - "skill_file": "skills/Composition/Treemap_skill.md" - }, - { - "name": "Waffle Chart", - "category": "Composition", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "waffle" - ], - "use_when": "A waffle chart visually represents categorical data using a grid of small squares that resemble waffles. Each category is assigned a unique color, and the number of squares assigned to each category corresponds to its proportion in the total data count.", - "tutorial_url": "https://openbiox.github.io/Bizard/Composition/Waffle.html", - "source_file": "Composition/Waffle.qmd", - "skill_file": "skills/Composition/Waffle_skill.md" - }, - { - "name": "Biplot", - "category": "Correlation", - "language": "R", - "packages": [ - "dplyr", - "ggbiplot" - ], - "use_when": "Create a Biplot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Biplot.html", - "source_file": "Correlation/Biplot.qmd", - "skill_file": "skills/Correlation/Biplot_skill.md" - }, - { - "name": "Bubble Plot", - "category": "Correlation", - "language": "R", - "packages": [ - "dplyr", - "gapminder", - "ggplot2", - "hrbrthemes", - "viridis" - ], - "use_when": "A bubble plot is a scatter plot in which a third numeric variable is mapped to the size of the circles. This article shows several ways to build bubble charts using R.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Bubble.html", - "source_file": "Correlation/Bubble.qmd", - "skill_file": "skills/Correlation/Bubble_skill.md" - }, - { - "name": "ComplexHeatmap", - "category": "Correlation", - "language": "R", - "packages": [ - "ComplexHeatmap", - "circlize", - "dendextend", - "gridExtra", - "pheatmap", - "tidyr" - ], - "use_when": "Create a ComplexHeatmap visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/ComplexHeatmap.html", - "source_file": "Correlation/ComplexHeatmap.qmd", - "skill_file": "skills/Correlation/ComplexHeatmap_skill.md" - }, - { - "name": "Connected Scatter", - "category": "Correlation", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "stringr" - ], - "use_when": "Connected scatter is a type of chart that builds upon scatter by adding lines to connect the data points in a certain order. It allows us to discern not only the correlation between independent variable and dependent variable but also the trend in the data points.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/ConnectedScatter.html", - "source_file": "Correlation/ConnectedScatter.qmd", - "skill_file": "skills/Correlation/ConnectedScatter_skill.md" - }, - { - "name": "Correlogram", - "category": "Correlation", - "language": "R", - "packages": [ - "GGally", - "corrgram", - "corrplot", - "ggcorrplot" - ], - "use_when": "Correlogram or Correlation diagrams are often used to summarize the correlation information of various groups of data in the entire dataset.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Correlogram.html", - "source_file": "Correlation/Correlogram.qmd", - "skill_file": "skills/Correlation/Correlogram_skill.md" - }, - { - "name": "2D Density", - "category": "Correlation", - "language": "R", - "packages": [ - "MASS", - "RColorBrewer", - "ggplot2", - "hexbin", - "mvtnorm", - "patchwork", - "plotly" - ], - "use_when": "A 2D density plot shows the distribution of a combination of two numerical variables, using color gradients (or contour lines) to indicate the number of observations within an area. This can be used to identify trends in a dataset and analyze relationships between two variables. Scatter plots can be difficult to interpret when displaying large datasets because the points overlap and cannot be individually distinguished. In these cases, a two-dimensional density plot is useful.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Density2D.html", - "source_file": "Correlation/Density2D.qmd", - "skill_file": "skills/Correlation/Density2D_skill.md" - }, - { - "name": "Heatmap", - "category": "Correlation", - "language": "R", - "packages": [ - "ComplexHeatmap", - "RColorBrewer", - "circlize", - "cowplot", - "d3heatmap", - "dplyr", - "ggplot2", - "gridExtra", - "heatmaply", - "hrbrthemes", - "htmlwidgets", - "lattice", - "pheatmap", - "plotly", - "readr", - "tibble", - "tidyr", - "tidyverse", - "viridis" - ], - "use_when": "A heatmap is a powerful visualization tool that represents matrix values through color gradients. It is widely used to illustrate gene expression differences across sample groups, variations in compound concentrations, and pairwise sample similarities. More broadly, any tabular dataset can be structured into a heatmap to enhance interpretability.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Heatmap.html", - "source_file": "Correlation/Heatmap.qmd", - "skill_file": "skills/Correlation/Heatmap_skill.md" - }, - { - "name": "PCA Plot", - "category": "Correlation", - "language": "R", - "packages": [ - "FactoMineR", - "dplyr", - "factoextra", - "ggfortify", - "ggplot2" - ], - "use_when": "Create a PCA Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/PCAplot.html", - "source_file": "Correlation/PCAplot.qmd", - "skill_file": "skills/Correlation/PCAplot_skill.md" - }, - { - "name": "Scatter Plot", - "category": "Correlation", - "language": "R", - "packages": [ - "dplyr", - "geomtextpath", - "ggExtra", - "ggplot2", - "ggpmisc", - "ggpubr", - "plotly" - ], - "use_when": "A scatter plot is a basic visualization chart used to represent the general trend of the dependent variable changing with the independent variable.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/Scatter.html", - "source_file": "Correlation/Scatter.qmd", - "skill_file": "skills/Correlation/Scatter_skill.md" - }, - { - "name": "Ternary chart", - "category": "Correlation", - "language": "R", - "packages": [ - "ggtern", - "ggthemes" - ], - "use_when": "A ternary chart is a type of chart used to display the proportional relationship between three variables. These three variables typically represent a certain component (such as chemical composition, species ratio, nutritional structure, etc.), and their sum is a constant, with the most common being 1 or 100%. A ternary chart uses an equilateral triangle to represent the proportional relationship between these three variables, with each point's position reflecting the relative proportion of th...", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/TernaryPlot.html", - "source_file": "Correlation/TernaryPlot.qmd", - "skill_file": "skills/Correlation/TernaryPlot_skill.md" - }, - { - "name": "UMAP Plot", - "category": "Correlation", - "language": "R", - "packages": [ - "RColorBrewer", - "Seurat", - "SeuratData", - "dplyr", - "ggplot2", - "mlbench", - "patchwork", - "umap" - ], - "use_when": "Create a UMAP Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Correlation/UMAPplot.html", - "source_file": "Correlation/UMAPplot.qmd", - "skill_file": "skills/Correlation/UMAPplot_skill.md" - }, - { - "name": "Area Chart", - "category": "DataOverTime", - "language": "R", - "packages": [ - "dygraphs", - "ggpattern", - "hrbrthemes", - "tidyverse", - "viridis", - "xts" - ], - "use_when": "An area chart is a line chart in which the area below the line is filled with color. It is mainly used to display values at continuous intervals or over a time span.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/AreaChart.html", - "source_file": "DataOverTime/AreaChart.qmd", - "skill_file": "skills/DataOverTime/AreaChart_skill.md" - }, - { - "name": "Calend Highlight", - "category": "DataOverTime", - "language": "R", - "packages": [ - "calendR" - ], - "use_when": "Date highlighting marks are mainly used to display changes in data within certain specific date ranges in time series data, and can be used for an overview of activity frequencies and marking of special dates.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/CalendHighlight.html", - "source_file": "DataOverTime/CalendHighlight.qmd", - "skill_file": "skills/DataOverTime/CalendHighlight_skill.md" - }, - { - "name": "Line Chart", - "category": "DataOverTime", - "language": "R", - "packages": [ - "dplyr", - "gghighlight", - "ggplot2", - "ggpmisc", - "patchwork", - "viridis" - ], - "use_when": "Drawing line segments in various charts is common, and this module will draw all kinds of line segments that may be used.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/LineChart.html", - "source_file": "DataOverTime/LineChart.qmd", - "skill_file": "skills/DataOverTime/LineChart_skill.md" - }, - { - "name": "Stacked Area Chart", - "category": "DataOverTime", - "language": "R", - "packages": [ - "babynames", - "dplyr", - "ggplot2", - "hrbrthemes", - "plotly", - "tidyverse", - "viridis" - ], - "use_when": "Stacked area charts are similar to basic area charts, except that each dataset in the chart starts from the previous dataset and is used to show the trend line of how the size of each value changes over time or category, demonstrating the relationship between the part and the whole.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/StackedArea.html", - "source_file": "DataOverTime/StackedArea.qmd", - "skill_file": "skills/DataOverTime/StackedArea_skill.md" - }, - { - "name": "Streamgraph", - "category": "DataOverTime", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "ggstream", - "htmlwidgets", - "streamgraph" - ], - "use_when": "A Streamgraph is a stacked area diagram. It represents the evolution of numerical variables across multiple groups. Typically, it displays areas around a central axis with rounded edges to create a flowing shape.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/Streamgraph.html", - "source_file": "DataOverTime/Streamgraph.qmd", - "skill_file": "skills/DataOverTime/Streamgraph_skill.md" - }, - { - "name": "Timeseries", - "category": "DataOverTime", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "patchwork" - ], - "use_when": "A time series graph is a statistical chart with time on the horizontal axis and the observed variable on the vertical axis, reflecting the trend of the observed variable over time.", - "tutorial_url": "https://openbiox.github.io/Bizard/DataOverTime/Timeseries.html", - "source_file": "DataOverTime/Timeseries.qmd", - "skill_file": "skills/DataOverTime/Timeseries_skill.md" - }, - { - "name": "Beeswarm Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "beeswarm", - "ggbeeswarm", - "ggsignif", - "plyr", - "readr", - "tidyverse" - ], - "use_when": "A beeswarm plot disperses data points slightly to prevent overlap, making distribution density and trends clearer. It is especially useful for visualizing categorical data in small datasets. This section presents examples using R and the `beeswarm` and `ggbeeswarm` packages.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/Beeswarm.html", - "source_file": "Distribution/Beeswarm.qmd", - "skill_file": "skills/Distribution/Beeswarm_skill.md" - }, - { - "name": "Box Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "dplyr", - "ggExtra", - "ggplot2", - "ggpmisc", - "ggpubr", - "ggtext", - "hrbrthemes", - "readr", - "rstatix", - "viridis" - ], - "use_when": "Boxplots visualize the central tendency and dispersion of one or more sets of continuous quantitative data. They incorporate statistical measures that not only compare differences across categories but also reveal dispersion, outliers, and distribution patterns.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/BoxPlot.html", - "source_file": "Distribution/BoxPlot.qmd", - "skill_file": "skills/Distribution/BoxPlot_skill.md" - }, - { - "name": "Break Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "RColorBrewer", - "dplyr", - "ggbreak", - "ggplot2", - "ggpubr", - "rstatix" - ], - "use_when": "Create a Break Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/BreakPlot.html", - "source_file": "Distribution/BreakPlot.qmd", - "skill_file": "skills/Distribution/BreakPlot_skill.md" - }, - { - "name": "Density Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "cowplot", - "dplyr", - "geomtextpath", - "ggExtra", - "ggplot2", - "ggpmisc", - "ggpubr", - "hrbrthemes", - "readr", - "tidyr", - "viridis" - ], - "use_when": "A density plot represents the distribution of a numerical variable using kernel density estimation to display the probability density function. It is a smoothed version of a histogram, sharing the same concept but providing a clearer representation of the overall trend and shape of the data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/Density.html", - "source_file": "Distribution/Density.qmd", - "skill_file": "skills/Distribution/Density_skill.md" - }, - { - "name": "Histogram", - "category": "Distribution", - "language": "R", - "packages": [ - "cowplot", - "ggExtra", - "ggplot2", - "ggpmisc", - "ggpubr", - "readr", - "tidyverse", - "viridis" - ], - "use_when": "A histogram uses rectangular bars to represent the frequency of data within specific intervals, where the total area of the bars corresponds to the total frequency. It is primarily used to visualize the distribution of continuous variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/Histogram.html", - "source_file": "Distribution/Histogram.qmd", - "skill_file": "skills/Distribution/Histogram_skill.md" - }, - { - "name": "Radial Column Chart", - "category": "Distribution", - "language": "R", - "packages": [ - "dplyr", - "ggforce", - "ggplot2", - "scales" - ], - "use_when": "Create a Radial Column Chart visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/RadialColumnChart.html", - "source_file": "Distribution/RadialColumnChart.qmd", - "skill_file": "skills/Distribution/RadialColumnChart_skill.md" - }, - { - "name": "Ridgeline Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "dplyr", - "ggplot2", - "ggridges", - "hrbrthemes", - "readr", - "viridis" - ], - "use_when": "A ridgeline plot, also known as a joyplot, visualizes the distribution of multiple numeric variables across different categories. This method is useful for comparing density distributions while preserving an overall view of trends and variations.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/Ridgeline.html", - "source_file": "Distribution/Ridgeline.qmd", - "skill_file": "skills/Distribution/Ridgeline_skill.md" - }, - { - "name": "Violin Plot", - "category": "Distribution", - "language": "R", - "packages": [ - "dplyr", - "forcats", - "gghalves", - "ggplot2", - "ggpubr", - "ggstatsplot", - "hrbrthemes", - "palmerpenguins", - "readr", - "tidyr", - "viridis" - ], - "use_when": "A violin plot combines elements of a density plot and a box plot to visualize data distribution. It displays key statistical information, including the median, quartiles, minimum, and maximum values. Violin plots are particularly useful for comparing distributions across different groups, offering a more intuitive representation than traditional box plots by revealing the shape of the data distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/ViolinPlot.html", - "source_file": "Distribution/ViolinPlot.qmd", - "skill_file": "skills/Distribution/ViolinPlot_skill.md" - }, - { - "name": "Area Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The area chart displays graphically quantitative data. It is based on the line chart. The area between axis and line are commonly emphasized with colors, textures and hatchings.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/001-area.html", - "source_file": "Hiplot/001-area.qmd", - "skill_file": "skills/Hiplot/001-area_skill.md" - }, - { - "name": "Barcode Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Barcode Plot is Suitable for displaying the distribution of large amounts of data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/002-barcode-plot.html", - "source_file": "Hiplot/002-barcode-plot.qmd", - "skill_file": "skills/Hiplot/002-barcode-plot_skill.md" - }, - { - "name": "3D Barplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "plot3D" - ], - "use_when": "3D bar charts are used to provide a 3D look and feel for the data. The third dimension is often used for aesthetic reasons, but it does not improve data reading. Still intended to show comparisons between discrete categories.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/003-barplot-3d.html", - "source_file": "Hiplot/003-barplot-3d.qmd", - "skill_file": "skills/Hiplot/003-barplot-3d_skill.md" - }, - { - "name": "Barplot Color Group", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "stringr" - ], - "use_when": "The color group barplot can be used to display data values in groups, and to label different colors in sequence.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/004-barplot-color-group.html", - "source_file": "Hiplot/004-barplot-color-group.qmd", - "skill_file": "skills/Hiplot/004-barplot-color-group_skill.md" - }, - { - "name": "Barplot (errorbar)", - "category": "Hiplot", - "language": "R", - "packages": [ - "Rmisc", - "data.table", - "ggplot2", - "ggpubr", - "jsonlite" - ], - "use_when": "Bar plot with error-lines and groups.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/005-barplot-errorbar.html", - "source_file": "Hiplot/005-barplot-errorbar.qmd", - "skill_file": "skills/Hiplot/005-barplot-errorbar_skill.md" - }, - { - "name": "Barplot (errorbar2)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggpubr", - "grafify", - "jsonlite" - ], - "use_when": "Bar plot with error-lines and groups.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/006-barplot-errorbar2.html", - "source_file": "Hiplot/006-barplot-errorbar2.qmd", - "skill_file": "skills/Hiplot/006-barplot-errorbar2_skill.md" - }, - { - "name": "Barplot Gradient", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "stringr" - ], - "use_when": "It is similar to the bubble chart, but on the basis of the histogram, a color gradient rectangle is used to simultaneously display the visualization of two variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/008-barplot-gradient.html", - "source_file": "Hiplot/008-barplot-gradient.qmd", - "skill_file": "skills/Hiplot/008-barplot-gradient_skill.md" - }, - { - "name": "Multiple Barplot&Line", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite", - "reshape2" - ], - "use_when": "Displaying multiple bar or line plot in one diagram.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/009-barplot-line-multiple.html", - "source_file": "Hiplot/009-barplot-line-multiple.qmd", - "skill_file": "skills/Hiplot/009-barplot-line-multiple_skill.md" - }, - { - "name": "Barplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "Bar charts are used to display category data with rectangular bars whose height or length is proportional to the value they represent. Bar charts can be drawn vertically or horizontally. The bar chart shows the comparison between the discrete categories. One axis of the chart shows the specific categories to be compared, and the other axis represents the measurements. Some bar charts show bars that can also show the values of multiple measurement variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/010-barplot.html", - "source_file": "Hiplot/010-barplot.qmd", - "skill_file": "skills/Hiplot/010-barplot_skill.md" - }, - { - "name": "Beanplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "beanplot", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The beanplot is a method of visualizing the distribution characteristics.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/011-beanplot.html", - "source_file": "Hiplot/011-beanplot.qmd", - "skill_file": "skills/Hiplot/011-beanplot_skill.md" - }, - { - "name": "Beeswarm", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggbeeswarm", - "ggthemes", - "jsonlite" - ], - "use_when": "The beeswarm is a noninterference scatter plot which is similar to a bee colony.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/012-beeswarm.html", - "source_file": "Hiplot/012-beeswarm.qmd", - "skill_file": "skills/Hiplot/012-beeswarm_skill.md" - }, - { - "name": "Corrplot Big Data", - "category": "Hiplot", - "language": "R", - "packages": [ - "ComplexHeatmap", - "data.table", - "jsonlite" - ], - "use_when": "The correlation heat map is a graph that analyzes the correlation between two or more variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/013-big-corrplot.html", - "source_file": "Hiplot/013-big-corrplot.qmd", - "skill_file": "skills/Hiplot/013-big-corrplot_skill.md" - }, - { - "name": "Bivariate Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "GGally", - "data.table", - "jsonlite" - ], - "use_when": "Display the bivariate.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/014-bivariate.html", - "source_file": "Hiplot/014-bivariate.qmd", - "skill_file": "skills/Hiplot/014-bivariate_skill.md" - }, - { - "name": "Boxplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "ggthemes", - "jsonlite" - ], - "use_when": "The box plot is a method of visualizing the distribution characteristics of a set of data by means of a quartile graph.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/015-boxplot.html", - "source_file": "Hiplot/015-boxplot.qmd", - "skill_file": "skills/Hiplot/015-boxplot_skill.md" - }, - { - "name": "Bubble", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "stringr" - ], - "use_when": "The bubble chart is a statistical chart that shows the third variable by the size of the bubble on the basis of the scatter chart, so that the three variables can be compared and analyzed simultaneously.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/016-bubble.html", - "source_file": "Hiplot/016-bubble.qmd", - "skill_file": "skills/Hiplot/016-bubble_skill.md" - }, - { - "name": "Bumpchart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggbump", - "ggplot2", - "jsonlite" - ], - "use_when": "Bump chart can be used to display the change of grouped values.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/017-bumpchart.html", - "source_file": "Hiplot/017-bumpchart.qmd", - "skill_file": "skills/Hiplot/017-bumpchart_skill.md" - }, - { - "name": "Calibration Curve", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "rms", - "survival" - ], - "use_when": "The calibration curve is used to evaluate the consistency / calibration, i.e. the difference between the predicted value and the real value.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/018-calibration-curve.html", - "source_file": "Hiplot/018-calibration-curve.qmd", - "skill_file": "skills/Hiplot/018-calibration-curve_skill.md" - }, - { - "name": "Chi-square-fisher Test", - "category": "Hiplot", - "language": "R", - "packages": [ - "aplot", - "data.table", - "ggplot2", - "jsonlite", - "visdat" - ], - "use_when": "Chi-square and Fisher test can be used to test the frequency difference of categorical variables. The tool will automatically select the statistical method of Chi-square and Fisher exact test.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/019-chi-square-fisher.html", - "source_file": "Hiplot/019-chi-square-fisher.qmd", - "skill_file": "skills/Hiplot/019-chi-square-fisher_skill.md" - }, - { - "name": "Chord Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "circlize", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The complex interaction is visualized in the form of chord graph.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/020-chord.html", - "source_file": "Hiplot/020-chord.qmd", - "skill_file": "skills/Hiplot/020-chord_skill.md" - }, - { - "name": "Circle Packing", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "packcircles", - "viridis" - ], - "use_when": "Circle packing is a visualization method used to display the differences in quantity among different categories.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/021-circle-packing.html", - "source_file": "Hiplot/021-circle-packing.qmd", - "skill_file": "skills/Hiplot/021-circle-packing_skill.md" - }, - { - "name": "Circular Barplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "jsonlite" - ], - "use_when": "Drawing circular barplot", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/023-circular-barplot.html", - "source_file": "Hiplot/023-circular-barplot.qmd", - "skill_file": "skills/Hiplot/023-circular-barplot_skill.md" - }, - { - "name": "Circular Pie Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Another form of the pie chart.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/024-circular-pie-chart.html", - "source_file": "Hiplot/024-circular-pie-chart.qmd", - "skill_file": "skills/Hiplot/024-circular-pie-chart_skill.md" - }, - { - "name": "Complex Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "ComplexHeatmap", - "circlize", - "cowplot", - "data.table", - "ggplotify", - "hiplotlib", - "jsonlite", - "randomcoloR", - "stringr" - ], - "use_when": "A multi-omics plugins to draw heatmap, meta annotation, and mutations.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/025-complex-heatmap.html", - "source_file": "Hiplot/025-complex-heatmap.qmd", - "skill_file": "skills/Hiplot/025-complex-heatmap_skill.md" - }, - { - "name": "Connected Scatterplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "ggrepel", - "jsonlite" - ], - "use_when": "Connected scatterplot", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/026-connected-scatterplot.html", - "source_file": "Hiplot/026-connected-scatterplot.qmd", - "skill_file": "skills/Hiplot/026-connected-scatterplot_skill.md" - }, - { - "name": "Contour (Matrix)", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggisoband", - "ggplot2", - "jsonlite", - "reshape2" - ], - "use_when": "The contour map (matrix) is a graph that displays three-dimensional data in a two-dimensional form", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/027-contour-matrix.html", - "source_file": "Hiplot/027-contour-matrix.qmd", - "skill_file": "skills/Hiplot/027-contour-matrix_skill.md" - }, - { - "name": "Contour (XY)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggisoband", - "ggplot2", - "jsonlite" - ], - "use_when": "Contour plot (XY) is a data processing method that reflects data density through contour line.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/028-contour-xy.html", - "source_file": "Hiplot/028-contour-xy.qmd", - "skill_file": "skills/Hiplot/028-contour-xy_skill.md" - }, - { - "name": "Simplified Correlation Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "sigminer" - ], - "use_when": "Simplified variables correlation heatmap", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/029-cor-heatmap-simple.html", - "source_file": "Hiplot/029-cor-heatmap-simple.qmd", - "skill_file": "skills/Hiplot/029-cor-heatmap-simple_skill.md" - }, - { - "name": "Correlation Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggcorrplot", - "jsonlite" - ], - "use_when": "The correlation heat map is a graph that analyzes the correlation between two or more variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/030-cor-heatmap.html", - "source_file": "Hiplot/030-cor-heatmap.qmd", - "skill_file": "skills/Hiplot/030-cor-heatmap_skill.md" - }, - { - "name": "Corrplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "corrplot", - "data.table", - "ggcorrplot", - "ggplotify", - "jsonlite" - ], - "use_when": "The correlation heat map is a graph that analyzes the correlation between two or more variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/033-corrplot.html", - "source_file": "Hiplot/033-corrplot.qmd", - "skill_file": "skills/Hiplot/033-corrplot_skill.md" - }, - { - "name": "Custom Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Custom Heatmap, directly plot a heatmap based on the given data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/034-custom-heat-map.html", - "source_file": "Hiplot/034-custom-heat-map.qmd", - "skill_file": "skills/Hiplot/034-custom-heat-map_skill.md" - }, - { - "name": "Custom Icon Scatter", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "echarts4r", - "echarts4r.assets", - "jsonlite" - ], - "use_when": "A scatter plot with customizable icons.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/035-custom-icon-scatter.html", - "source_file": "Hiplot/035-custom-icon-scatter.qmd", - "skill_file": "skills/Hiplot/035-custom-icon-scatter_skill.md" - }, - { - "name": "D3 Wordcloud", - "category": "Hiplot", - "language": "R", - "packages": [ - "d3wordcloud", - "data.table", - "jsonlite" - ], - "use_when": "Display the wordcloud。", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/036-d3-wordcloud.html", - "source_file": "Hiplot/036-d3-wordcloud.qmd", - "skill_file": "skills/Hiplot/036-d3-wordcloud_skill.md" - }, - { - "name": "Dendrogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "ape", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The dendrogram is a diagram representing a tree. This diagrammatic representation is frequently used in different contexts:In hierarchical clustering, it illustrates the arrangement of the clusters produced by the corresponding analyses.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/037-dendrogram.html", - "source_file": "Hiplot/037-dendrogram.qmd", - "skill_file": "skills/Hiplot/037-dendrogram_skill.md" - }, - { - "name": "Mirror Density & Histogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The mirror density & histogram is a graph used to observe the distribution of continuous variables in two side view: top and bottom.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/038-density-hist-mirror.html", - "source_file": "Hiplot/038-density-hist-mirror.qmd", - "skill_file": "skills/Hiplot/038-density-hist-mirror_skill.md" - }, - { - "name": "Density-Histogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "grafify", - "jsonlite" - ], - "use_when": "Use density plots or histograms to show data distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/039-density-histogram.html", - "source_file": "Hiplot/039-density-histogram.qmd", - "skill_file": "skills/Hiplot/039-density-histogram_skill.md" - }, - { - "name": "Density", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The kernel density map is a graph used to observe the distribution of continuous variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/040-density.html", - "source_file": "Hiplot/040-density.qmd", - "skill_file": "skills/Hiplot/040-density_skill.md" - }, - { - "name": "Deviation Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "jsonlite" - ], - "use_when": "Deviation plot provides a visual representation of the differences between data points.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/041-deviation-plot.html", - "source_file": "Hiplot/041-deviation-plot.qmd", - "skill_file": "skills/Hiplot/041-deviation-plot_skill.md" - }, - { - "name": "Diffusion Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "BiocManager", - "data.table", - "destiny", - "ggplotify", - "ggpubr", - "jsonlite", - "scatterplot3d", - "smoother" - ], - "use_when": "Diffusion Map is a nonlinear dimensionality reduction algorithm that can be used to visualize developmental trajectories.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/042-diffusion-map.html", - "source_file": "Hiplot/042-diffusion-map.qmd", - "skill_file": "skills/Hiplot/042-diffusion-map_skill.md" - }, - { - "name": "Diverging Scale", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggcharts", - "jsonlite" - ], - "use_when": "The diverging scale is a graph that maps a continuous, quantitative input to a continuous fixed interpolator.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/043-diverging-scale.html", - "source_file": "Hiplot/043-diverging-scale.qmd", - "skill_file": "skills/Hiplot/043-diverging-scale_skill.md" - }, - { - "name": "DIY GSEA", - "category": "Hiplot", - "language": "R", - "packages": [ - "clusterProfiler", - "data.table", - "jsonlite" - ], - "use_when": "Create a DIY GSEA using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/044-diy-gsea.html", - "source_file": "Hiplot/044-diy-gsea.qmd", - "skill_file": "skills/Hiplot/044-diy-gsea_skill.md" - }, - { - "name": "Donut", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The donut is a variant of the pie chart, with a blank center allowing for additional information about the data as a whole to be included. Doughnut charts are similar to pie charts in that their aim is to illustrate proportions.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/045-donut.html", - "source_file": "Hiplot/045-donut.qmd", - "skill_file": "skills/Hiplot/045-donut_skill.md" - }, - { - "name": "Dotchart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "jsonlite" - ], - "use_when": "Sliding bead chart is a graph of beads sliding on a column. It is the superposition of bar chart and scatter chart.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/046-dotchart.html", - "source_file": "Hiplot/046-dotchart.qmd", - "skill_file": "skills/Hiplot/046-dotchart_skill.md" - }, - { - "name": "Dual Y Axis Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The dual Y-axis graph can put two groups of data with larger orders of magnitude in the same graph for display.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/047-dual-y-axis.html", - "source_file": "Hiplot/047-dual-y-axis.qmd", - "skill_file": "skills/Hiplot/047-dual-y-axis_skill.md" - }, - { - "name": "Dumbbell Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggalt", - "ggplot2", - "jsonlite" - ], - "use_when": "Dumbbell Chart can display the data change.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/048-dumbbell.html", - "source_file": "Hiplot/048-dumbbell.qmd", - "skill_file": "skills/Hiplot/048-dumbbell_skill.md" - }, - { - "name": "Easy Pairs", - "category": "Hiplot", - "language": "R", - "packages": [ - "GGally", - "data.table", - "jsonlite" - ], - "use_when": "Display a matrix of plots for viewing correlation relationship and distributions of multiple variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/049-easy-pairs.html", - "source_file": "Hiplot/049-easy-pairs.qmd", - "skill_file": "skills/Hiplot/049-easy-pairs_skill.md" - }, - { - "name": "Easy SOM", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "kohonen" - ], - "use_when": "Establish the SOM model and conduct the visulization.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/050-easy-som.html", - "source_file": "Hiplot/050-easy-som.qmd", - "skill_file": "skills/Hiplot/050-easy-som_skill.md" - }, - { - "name": "Eulerr Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "eulerr", - "ggplotify", - "jsonlite" - ], - "use_when": "Create a Eulerr Plot using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/051-eulerr.html", - "source_file": "Hiplot/051-eulerr.qmd", - "skill_file": "skills/Hiplot/051-eulerr_skill.md" - }, - { - "name": "Extended Scatter", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggExtra", - "ggplot2", - "jsonlite" - ], - "use_when": "An extended scatter plot adds marginal plots to the basic scatter plot to provide a more comprehensive view of the data distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/052-extended-scatter.html", - "source_file": "Hiplot/052-extended-scatter.qmd", - "skill_file": "skills/Hiplot/052-extended-scatter_skill.md" - }, - { - "name": "Cox Models Forest", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ezcox", - "jsonlite" - ], - "use_when": "Cox model forest is a visual representation of a COX model that constructs a risk forest map to facilitate variable screening.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/053-ezcox.html", - "source_file": "Hiplot/053-ezcox.qmd", - "skill_file": "skills/Hiplot/053-ezcox_skill.md" - }, - { - "name": "Fan Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "plotrix" - ], - "use_when": "The pie chart is a statistical chart designed to clearly show the percentage of each data group by the size of the pie.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/054-fan.html", - "source_file": "Hiplot/054-fan.qmd", - "skill_file": "skills/Hiplot/054-fan_skill.md" - }, - { - "name": "Fishplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "fishplot", - "jsonlite" - ], - "use_when": "Clone evolution analysis", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/055-fishplot.html", - "source_file": "Hiplot/055-fishplot.qmd", - "skill_file": "skills/Hiplot/055-fishplot_skill.md" - }, - { - "name": "Flower plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "flowerplot", - "ggplotify", - "jsonlite" - ], - "use_when": "Flower plot with multiple sets.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/056-flowerplot.html", - "source_file": "Hiplot/056-flowerplot.qmd", - "skill_file": "skills/Hiplot/056-flowerplot_skill.md" - }, - { - "name": "Funnel Plot (metafor)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "metafor" - ], - "use_when": "Can be used to show potential bias factors in Meta-analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/057-funnel-plot-metafor.html", - "source_file": "Hiplot/057-funnel-plot-metafor.qmd", - "skill_file": "skills/Hiplot/057-funnel-plot-metafor_skill.md" - }, - { - "name": "Funnel Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "FunnelPlotR", - "data.table", - "gridExtra", - "jsonlite" - ], - "use_when": "Can be used to show potential bias factors in Meta-analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/058-funnel-plot.html", - "source_file": "Hiplot/058-funnel-plot.qmd", - "skill_file": "skills/Hiplot/058-funnel-plot_skill.md" - }, - { - "name": "Gantt", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggthemes", - "jsonlite", - "tidyverse" - ], - "use_when": "The Gantt chart is a type of bar chart that illustrates a project schedule.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/059-gantt.html", - "source_file": "Hiplot/059-gantt.qmd", - "skill_file": "skills/Hiplot/059-gantt_skill.md" - }, - { - "name": "Gene Density", - "category": "Hiplot", - "language": "R", - "packages": [ - "ComplexHeatmap", - "RColorBrewer", - "circlize", - "data.table", - "ggplotify", - "gtrellis", - "jsonlite", - "tidyverse" - ], - "use_when": "Chrosome data visualization.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/060-gene-density.html", - "source_file": "Hiplot/060-gene-density.qmd", - "skill_file": "skills/Hiplot/060-gene-density_skill.md" - }, - { - "name": "Gene Ranking Dotplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "ggrepel", - "jsonlite" - ], - "use_when": "Gene expression ranking visualization.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/061-gene-rank.html", - "source_file": "Hiplot/061-gene-rank.qmd", - "skill_file": "skills/Hiplot/061-gene-rank_skill.md" - }, - { - "name": "Gene Cluster Trend", - "category": "Hiplot", - "language": "R", - "packages": [ - "Mfuzz", - "RColorBrewer", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The gene cluster trend is used to display different gene expression trend with multiple lines showing the similar expression patterns in each cluster.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/062-gene-trend.html", - "source_file": "Hiplot/062-gene-trend.qmd", - "skill_file": "skills/Hiplot/062-gene-trend_skill.md" - }, - { - "name": "Barstats", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggplot2", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Barstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/063-ggbarstats.html", - "source_file": "Hiplot/063-ggbarstats.qmd", - "skill_file": "skills/Hiplot/063-ggbarstats_skill.md" - }, - { - "name": "Betweenstats", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggplot2", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Betweenstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/064-ggbetweenstats.html", - "source_file": "Hiplot/064-ggbetweenstats.qmd", - "skill_file": "skills/Hiplot/064-ggbetweenstats_skill.md" - }, - { - "name": "Directed Acyclic Graphs", - "category": "Hiplot", - "language": "R", - "packages": [ - "ggdag" - ], - "use_when": "Visualizing directed acyclic graphs.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/065-ggdag.html", - "source_file": "Hiplot/065-ggdag.qmd", - "skill_file": "skills/Hiplot/065-ggdag_skill.md" - }, - { - "name": "Dist Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "broom", - "data.table", - "ggdist", - "ggplot2", - "jsonlite", - "modelr", - "tidyr" - ], - "use_when": "The dist plot is a visual diagram using a confidence distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/066-ggdist.html", - "source_file": "Hiplot/066-ggdist.qmd", - "skill_file": "skills/Hiplot/066-ggdist_skill.md" - }, - { - "name": "Histostats", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Display data distribution and inference.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/067-gghistostats.html", - "source_file": "Hiplot/067-gghistostats.qmd", - "skill_file": "skills/Hiplot/067-gghistostats_skill.md" - }, - { - "name": "GGPIE", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "dplyr", - "ggpie", - "ggplot2", - "jsonlite" - ], - "use_when": "The pie chart is a statistical chart that shows the proportion of each part by dividing a circle into sections.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/068-ggpie.html", - "source_file": "Hiplot/068-ggpie.qmd", - "skill_file": "skills/Hiplot/068-ggpie_skill.md" - }, - { - "name": "Piestats Group", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggplot2", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Piestats Group using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/069-ggpiestats-group.html", - "source_file": "Hiplot/069-ggpiestats-group.qmd", - "skill_file": "skills/Hiplot/069-ggpiestats-group_skill.md" - }, - { - "name": "Piestats", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Piestats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/071-ggpiestats.html", - "source_file": "Hiplot/071-ggpiestats.qmd", - "skill_file": "skills/Hiplot/071-ggpiestats_skill.md" - }, - { - "name": "GGPubr Boxplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "ggthemes", - "jsonlite" - ], - "use_when": "Feature-rich boxplot (GGPubr interface).", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/072-ggpubr-boxplot.html", - "source_file": "Hiplot/072-ggpubr-boxplot.qmd", - "skill_file": "skills/Hiplot/072-ggpubr-boxplot_skill.md" - }, - { - "name": "Scatterstats", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Scatterstats using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/073-ggscatterstats.html", - "source_file": "Hiplot/073-ggscatterstats.qmd", - "skill_file": "skills/Hiplot/073-ggscatterstats_skill.md" - }, - { - "name": "Seqlogo", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggseqlogo", - "jsonlite" - ], - "use_when": "The sequence LOGO is a graphic that describes a sequence pattern of binding sites.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/074-ggseqlogo.html", - "source_file": "Hiplot/074-ggseqlogo.qmd", - "skill_file": "skills/Hiplot/074-ggseqlogo_skill.md" - }, - { - "name": "Complex-Violin", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggplot2", - "ggstatsplot", - "jsonlite" - ], - "use_when": "Create a Complex-Violin using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/075-ggwithinstats.html", - "source_file": "Hiplot/075-ggwithinstats.qmd", - "skill_file": "skills/Hiplot/075-ggwithinstats_skill.md" - }, - { - "name": "ggwordcloud", - "category": "Hiplot", - "language": "R", - "packages": [ - "curl", - "data.table", - "ggwordcloud", - "jsonlite", - "png" - ], - "use_when": "The word cloud is to visualize the \"keywords\" that appear frequently in the web text by forming a \"keyword cloud layer\" or \"keyword rendering\".", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/076-ggwordcloud.html", - "source_file": "Hiplot/076-ggwordcloud.qmd", - "skill_file": "skills/Hiplot/076-ggwordcloud_skill.md" - }, - { - "name": "GOBar Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "GOplot", - "data.table", - "jsonlite" - ], - "use_when": "The gobar plot is used to display Z-score coloured barplot of terms ordered alternatively by z-score or the negative logarithm of the adjusted p-value.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/077-gobar.html", - "source_file": "Hiplot/077-gobar.qmd", - "skill_file": "skills/Hiplot/077-gobar_skill.md" - }, - { - "name": "GOBubble Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "GOplot", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The gobubble plot is used to display Z-score coloured bubble plot of terms ordered alternatively by z-score or the negative logarithm of the adjusted p-value.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/078-gobubble.html", - "source_file": "Hiplot/078-gobubble.qmd", - "skill_file": "skills/Hiplot/078-gobubble_skill.md" - }, - { - "name": "GOCircle Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "GOplot", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "The gocircle plot is used to display the circular plot combines gene expression and gene- annotation enrichment data. A subset of terms is displayed like the GOBar plot in combination with a scatter plot of the gene expression data. The whole plot is drawn on a specific coordinate system to achieve the circular layout. The segments are labeled with the term ID.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/079-gocircle.html", - "source_file": "Hiplot/079-gocircle.qmd", - "skill_file": "skills/Hiplot/079-gocircle_skill.md" - }, - { - "name": "Group Rank Dotplot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "sigminer" - ], - "use_when": "Values distribution for different groups.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/080-grdotplot.html", - "source_file": "Hiplot/080-grdotplot.qmd", - "skill_file": "skills/Hiplot/080-grdotplot_skill.md" - }, - { - "name": "Group Bubble", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Group Bubble using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/081-group-bubble.html", - "source_file": "Hiplot/081-group-bubble.qmd", - "skill_file": "skills/Hiplot/081-group-bubble_skill.md" - }, - { - "name": "Group-comparison Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "sigminer" - ], - "use_when": "Group-comparison Heatmap provides a way to compare multiple variables across multiple (>2) groups and visualize the result with heatmap.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/082-group-comparison.html", - "source_file": "Hiplot/082-group-comparison.qmd", - "skill_file": "skills/Hiplot/082-group-comparison_skill.md" - }, - { - "name": "Group Dumbbell", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggalt", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Group Dumbbell using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/083-group-dumbbell.html", - "source_file": "Hiplot/083-group-dumbbell.qmd", - "skill_file": "skills/Hiplot/083-group-dumbbell_skill.md" - }, - { - "name": "Group Line", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Group Line using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/084-group-line.html", - "source_file": "Hiplot/084-group-line.qmd", - "skill_file": "skills/Hiplot/084-group-line_skill.md" - }, - { - "name": "Half Violin", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "ggpubr", - "ggthemes", - "jsonlite" - ], - "use_when": "The half violin plot is a statistical graph used to display the distribution and probability density of data by replacing the left part with the data frequency count graph on the basis of keeping the right part of violin graph.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/085-half-violin.html", - "source_file": "Hiplot/085-half-violin.qmd", - "skill_file": "skills/Hiplot/085-half-violin_skill.md" - }, - { - "name": "Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "ComplexHeatmap", - "data.table", - "genefilter", - "jsonlite" - ], - "use_when": "Heat map is an intuitive and visual method for analyzing the distribution of experimental data, which can be used for quality control of experimental data and visualization display of difference data, as well as clustering of data and samples to observe sample quality.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/086-heatmap.html", - "source_file": "Hiplot/086-heatmap.qmd", - "skill_file": "skills/Hiplot/086-heatmap_skill.md" - }, - { - "name": "Hi-C Heatmap", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The HiC heatmap is used to display the genome-wide chromatin interaction with heatmap on different chromosomes.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/087-hic-heatmap.html", - "source_file": "Hiplot/087-hic-heatmap.qmd", - "skill_file": "skills/Hiplot/087-hic-heatmap_skill.md" - }, - { - "name": "Histogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "Histogram refers to the distribution of continuous variable data by a series of vertical stripes or line segments with different heights.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/088-histogram.html", - "source_file": "Hiplot/088-histogram.qmd", - "skill_file": "skills/Hiplot/088-histogram_skill.md" - }, - { - "name": "Interval Area Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Interval Area Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/089-interval-area-chart.html", - "source_file": "Hiplot/089-interval-area-chart.qmd", - "skill_file": "skills/Hiplot/089-interval-area-chart_skill.md" - }, - { - "name": "Interval Bar Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Interval Bar Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/090-interval-bar-chart.html", - "source_file": "Hiplot/090-interval-bar-chart.qmd", - "skill_file": "skills/Hiplot/090-interval-bar-chart_skill.md" - }, - { - "name": "Likert Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "likert" - ], - "use_when": "Descriptive statistical analysis of Likert scale data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/091-likert.html", - "source_file": "Hiplot/091-likert.qmd", - "skill_file": "skills/Hiplot/091-likert_skill.md" - }, - { - "name": "Line (Color Dot)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "grafify", - "jsonlite" - ], - "use_when": "Create a Line (Color Dot) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/092-line-color-dot.html", - "source_file": "Hiplot/092-line-color-dot.qmd", - "skill_file": "skills/Hiplot/092-line-color-dot_skill.md" - }, - { - "name": "Line (errorbar)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "jsonlite" - ], - "use_when": "The error line mainly indicates the error range of each data point and shows the potential error or uncertainty relative to each data in the series.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/093-line-errorbar.html", - "source_file": "Hiplot/093-line-errorbar.qmd", - "skill_file": "skills/Hiplot/093-line-errorbar_skill.md" - }, - { - "name": "Line Regression", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggrepel", - "jsonlite" - ], - "use_when": "Linear regression is a regression method for linear modeling of the relationship between independent variables and dependent variables.If there is only one independent variable, it is called simple regression, and if there is more than one independent variable, it is called multiple regression.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/094-line-regression.html", - "source_file": "Hiplot/094-line-regression.qmd", - "skill_file": "skills/Hiplot/094-line-regression_skill.md" - }, - { - "name": "Line", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The line chart is a statistical chart that USES a linear or logarithmic scale to draw data in a two - or three-dimensional view to show the data set or track the characteristics of the data over time.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/095-line.html", - "source_file": "Hiplot/095-line.qmd", - "skill_file": "skills/Hiplot/095-line_skill.md" - }, - { - "name": "Africa Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Africa Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/096-map-africa.html", - "source_file": "Hiplot/096-map-africa.qmd", - "skill_file": "skills/Hiplot/096-map-africa_skill.md" - }, - { - "name": "Americas Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Americas Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/097-map-americas.html", - "source_file": "Hiplot/097-map-americas.qmd", - "skill_file": "skills/Hiplot/097-map-americas_skill.md" - }, - { - "name": "China Map (City)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a China Map (City) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/098-map-china-city.html", - "source_file": "Hiplot/098-map-china-city.qmd", - "skill_file": "skills/Hiplot/098-map-china-city_skill.md" - }, - { - "name": "China Map (County)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a China Map (County) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/099-map-china-county.html", - "source_file": "Hiplot/099-map-china-county.qmd", - "skill_file": "skills/Hiplot/099-map-china-county_skill.md" - }, - { - "name": "China Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a China Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/100-map-china.html", - "source_file": "Hiplot/100-map-china.qmd", - "skill_file": "skills/Hiplot/100-map-china_skill.md" - }, - { - "name": "China Map 2", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a China Map 2 using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/101-map-china2.html", - "source_file": "Hiplot/101-map-china2.qmd", - "skill_file": "skills/Hiplot/101-map-china2_skill.md" - }, - { - "name": "Europe Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Europe Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/102-map-europe.html", - "source_file": "Hiplot/102-map-europe.qmd", - "skill_file": "skills/Hiplot/102-map-europe_skill.md" - }, - { - "name": "France Map (Town)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a France Map (Town) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/103-map-france-town.html", - "source_file": "Hiplot/103-map-france-town.qmd", - "skill_file": "skills/Hiplot/103-map-france-town_skill.md" - }, - { - "name": "France Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a France Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/104-map-france.html", - "source_file": "Hiplot/104-map-france.qmd", - "skill_file": "skills/Hiplot/104-map-france_skill.md" - }, - { - "name": "Germany Map (Town)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Germany Map (Town) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/106-map-germany-town.html", - "source_file": "Hiplot/106-map-germany-town.qmd", - "skill_file": "skills/Hiplot/106-map-germany-town_skill.md" - }, - { - "name": "Germany Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Germany Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/107-map-germany.html", - "source_file": "Hiplot/107-map-germany.qmd", - "skill_file": "skills/Hiplot/107-map-germany_skill.md" - }, - { - "name": "North America Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a North America Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/108-map-north-america.html", - "source_file": "Hiplot/108-map-north-america.qmd", - "skill_file": "skills/Hiplot/108-map-north-america_skill.md" - }, - { - "name": "Oceania/Antarc Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Oceania/Antarc Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/109-map-oceania-antarc.html", - "source_file": "Hiplot/109-map-oceania-antarc.qmd", - "skill_file": "skills/Hiplot/109-map-oceania-antarc_skill.md" - }, - { - "name": "South America Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a South America Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/111-map-south-america.html", - "source_file": "Hiplot/111-map-south-america.qmd", - "skill_file": "skills/Hiplot/111-map-south-america_skill.md" - }, - { - "name": "UK Map (City)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a UK Map (City) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/112-map-uk-city.html", - "source_file": "Hiplot/112-map-uk-city.qmd", - "skill_file": "skills/Hiplot/112-map-uk-city_skill.md" - }, - { - "name": "UK Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a UK Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/113-map-uk.html", - "source_file": "Hiplot/113-map-uk.qmd", - "skill_file": "skills/Hiplot/113-map-uk_skill.md" - }, - { - "name": "USA Map (County)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a USA Map (County) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/114-map-usa-county.html", - "source_file": "Hiplot/114-map-usa-county.qmd", - "skill_file": "skills/Hiplot/114-map-usa-county_skill.md" - }, - { - "name": "USA Map (States)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a USA Map (States) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/115-map-usa.html", - "source_file": "Hiplot/115-map-usa.qmd", - "skill_file": "skills/Hiplot/115-map-usa_skill.md" - }, - { - "name": "World Map", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a World Map using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/116-map-world.html", - "source_file": "Hiplot/116-map-world.qmd", - "skill_file": "skills/Hiplot/116-map-world_skill.md" - }, - { - "name": "World Map 2", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a World Map 2 using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/117-map-world2.html", - "source_file": "Hiplot/117-map-world2.qmd", - "skill_file": "skills/Hiplot/117-map-world2_skill.md" - }, - { - "name": "Matrix Bubble", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggalluvial", - "ggplot2", - "jsonlite" - ], - "use_when": "The color matrix bubble is used to visualize the expression matrix data of multiple genes (rows) in various cells (columns).", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/118-matrix-bubble.html", - "source_file": "Hiplot/118-matrix-bubble.qmd", - "skill_file": "skills/Hiplot/118-matrix-bubble_skill.md" - }, - { - "name": "Meta-analysis of Binary Data", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "meta" - ], - "use_when": "Create a Meta-analysis of Binary Data using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/119-meta-bin.html", - "source_file": "Hiplot/119-meta-bin.qmd", - "skill_file": "skills/Hiplot/119-meta-bin_skill.md" - }, - { - "name": "Meta-analysis of Continuous Data", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "meta" - ], - "use_when": "Create a Meta-analysis of Continuous Data using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/120-meta-cont.html", - "source_file": "Hiplot/120-meta-cont.qmd", - "skill_file": "skills/Hiplot/120-meta-cont_skill.md" - }, - { - "name": "Meta-Subgroup Analysis", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "jsonlite", - "metawho" - ], - "use_when": "The goal of metawho is to provide simple R implementation of “Meta-analytical method to Identify Who Benefits Most from Treatments”.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/121-metawho.html", - "source_file": "Hiplot/121-metawho.qmd", - "skill_file": "skills/Hiplot/121-metawho_skill.md" - }, - { - "name": "Moon charts", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "gggibbous", - "ggplot2", - "jsonlite" - ], - "use_when": "The moon chart is a graph that uses the moon's waxing and waning to reflect the size of the data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/122-moon-charts.html", - "source_file": "Hiplot/122-moon-charts.qmd", - "skill_file": "skills/Hiplot/122-moon-charts_skill.md" - }, - { - "name": "Mosaic Ratio Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "DescTools", - "data.table", - "ggplotify", - "jsonlite", - "vcd" - ], - "use_when": "Use mosaic blocks to show data proportions.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/123-mosaic.html", - "source_file": "Hiplot/123-mosaic.qmd", - "skill_file": "skills/Hiplot/123-mosaic_skill.md" - }, - { - "name": "Multiple Histograms", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Multiple histograms are plotted on the same graph to compare differences between multiple sets of data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/125-multiple-histograms.html", - "source_file": "Hiplot/125-multiple-histograms.qmd", - "skill_file": "skills/Hiplot/125-multiple-histograms_skill.md" - }, - { - "name": "Network (igraph)", - "category": "Hiplot", - "language": "R", - "packages": [ - "RColorBrewer", - "data.table", - "ggplotify", - "igraph", - "jsonlite", - "stringr" - ], - "use_when": "Network (igraph) can be used to visulize basic network based on igraph.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/127-network-igraph.html", - "source_file": "Hiplot/127-network-igraph.qmd", - "skill_file": "skills/Hiplot/127-network-igraph_skill.md" - }, - { - "name": "Neural Network", - "category": "Hiplot", - "language": "R", - "packages": [ - "NeuralNetTools", - "data.table", - "jsonlite", - "nnet" - ], - "use_when": "Create a Neural Network using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/129-neural-network.html", - "source_file": "Hiplot/129-neural-network.qmd", - "skill_file": "skills/Hiplot/129-neural-network_skill.md" - }, - { - "name": "Nomogram (Logistic)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "rms" - ], - "use_when": "Create a Nomogram (Logistic) using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/130-nomogram-logistic.html", - "source_file": "Hiplot/130-nomogram-logistic.qmd", - "skill_file": "skills/Hiplot/130-nomogram-logistic_skill.md" - }, - { - "name": "Nomogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "rms", - "survival" - ], - "use_when": "Nomogram is often used to evaluate the prognosis of oncology and medicine, and can visualize the results of logistic regression or Cox regression.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/131-nomogram.html", - "source_file": "Hiplot/131-nomogram.qmd", - "skill_file": "skills/Hiplot/131-nomogram_skill.md" - }, - { - "name": "Parallel Coordinate", - "category": "Hiplot", - "language": "R", - "packages": [ - "GGally", - "data.table", - "ggthemes", - "hrbrthemes", - "jsonlite", - "viridis" - ], - "use_when": "Create a Parallel Coordinate using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/132-parallel-coordinate.html", - "source_file": "Hiplot/132-parallel-coordinate.qmd", - "skill_file": "skills/Hiplot/132-parallel-coordinate_skill.md" - }, - { - "name": "Pareto Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Create a Pareto Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/133-pareto-chart.html", - "source_file": "Hiplot/133-pareto-chart.qmd", - "skill_file": "skills/Hiplot/133-pareto-chart_skill.md" - }, - { - "name": "Parliament", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggpol", - "jsonlite" - ], - "use_when": "The parliamentary chart is a data processing method that looks like a parliamentary seat, with points representing a data set to show the share ratio of each group more flexibly.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/134-parliament.html", - "source_file": "Hiplot/134-parliament.qmd", - "skill_file": "skills/Hiplot/134-parliament_skill.md" - }, - { - "name": "PCA2", - "category": "Hiplot", - "language": "R", - "packages": [ - "FactoMineR", - "data.table", - "factoextra", - "jsonlite" - ], - "use_when": "Principal component analysis (PCA) is a data processing method with \"dimension reduction\" as the core, replacing multi-index data with a few comprehensive indicators (PCA), and restoring the most essential characteristics of data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/135-pca2.html", - "source_file": "Hiplot/135-pca2.qmd", - "skill_file": "skills/Hiplot/135-pca2_skill.md" - }, - { - "name": "PCAtools", - "category": "Hiplot", - "language": "R", - "packages": [ - "PCAtools", - "cowplot", - "data.table", - "ggplotify", - "jsonlite" - ], - "use_when": "PCAtools can reduce the dimensionality of data through principal component analysis, and view principal component related features at a two-dimensional level", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/136-pcatools.html", - "source_file": "Hiplot/136-pcatools.qmd", - "skill_file": "skills/Hiplot/136-pcatools_skill.md" - }, - { - "name": "Perspective", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "shape" - ], - "use_when": "The three-dimensional perspective is a three-dimensional figure that can connect the higher values contained in a matrix with surfaces.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/137-perspective.html", - "source_file": "Hiplot/137-perspective.qmd", - "skill_file": "skills/Hiplot/137-perspective_skill.md" - }, - { - "name": "3D Pie", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "plotrix" - ], - "use_when": "The 3D pie chart is a pie chart that has a 3D appearance.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/138-pie-3d.html", - "source_file": "Hiplot/138-pie-3d.qmd", - "skill_file": "skills/Hiplot/138-pie-3d_skill.md" - }, - { - "name": "Pie Group", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "data.table", - "ggplotify", - "jsonlite", - "patchwork" - ], - "use_when": "Create a Pie Group using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/139-pie-group.html", - "source_file": "Hiplot/139-pie-group.qmd", - "skill_file": "skills/Hiplot/139-pie-group_skill.md" - }, - { - "name": "Pie Matrix", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "jsonlite", - "stringr", - "tidyr" - ], - "use_when": "Create a Pie Matrix using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/140-pie-matrix.html", - "source_file": "Hiplot/140-pie-matrix.qmd", - "skill_file": "skills/Hiplot/140-pie-matrix_skill.md" - }, - { - "name": "Pie", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "jsonlite" - ], - "use_when": "The pie chart is a statistical chart that shows the proportion of each part by dividing a circle into sections.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/141-pie.html", - "source_file": "Hiplot/141-pie.qmd", - "skill_file": "skills/Hiplot/141-pie_skill.md" - }, - { - "name": "Point (SD)", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "grafify", - "jsonlite" - ], - "use_when": "Displaying the standard deviation (SD) of multi-group data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/142-point-sd.html", - "source_file": "Hiplot/142-point-sd.qmd", - "skill_file": "skills/Hiplot/142-point-sd_skill.md" - }, - { - "name": "EnhancedMA", - "category": "Hiplot", - "language": "R", - "packages": [ - "EnhancedVolcano", - "data.table", - "jsonlite" - ], - "use_when": "Visualization of differentially expressed genes.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/143-pseudo-enhanced-ma.html", - "source_file": "Hiplot/143-pseudo-enhanced-ma.qmd", - "skill_file": "skills/Hiplot/143-pseudo-enhanced-ma_skill.md" - }, - { - "name": "Pyramid Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggcharts", - "jsonlite" - ], - "use_when": "The pyramid chart is a pyramid-like figure that distributes data on both sides of a central axis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/144-pyramid-chart.html", - "source_file": "Hiplot/144-pyramid-chart.qmd", - "skill_file": "skills/Hiplot/144-pyramid-chart_skill.md" - }, - { - "name": "Pyramid Chart 2", - "category": "Hiplot", - "language": "R", - "packages": [ - "apyramid", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The pyramid chart is a pyramid-like figure that distributes data on both sides of a central axis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/145-pyramid-chart2.html", - "source_file": "Hiplot/145-pyramid-chart2.qmd", - "skill_file": "skills/Hiplot/145-pyramid-chart2_skill.md" - }, - { - "name": "Pyramid Stack", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The pyramid stack is a pyramid-like figure that distributes data on both sides of a central axis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/146-pyramid-stack.html", - "source_file": "Hiplot/146-pyramid-stack.qmd", - "skill_file": "skills/Hiplot/146-pyramid-stack_skill.md" - }, - { - "name": "Pyramid Stack2", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "plotrix" - ], - "use_when": "The pyramid stack is a pyramid-like figure that distributes data on both sides of a central axis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/147-pyramid-stack2.html", - "source_file": "Hiplot/147-pyramid-stack2.qmd", - "skill_file": "skills/Hiplot/147-pyramid-stack2_skill.md" - }, - { - "name": "QQ Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "grafify", - "jsonlite" - ], - "use_when": "Verify whether a set of data comes from a certain distribution or whether two sets of data come from the same (family) distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/148-qqplot.html", - "source_file": "Hiplot/148-qqplot.qmd", - "skill_file": "skills/Hiplot/148-qqplot_skill.md" - }, - { - "name": "R Script Flow", - "category": "Hiplot", - "language": "R", - "packages": [ - "flow" - ], - "use_when": "R script flow can realize the visual window of if, else and other logic functions.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/149-r-code-flow.html", - "source_file": "Hiplot/149-r-code-flow.qmd", - "skill_file": "skills/Hiplot/149-r-code-flow_skill.md" - }, - { - "name": "Radar", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "ggradar", - "jsonlite", - "scales", - "tibble" - ], - "use_when": "Radar chart displays multivariable data in the form of two-dimensional charts representing three or more quantitative variables on the axis starting from the same point, so as to visually express the comparison of a research object in multiple parameters.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/150-radar.html", - "source_file": "Hiplot/150-radar.qmd", - "skill_file": "skills/Hiplot/150-radar_skill.md" - }, - { - "name": "RCS-COX", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "rms", - "stringr", - "survival" - ], - "use_when": "Nonlinear regression analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/151-rcs-cox.html", - "source_file": "Hiplot/151-rcs-cox.qmd", - "skill_file": "skills/Hiplot/151-rcs-cox_skill.md" - }, - { - "name": "RCS-LRM", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "rms", - "stringr", - "survival" - ], - "use_when": "Nonlinear regression analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/152-rcs-lrm.html", - "source_file": "Hiplot/152-rcs-lrm.qmd", - "skill_file": "skills/Hiplot/152-rcs-lrm_skill.md" - }, - { - "name": "Ribbon", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggthemes", - "jsonlite" - ], - "use_when": "The ribbon diagram is a pattern similar to a ribbon.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/153-ribbon.html", - "source_file": "Hiplot/153-ribbon.qmd", - "skill_file": "skills/Hiplot/153-ribbon_skill.md" - }, - { - "name": "Ridge", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggridges", - "ggthemes", - "jsonlite" - ], - "use_when": "The ridge map is a graph that connects points and forms a ridge.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/154-ridge.html", - "source_file": "Hiplot/154-ridge.qmd", - "skill_file": "skills/Hiplot/154-ridge_skill.md" - }, - { - "name": "Risk Factor Analysis", - "category": "Hiplot", - "language": "R", - "packages": [ - "cowplot", - "cutoff", - "data.table", - "fastStat", - "ggplot2", - "jsonlite", - "survminer" - ], - "use_when": "Create a Risk Factor Analysis using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/155-risk-plot.html", - "source_file": "Hiplot/155-risk-plot.qmd", - "skill_file": "skills/Hiplot/155-risk-plot_skill.md" - }, - { - "name": "ROC", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "pROC" - ], - "use_when": "Receiver operating characteristic curve (ROC curve) is used to describe the diagnostic ability of binary classifier system when its recognition threshold changes.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/156-roc.html", - "source_file": "Hiplot/156-roc.qmd", - "skill_file": "skills/Hiplot/156-roc_skill.md" - }, - { - "name": "Rose Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The rose chart is a column chart drawn in polar coordinates. The radius of the arc is used to indicate the size of the data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/157-rose-chart.html", - "source_file": "Hiplot/157-rose-chart.qmd", - "skill_file": "skills/Hiplot/157-rose-chart_skill.md" - }, - { - "name": "Sankey", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggalluvial", - "ggplot2", - "jsonlite" - ], - "use_when": "Sankey diagrams are a type of flow diagramin which the width of the arrows is proportional to the flow rate.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/158-sankey.html", - "source_file": "Hiplot/158-sankey.qmd", - "skill_file": "skills/Hiplot/158-sankey_skill.md" - }, - { - "name": "3D-Scatter", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "plot3D" - ], - "use_when": "3D scatter plot is to apply a number of quantitative variables to different coaxes in space and combine different variables into coordinates in space, so as to clearly explain the interaction between the three quantitative variables.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/159-scatter-3d.html", - "source_file": "Hiplot/159-scatter-3d.qmd", - "skill_file": "skills/Hiplot/159-scatter-3d_skill.md" - }, - { - "name": "Gradient Scatter", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "grafify", - "jsonlite" - ], - "use_when": "Two-dimensional spatial scatter to demonstrate multi-numerical variable relationships.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/160-scatter-gradient.html", - "source_file": "Hiplot/160-scatter-gradient.qmd", - "skill_file": "skills/Hiplot/160-scatter-gradient_skill.md" - }, - { - "name": "Scatter", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Two groups of data are used to form multiple coordinate points. By observing the distribution of coordinate points, it can judge whether there is correlation between variables or summarize the data processing mode of coordinate point distribution.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/161-scatter.html", - "source_file": "Hiplot/161-scatter.qmd", - "skill_file": "skills/Hiplot/161-scatter_skill.md" - }, - { - "name": "Scatter2", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "grafify", - "jsonlite" - ], - "use_when": "Two-dimensional spatial scatter to demonstrate multi-numerical variable relationships.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/162-scatter2.html", - "source_file": "Hiplot/162-scatter2.qmd", - "skill_file": "skills/Hiplot/162-scatter2_skill.md" - }, - { - "name": "Scatterpie", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "scatterpie" - ], - "use_when": "Scatter Pie can be used to visualize data fraction in different space coordinates.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/163-scatterpie.html", - "source_file": "Hiplot/163-scatterpie.qmd", - "skill_file": "skills/Hiplot/163-scatterpie_skill.md" - }, - { - "name": "Simple Funnel Diagram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "echarts4r", - "jsonlite", - "magrittr" - ], - "use_when": "Create a Simple Funnel Diagram using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/164-simple-funnel-diagram.html", - "source_file": "Hiplot/164-simple-funnel-diagram.qmd", - "skill_file": "skills/Hiplot/164-simple-funnel-diagram_skill.md" - }, - { - "name": "Slopegraph", - "category": "Hiplot", - "language": "R", - "packages": [ - "CGPfunctions", - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "Sopegraph can be used to display the change of values.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/165-slopegraph.html", - "source_file": "Hiplot/165-slopegraph.qmd", - "skill_file": "skills/Hiplot/165-slopegraph_skill.md" - }, - { - "name": "Stack Violin", - "category": "Hiplot", - "language": "R", - "packages": [ - "Seurat", - "ggplot2", - "limma", - "readr" - ], - "use_when": "The expression of key genes in each cluster in single-cell transcriptomic (Single Cell RNA-Seq)analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/166-stack-violin.html", - "source_file": "Hiplot/166-stack-violin.qmd", - "skill_file": "skills/Hiplot/166-stack-violin_skill.md" - }, - { - "name": "Percentsge Stacked Bar Chart", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "jsonlite", - "scales", - "tidyr" - ], - "use_when": "Create a Percentsge Stacked Bar Chart using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/167-stacked-percentage-bar-chart.html", - "source_file": "Hiplot/167-stacked-percentage-bar-chart.qmd", - "skill_file": "skills/Hiplot/167-stacked-percentage-bar-chart_skill.md" - }, - { - "name": "Streamgraph", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "streamgraph" - ], - "use_when": "Create a Streamgraph using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/168-streamgraph.html", - "source_file": "Hiplot/168-streamgraph.qmd", - "skill_file": "skills/Hiplot/168-streamgraph_skill.md" - }, - { - "name": "Survival Analysis", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "survival", - "survminer" - ], - "use_when": "The survivorship curve is a graph showing the number or proportion of individuals surviving to each age for a given species or group (e.g. males or females).", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/169-survival.html", - "source_file": "Hiplot/169-survival.qmd", - "skill_file": "skills/Hiplot/169-survival_skill.md" - }, - { - "name": "Taylor Diagram", - "category": "Hiplot", - "language": "R", - "packages": [ - "openair" - ], - "use_when": "It can be used to display the standard deviation (SD), root mean square (RMS) error and correlation coefficient of the models simultaneously.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/170-taylor-diagram.html", - "source_file": "Hiplot/170-taylor-diagram.qmd", - "skill_file": "skills/Hiplot/170-taylor-diagram_skill.md" - }, - { - "name": "Time ROC", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "grid", - "jsonlite", - "plotROC", - "survivalROC" - ], - "use_when": "Receiver Operating Characteristic (ROC) analysis with time records in survival analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/171-time-roc.html", - "source_file": "Hiplot/171-time-roc.qmd", - "skill_file": "skills/Hiplot/171-time-roc_skill.md" - }, - { - "name": "Treeheatr", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplotify", - "jsonlite", - "treeheatr" - ], - "use_when": "The heatmap decision tree is a visualization graph that combines two types of graphs: heatmap and decision tree visualization.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/172-treeheatr.html", - "source_file": "Hiplot/172-treeheatr.qmd", - "skill_file": "skills/Hiplot/172-treeheatr_skill.md" - }, - { - "name": "Treemap", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "treemap" - ], - "use_when": "Tree map is a kind of tree structure diagram that graphical form to represent hierarchy structure.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/173-treemap.html", - "source_file": "Hiplot/173-treemap.qmd", - "skill_file": "skills/Hiplot/173-treemap_skill.md" - }, - { - "name": "Tricolor Histogram", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite" - ], - "use_when": "The tricolored histogram divides the histogram into three regions: low-value zone, middle-value zone, and high-value zone, using three different colors.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/174-tricolor-histogram.html", - "source_file": "Hiplot/174-tricolor-histogram.qmd", - "skill_file": "skills/Hiplot/174-tricolor-histogram_skill.md" - }, - { - "name": "tSNE", - "category": "Hiplot", - "language": "R", - "packages": [ - "Rtsne", - "data.table", - "ggpubr", - "jsonlite" - ], - "use_when": "T-sne is a nonlinear dimensionality reduction algorithm suitable for high-dimensional data reduction to two or three dimensions and visualization. The algorithm can make the t distribution of points with greater similarity closer in the lower dimensional space. For low similarity points, the t distribution is farther away in the low dimensional space.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/175-tsne.html", - "source_file": "Hiplot/175-tsne.qmd", - "skill_file": "skills/Hiplot/175-tsne_skill.md" - }, - { - "name": "UMAP", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "jsonlite", - "umap" - ], - "use_when": "UMAP is a nonlinear dimensionality reduction algorithm suitable for high-dimensional data reduction to two or three dimensions and visualization. The algorithm can make the t distribution of points with greater similarity closer in the lower dimensional space. For low similarity points, the t distribution is farther away in the low dimensional space.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/176-umap.html", - "source_file": "Hiplot/176-umap.qmd", - "skill_file": "skills/Hiplot/176-umap_skill.md" - }, - { - "name": "Upset Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "ComplexHeatmap", - "VennDiagram", - "data.table", - "ggplot2", - "ggplotify", - "jsonlite" - ], - "use_when": "Upset can be used to show the interactive relationship between collections.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/177-upset-plot.html", - "source_file": "Hiplot/177-upset-plot.qmd", - "skill_file": "skills/Hiplot/177-upset-plot_skill.md" - }, - { - "name": "Venn", - "category": "Hiplot", - "language": "R", - "packages": [ - "VennDiagram", - "data.table", - "jsonlite" - ], - "use_when": "A Venn diagram is a diagramthat shows all possible logical relations between a finite collection of different sets. These diagrams depict elements as points in the plane, and sets as regions inside closed curves. A Venn diagram consists of multiple overlapping closed curves, usually circles, each representing a set. The points inside a curve labelled S represent elements of the set S, while points outside the boundary represent elements not in the set S. This lends to easily read visualizatio...", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/178-venn.html", - "source_file": "Hiplot/178-venn.qmd", - "skill_file": "skills/Hiplot/178-venn_skill.md" - }, - { - "name": "Venn2", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "venn" - ], - "use_when": "A Venn diagram is a diagramthat shows all possible logical relations between a finite collection of different sets. These diagrams depict elements as points in the plane, and sets as regions inside closed curves. A Venn diagram consists of multiple overlapping closed curves, usually circles, each representing a set. The points inside a curve labelled S represent elements of the set S, while points outside the boundary represent elements not in the set S. This lends to easily read visualizatio...", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/179-venn2.html", - "source_file": "Hiplot/179-venn2.qmd", - "skill_file": "skills/Hiplot/179-venn2_skill.md" - }, - { - "name": "Violin Group", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "ggthemes", - "jsonlite" - ], - "use_when": "Violin and box plot of grouped data with T-test.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/180-violin-group.html", - "source_file": "Hiplot/180-violin-group.qmd", - "skill_file": "skills/Hiplot/180-violin-group_skill.md" - }, - { - "name": "Violin", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "ggthemes", - "jsonlite" - ], - "use_when": "The violin plot, named for its resemblance to a violin, is a statistical diagram combining a box diagram with a kernel density diagram to show the distribution of data and the probability density.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/181-violin.html", - "source_file": "Hiplot/181-violin.qmd", - "skill_file": "skills/Hiplot/181-violin_skill.md" - }, - { - "name": "Visdat", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "dplyr", - "ggplot2", - "jsonlite", - "patchwork", - "visdat" - ], - "use_when": "Create a Visdat using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/182-visdat.html", - "source_file": "Hiplot/182-visdat.qmd", - "skill_file": "skills/Hiplot/182-visdat_skill.md" - }, - { - "name": "Volcano", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggpubr", - "jsonlite" - ], - "use_when": "The volcanogram is a visual representation of the difference in gene expression between two samples.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/183-volcano.html", - "source_file": "Hiplot/183-volcano.qmd", - "skill_file": "skills/Hiplot/183-volcano_skill.md" - }, - { - "name": "Waffle Plot", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "jsonlite", - "waffle" - ], - "use_when": "Create a Waffle Plot using R with the Hiplot platform's approach. Suitable for biomedical data visualization with publication-quality output.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/184-waffle.html", - "source_file": "Hiplot/184-waffle.qmd", - "skill_file": "skills/Hiplot/184-waffle_skill.md" - }, - { - "name": "Waterfalls Plot2", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "waterfalls" - ], - "use_when": "Used to visualize changes in data, with the difference from version 1 being the ability to customize the colors for upward and downward values.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/185-waterfalls-plot.html", - "source_file": "Hiplot/185-waterfalls-plot.qmd", - "skill_file": "skills/Hiplot/185-waterfalls-plot_skill.md" - }, - { - "name": "Waterfalls", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "jsonlite", - "waterfalls" - ], - "use_when": "The waterfall chart is used to display the cumulative effect of sequentially introduced positive or negative values . These intermediate values can either be time based or category based.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/186-waterfalls.html", - "source_file": "Hiplot/186-waterfalls.qmd", - "skill_file": "skills/Hiplot/186-waterfalls_skill.md" - }, - { - "name": "PCA", - "category": "Hiplot", - "language": "R", - "packages": [ - "data.table", - "ggplot2", - "ggpubr", - "gmodels", - "jsonlite" - ], - "use_when": "Principal component analysis (PCA) is a data processing method with \"dimension reduction\" as the core, replacing multi-index data with a few comprehensive indicators (PCA), and restoring the most essential characteristics of data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Hiplot/187-pca.html", - "source_file": "Hiplot/187-pca.qmd", - "skill_file": "skills/Hiplot/187-pca_skill.md" - }, - { - "name": "Heatmap (Julia)", - "category": "Julia", - "language": "Julia", - "packages": [ - "CairoMakie" - ], - "use_when": "A heatmap visualizes matrix data using color gradients. Julia's `CairoMakie` provides high-performance heatmap rendering suitable for large gene expression matrices and multi-omics data. The Makie ecosystem supports annotations, clustering, and complex layouts for publication-quality figures.", - "tutorial_url": "https://openbiox.github.io/Bizard/Julia/Heatmap.html", - "source_file": "Julia/Heatmap.qmd", - "skill_file": "skills/Julia/Heatmap_skill.md" - }, - { - "name": "Scatter Plot (Julia)", - "category": "Julia", - "language": "Julia", - "packages": [ - "CairoMakie", - "DataFrames" - ], - "use_when": "A scatter plot displays values for two continuous variables as a collection of points. Julia's `CairoMakie` package (part of the Makie.jl ecosystem) provides high-performance, GPU-accelerated plotting capabilities ideal for large biomedical datasets. Makie offers publication-quality rendering with a composable, declarative API.", - "tutorial_url": "https://openbiox.github.io/Bizard/Julia/ScatterPlot.html", - "source_file": "Julia/ScatterPlot.qmd", - "skill_file": "skills/Julia/ScatterPlot_skill.md" - }, - { - "name": "Violin Plot (Julia)", - "category": "Julia", - "language": "Julia", - "packages": [ - "CairoMakie", - "DataFrames" - ], - "use_when": "A violin plot combines box plot statistics with kernel density estimation to show data distributions. Julia's `CairoMakie` makes it straightforward to create violin plots for comparing gene expression, biomarker levels, or clinical measurements across groups.", - "tutorial_url": "https://openbiox.github.io/Bizard/Julia/ViolinPlot.html", - "source_file": "Julia/ViolinPlot.qmd", - "skill_file": "skills/Julia/ViolinPlot_skill.md" - }, - { - "name": "Cell-Cell Communication Circle Plot", - "category": "Omics", - "language": "R", - "packages": [ - "BiocManager", - "CellChat", - "Seurat", - "circlize", - "ggplot2", - "igraph", - "remotes" - ], - "use_when": "The Cell-Cell Communication Circle Plot (细胞-细胞通讯网络圈图) is a specialized visualization for depicting intercellular signaling interactions inferred from single-cell RNA sequencing (scRNA-seq) data. Using the **CellChat** R package, this plot presents a circular network where nodes represent cell populations (cell types or clusters) and directed edges indicate the strength and direction of ligand-receptor communication signals between them.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/CellChatCirclePlot.html", - "source_file": "Omics/CellChatCirclePlot.qmd", - "skill_file": "skills/Omics/CellChatCirclePlot_skill.md" - }, - { - "name": "Chromosome Plot", - "category": "Omics", - "language": "R", - "packages": [ - "RIdeogram" - ], - "use_when": "An chromosome plot (ideogram) is a graphical tool used to visualize chromosome structure and various genomic features on chromosomes. It typically represents each chromosome individually, drawing the length and structures such as the centromere to scale. Additionally, it can annotate multiple types of information on the chromosomes, including gene density, genetic variations, expression levels, repetitive sequences, and functional markers.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/ChromosomePlot.html", - "source_file": "Omics/ChromosomePlot.qmd", - "skill_file": "skills/Omics/ChromosomePlot_skill.md" - }, - { - "name": "Collinearity Plot", - "category": "Omics", - "language": "R", - "packages": [ - "RIdeogram" - ], - "use_when": "Collinearity plot is often used to compare genome sequences of different species, identify conserved homologous gene blocks and their arrangement order, and reveal changes in chromosome structure during evolution. This plot is widely used in the study of genome evolution, functional gene localization, and species relationship analysis.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/CollinearityPlot.html", - "source_file": "Omics/CollinearityPlot.qmd", - "skill_file": "skills/Omics/CollinearityPlot_skill.md" - }, - { - "name": "Gene Structure Plot", - "category": "Omics", - "language": "R", - "packages": [ - "gggenes", - "ggtree", - "tidyverse" - ], - "use_when": "In biology, especially in molecular biology research, analyzing the expression and regulation patterns of genes has always been a research focus. In this process, it is inevitable that there will be a need to draw the structure of a gene or the upstream and downstream relationships. Therefore, this tutorial will summarize some common gene structure drawing methods based on the R package gggenes.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/GeneStructurePlot.html", - "source_file": "Omics/GeneStructurePlot.qmd", - "skill_file": "skills/Omics/GeneStructurePlot_skill.md" - }, - { - "name": "GWAS Circos Plot", - "category": "Omics", - "language": "R", - "packages": [ - "CMplot" - ], - "use_when": "The visualization of Genome-Wide Association Study (GWAS) results mainly includes SNP circular plots displayed by chromosome positions, SNP density plots, Manhattan plots for significance screening, QQ plots comparing the distribution of observed p-values with expected p-values, etc., which are used to screen candidate variant genes at the genome-wide level.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/GwasSnpPlot.html", - "source_file": "Omics/GwasSnpPlot.qmd", - "skill_file": "skills/Omics/GwasSnpPlot_skill.md" - }, - { - "name": "KEGG Pathway Plot", - "category": "Omics", - "language": "R", - "packages": [ - "dbplyr", - "pathview" - ], - "use_when": "Create a KEGG Pathway Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/KeggPathwayPlot.html", - "source_file": "Omics/KeggPathwayPlot.qmd", - "skill_file": "skills/Omics/KeggPathwayPlot_skill.md" - }, - { - "name": "Manhattan Plot", - "category": "Omics", - "language": "R", - "packages": [ - "aplot", - "qqman", - "tidyverse" - ], - "use_when": "Manhattan plot is a graph used to describe the relationship between mutations on chromosomes and traits. It is named Manhattan plot because it resembles the urban landscape of Manhattan, USA. Manhattan plot is generally drawn in the form of scatter plot, but it can also be displayed in bar chart or line chart. It is usually drawn using R package qqman or directly using ggplot2.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/ManhattanPlot.html", - "source_file": "Omics/ManhattanPlot.qmd", - "skill_file": "skills/Omics/ManhattanPlot_skill.md" - }, - { - "name": "Motif Plot", - "category": "Omics", - "language": "R", - "packages": [ - "cowplot", - "ggplot2", - "ggseqlogo", - "gridExtra" - ], - "use_when": "For visualizing motif logos, ggseqlogo is an R package based on ggplot2 specifically designed for plotting logos from sequence motifs. Compared to other motif visualization tools, ggseqlogo boasts advantages such as concise syntax, flexible output formats, and full compatibility with the ggplot2 ecosystem. The package supports various sequence input formats, including position-frequency matrices (PFM), position-weight matrices (PWM), and sequence vectors, and provides rich customization optio...", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/MotifPlot.html", - "source_file": "Omics/MotifPlot.qmd", - "skill_file": "skills/Omics/MotifPlot_skill.md" - }, - { - "name": "Multiple Sequences Alignment", - "category": "Omics", - "language": "R", - "packages": [ - "ggmsa" - ], - "use_when": "Multiple Sequence Alignment (MSA) is a fundamental and crucial technique in bioinformatics. It is used to align three or more biological sequences (DNA, RNA, or proteins) based on their evolutionary or structural similarities, so that homologous sites (i.e., sites derived from a common ancestor) are aligned as much as possible.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/MultiSeqsAlignment.html", - "source_file": "Omics/MultiSeqsAlignment.qmd", - "skill_file": "skills/Omics/MultiSeqsAlignment_skill.md" - }, - { - "name": "Multiple Volcano Plot", - "category": "Omics", - "language": "R", - "packages": [ - "corrplot", - "scRNAtoolVis" - ], - "use_when": "Multiple Volcano Plot is a graph used for differential expression analysis of high-throughput data (such as transcriptomes and proteomes). Compared with the traditional volcano plot, the multi-group volcano plot can display the results of multiple groups at the same time, making it easier to compare the consistency or specificity of differential features horizontally.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/MultiVolcanoPlot.html", - "source_file": "Omics/MultiVolcanoPlot.qmd", - "skill_file": "skills/Omics/MultiVolcanoPlot_skill.md" - }, - { - "name": "Network Plot", - "category": "Omics", - "language": "R", - "packages": [ - "MetaNet", - "dplyr", - "igraph", - "pcutils" - ], - "use_when": "In microbiome research, it is crucial to understand the interactions between microorganisms. Network analysis is a powerful method that can help us visualize and quantify these complex relationships. Next, we will introduce the network operation and annotation functions of the `MetaNet` package, which can make our network analysis more in-depth and intuitive.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/NetworkPlot.html", - "source_file": "Omics/NetworkPlot.qmd", - "skill_file": "skills/Omics/NetworkPlot_skill.md" - }, - { - "name": "Population Map Plot", - "category": "Omics", - "language": "R", - "packages": [ - "doParallel", - "dplyr", - "ggfx", - "ggnewscale", - "ggplot2", - "ggrepel", - "ggspatial", - "gstat", - "rnaturalearth", - "rnaturalearthdata", - "sf", - "viridis" - ], - "use_when": "Create a Population Map Plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/PopulationMapPlot.html", - "source_file": "Omics/PopulationMapPlot.qmd", - "skill_file": "skills/Omics/PopulationMapPlot_skill.md" - }, - { - "name": "Sankey Bubble plot", - "category": "Omics", - "language": "R", - "packages": [ - "ggalluvial", - "patchwork", - "readr", - "tidyverse" - ], - "use_when": "Create a Sankey Bubble plot visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/SankeyBubblePlot.html", - "source_file": "Omics/SankeyBubblePlot.qmd", - "skill_file": "skills/Omics/SankeyBubblePlot_skill.md" - }, - { - "name": "Synteny Blocks Plot", - "category": "Omics", - "language": "R", - "packages": [ - "syntR" - ], - "use_when": "Collinearity is widely used in the study of complex genomes. This tutorial, based on the R package syntR, summarizes the identification of shared collinearity blocks between two genetic maps, chromosomal rearrangements, and their mapping.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/SyntenyBlocksPlot.html", - "source_file": "Omics/SyntenyBlocksPlot.qmd", - "skill_file": "skills/Omics/SyntenyBlocksPlot_skill.md" - }, - { - "name": "Text-Overlaid Enrichment Barplot", - "category": "Omics", - "language": "R", - "packages": [ - "clusterProfiler", - "ggprism", - "gground", - "org.Hs.eg.db", - "tidyverse" - ], - "use_when": "The Text-Overlaid Enrichment Barplot is a visualization tool designed for the high-density display of functional enrichment analysis results (e.g., GO, KEGG). It typically maps enrichment significance (adjusted p-value) to the length of rounded bars and utilizes the internal space of the graphics to directly overlay annotations of pathway names and core gene lists. Additionally, it uses colored blocks and bubbles on the left side to distinguish functional categories and gene counts.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/TextEnrichmentBarPlot.html", - "source_file": "Omics/TextEnrichmentBarPlot.qmd", - "skill_file": "skills/Omics/TextEnrichmentBarPlot_skill.md" - }, - { - "name": "Volcano Plot", - "category": "Omics", - "language": "R", - "packages": [ - "ggrepel", - "readxl", - "tidyverse" - ], - "use_when": "The volcano plot is used to compare the two groups and obtain the up-regulation/down-regulation between the two groups. The screening basis is the p value and FC value, which are converted to -logP value and log2(FC) value. The imported data can be the OTU table or ASV table of the microbiome, the table of transcriptome gene expression, or the features table of metabolomics and other multi-omics data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Omics/VolcanoPlot.html", - "source_file": "Omics/VolcanoPlot.qmd", - "skill_file": "skills/Omics/VolcanoPlot_skill.md" - }, - { - "name": "Arc Diagram", - "category": "Proportion", - "language": "R", - "packages": [ - "colormap", - "ggraph", - "igraph", - "patchwork", - "tidyverse", - "viridis" - ], - "use_when": "The arc diagram is a diagram connected by arcs, showing the relationships between nodes.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/ArcDiagram.html", - "source_file": "Proportion/ArcDiagram.qmd", - "skill_file": "skills/Proportion/ArcDiagram_skill.md" - }, - { - "name": "Chord Diagram", - "category": "Proportion", - "language": "R", - "packages": [ - "chorddiag", - "circlize", - "dplyr", - "ggraph", - "htmlwidgets", - "igraph", - "readr", - "readxl", - "tidygraph", - "tidyverse", - "viridis" - ], - "use_when": "Chord diagrams can use connecting lines or bars to represent the relationships between different objects. The connections in a chord diagram directly show the relationships between different objects; the width of the connection is proportional to the strength of the relationship, and the color of the connection can represent another mapping of the relationship, such as the type of relationship. The size of the sectors in the diagram represents the measurement of the objects.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/ChordDiagram.html", - "source_file": "Proportion/ChordDiagram.qmd", - "skill_file": "skills/Proportion/ChordDiagram_skill.md" - }, - { - "name": "Dice Plot", - "category": "Proportion", - "language": "R", - "packages": [ - "dplyr", - "ggdiceplot", - "ggplot2" - ], - "use_when": "Dice plots are a visualization technique for representing high-dimensional categorical data. The ggdiceplot package provides ggplot2 extensions for creating dice-based visualizations where each dot position on a dice represents a specific categorical variable. This allows intuitive visualization of up to 6 categorical variables simultaneously using traditional dice patterns. Each dice position (1-6) represents a different category, with dots shown only when that category is present.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/DicePlot.html", - "source_file": "Proportion/DicePlot.qmd", - "skill_file": "skills/Proportion/DicePlot_skill.md" - }, - { - "name": "Hierarchical Edge Bundling", - "category": "Proportion", - "language": "R", - "packages": [], - "use_when": "Create a Hierarchical Edge Bundling visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/EdgeBundling.html", - "source_file": "Proportion/EdgeBundling.qmd", - "skill_file": "skills/Proportion/EdgeBundling_skill.md" - }, - { - "name": "Network Graph", - "category": "Proportion", - "language": "R", - "packages": [ - "RColorBrewer", - "cowplot", - "igraph", - "networkD3" - ], - "use_when": "A network graph is a graphical model that resembles a network and consists of nodes and links, where links can be directed or undirected.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/Network.html", - "source_file": "Proportion/Network.qmd", - "skill_file": "skills/Proportion/Network_skill.md" - }, - { - "name": "Sankey Diagram", - "category": "Proportion", - "language": "R", - "packages": [ - "dplyr", - "ggalluvial", - "ggplot2", - "networkD3", - "openxlsx", - "readxl", - "tidyverse", - "webshot" - ], - "use_when": "A [Sankey diagram](https://www.data-to-viz.com/graph/sankey.html) allows to study flows. Entities (nodes) are represented by rectangles or text. Arrows or arcs are used to show flows between them. In `R`, the `networkD3` package is the best way to build them.", - "tutorial_url": "https://openbiox.github.io/Bizard/Proportion/Sankey.html", - "source_file": "Proportion/Sankey.qmd", - "skill_file": "skills/Proportion/Sankey_skill.md" - }, - { - "name": "Heatmap (Python)", - "category": "Python", - "language": "Python", - "packages": [ - "matplotlib", - "numpy", - "pandas", - "scipy", - "seaborn" - ], - "use_when": "A heatmap is a data visualization technique that uses color to represent values in a matrix. In biomedical research, heatmaps are essential for visualizing gene expression profiles, correlation matrices, methylation data, and drug response panels. Python's `seaborn` and `matplotlib` libraries offer powerful heatmap capabilities with built-in clustering support.", - "tutorial_url": "https://openbiox.github.io/Bizard/Python/Heatmap.html", - "source_file": "Python/Heatmap.qmd", - "skill_file": "skills/Python/Heatmap_skill.md" - }, - { - "name": "Scatter Plot (Python)", - "category": "Python", - "language": "Python", - "packages": [ - "matplotlib", - "numpy", - "pandas", - "scipy", - "seaborn" - ], - "use_when": "A scatter plot displays values for two continuous variables as a collection of points. In biomedical research, scatter plots are widely used for visualizing correlations between gene expression levels, comparing biomarkers, and exploring relationships in multi-omics datasets. Python's `matplotlib` and `seaborn` libraries provide flexible and publication-quality scatter plot capabilities.", - "tutorial_url": "https://openbiox.github.io/Bizard/Python/ScatterPlot.html", - "source_file": "Python/ScatterPlot.qmd", - "skill_file": "skills/Python/ScatterPlot_skill.md" - }, - { - "name": "Violin Plot (Python)", - "category": "Python", - "language": "Python", - "packages": [ - "matplotlib", - "numpy", - "pandas", - "seaborn" - ], - "use_when": "A violin plot combines a box plot and a kernel density estimation to show the distribution of continuous data across categories. In biomedical research, violin plots are ideal for comparing gene expression distributions, drug response measurements, or clinical biomarker levels across patient groups. Python's `seaborn` library makes it simple to create beautiful violin plots.", - "tutorial_url": "https://openbiox.github.io/Bizard/Python/ViolinPlot.html", - "source_file": "Python/ViolinPlot.qmd", - "skill_file": "skills/Python/ViolinPlot_skill.md" - }, - { - "name": "Volcano Plot (Python)", - "category": "Python", - "language": "Python", - "packages": [ - "matplotlib", - "numpy", - "pandas" - ], - "use_when": "A volcano plot displays statistical significance (-log10 p-value) versus fold-change (log2 FC) for thousands of features simultaneously. In biomedical research, volcano plots are the standard visualization for differential gene expression results from RNA-seq, proteomics, and metabolomics. Python's `matplotlib` provides full control over customizing these publication-ready plots.", - "tutorial_url": "https://openbiox.github.io/Bizard/Python/VolcanoPlot.html", - "source_file": "Python/VolcanoPlot.qmd", - "skill_file": "skills/Python/VolcanoPlot_skill.md" - }, - { - "name": "Bar Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "cowplot", - "dplyr", - "forcats", - "ggpattern", - "ggplot2", - "ggpubr", - "hrbrthemes", - "magrittr", - "palmerpenguins", - "rstatix", - "tidyr" - ], - "use_when": "A bar plot is a graph that uses the height or length of the bars to represent the amount of data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/BarPlot.html", - "source_file": "Ranking/BarPlot.qmd", - "skill_file": "skills/Ranking/BarPlot_skill.md" - }, - { - "name": "Circular Barplot", - "category": "Ranking", - "language": "R", - "packages": [ - "tidyverse" - ], - "use_when": "Circular Barplot is a variation of the well-known bar chart where bars are displayed along a circle instead of a straight line. Note that while visually appealing, circular bar charts must be used with caution because the groups do not share the same Y-axis. However, they are well-suited for periodic data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/CircularBarplot.html", - "source_file": "Ranking/CircularBarplot.qmd", - "skill_file": "skills/Ranking/CircularBarplot_skill.md" - }, - { - "name": "Lollipop Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "cowplot", - "ggalt", - "ggplot2", - "ggpubr", - "hrbrthemes", - "palmerpenguins", - "rstatix", - "tidyr" - ], - "use_when": "A lollipop plot is a variation of a bar chart and a scatter plot. It consists of a line segment and a point, which can clearly display data while reducing the amount of graphics. At the same time, the lollipop plot can help align values with categories and is very suitable for comparing the differences between values of multiple categories.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/Lollipop.html", - "source_file": "Ranking/Lollipop.qmd", - "skill_file": "skills/Ranking/Lollipop_skill.md" - }, - { - "name": "Parallel Coordinates Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "GGally", - "MASS", - "RColorBrewer", - "dplyr", - "ggbump", - "hrbrthemes", - "patchwork", - "tibble", - "tidyr", - "viridis" - ], - "use_when": "Parallel coordinate plots are a common method for visualizing high-dimensional multivariate data. To display a set of objects in a multidimensional space, multiple parallel and equally spaced axes are drawn, and the objects in the multidimensional space are represented as broken lines with vertices on the parallel axes. Although parallel line plots are a special type of line plot, they differ significantly from ordinary line plots. This is because parallel line plots are not limited to descri...", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/Parallel.html", - "source_file": "Ranking/Parallel.qmd", - "skill_file": "skills/Ranking/Parallel_skill.md" - }, - { - "name": "Radar/Spider Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "fmsb" - ], - "use_when": "A radar chart, spider chart, or web chart is a two-dimensional chart type used to plot a series of values over one or more quantitative variables. The fmsb library is an excellent tool for building this type of chart in R.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/Radar.html", - "source_file": "Ranking/Radar.qmd", - "skill_file": "skills/Ranking/Radar_skill.md" - }, - { - "name": "Table", - "category": "Ranking", - "language": "R", - "packages": [ - "dplyr", - "gt", - "gtExtras", - "readr" - ], - "use_when": "Tables are both a visual communication mode and a means of organizing and collating data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/Table.html", - "source_file": "Ranking/Table.qmd", - "skill_file": "skills/Ranking/Table_skill.md" - }, - { - "name": "Upset Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "UpSetR", - "ggupset" - ], - "use_when": "The Upset diagram is similar to the Venn diagram, mainly showing the number of elements in the intersection of different sets. However, when the number of sets in the Venn diagram reaches 5, the readability begins to drop sharply. The Upset diagram can well solve the problem of poor readability of the Venn diagram and can also provide additional statistical information on element properties.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/UpsetPlot.html", - "source_file": "Ranking/UpsetPlot.qmd", - "skill_file": "skills/Ranking/UpsetPlot_skill.md" - }, - { - "name": "Veen Plot", - "category": "Ranking", - "language": "R", - "packages": [ - "VennDiagram", - "ggVennDiagram", - "ggplot2" - ], - "use_when": "For the visualization of Venn diagrams, the commonly used R packages are ggVennDiagram and VennDiagram. Compared with the VennDiagram package, ggVennDiagram has the advantages of being applicable to more groups, adapting to ggplot2 syntax, and flexibly setting output formats, and is easier to learn and post-process. However, the set color of ggVennDiagram can only be set to a continuous gradient color related to the number of elements, and cannot be set to a discrete color with one color for...", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/VennPlot.html", - "source_file": "Ranking/VennPlot.qmd", - "skill_file": "skills/Ranking/VennPlot_skill.md" - }, - { - "name": "Wordcloud", - "category": "Ranking", - "language": "R", - "packages": [ - "dplyr", - "htmlwidgets", - "jiebaR", - "jiebaRD", - "tidyverse", - "webshot2", - "wordcloud2" - ], - "use_when": "A word cloud is a visual representation of text words, which allows you to clearly see the keywords (high-frequency words) in a large amount of text data.", - "tutorial_url": "https://openbiox.github.io/Bizard/Ranking/Wordcloud.html", - "source_file": "Ranking/Wordcloud.qmd", - "skill_file": "skills/Ranking/Wordcloud_skill.md" - }, - { - "name": "About Us", - "category": "Misc", - "language": "R", - "packages": [], - "use_when": "Create a About Us visualization in R for biomedical data analysis and research publications.", - "tutorial_url": "https://openbiox.github.io/Bizard/About.html", - "source_file": "About.qmd", - "skill_file": "skills/Misc/About_skill.md" - } -] \ No newline at end of file From b924ff48acb16e7836e426e303af59886a2abba2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 17 Apr 2026 04:47:54 +0000 Subject: [PATCH 4/4] fix: systematic cleanup of skills/ references across Skills.qmd, skill-spec.md, generate_skills.py, and quarto-publish.yml Agent-Logs-Url: https://github.com/openbiox/Bizard/sessions/832cf9d3-ce95-4de0-92b3-f440f2dcb88e Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com> --- .github/scripts/generate_skills.py | 2 -- .github/workflows/quarto-publish.yml | 1 - Skills.qmd | 12 ++----- Skills.zh.qmd | 12 ++----- skill-spec.md | 49 +++++++++------------------- 5 files changed, 21 insertions(+), 55 deletions(-) diff --git a/.github/scripts/generate_skills.py b/.github/scripts/generate_skills.py index 8add8225b7..64c9ad2403 100644 --- a/.github/scripts/generate_skills.py +++ b/.github/scripts/generate_skills.py @@ -294,7 +294,6 @@ def qmd_to_skill_offline(filepath: Path, base_url: str = DEFAULT_BASE_URL) -> Di "tutorial_url": tutorial_url, "skill": skill_text, "source_file": str(filepath), - "skill_file": f"skills/{category}/{filepath.stem}_skill.md", } @@ -641,7 +640,6 @@ def generate_skill(self, filepath: Path, "tutorial_url": tutorial_url, "skill": skill_text, "source_file": str(filepath), - "skill_file": f"skills/{category}/{filepath.stem}_skill.md", } diff --git a/.github/workflows/quarto-publish.yml b/.github/workflows/quarto-publish.yml index 55590badb7..b6568a4f60 100644 --- a/.github/workflows/quarto-publish.yml +++ b/.github/workflows/quarto-publish.yml @@ -24,7 +24,6 @@ on: paths-ignore: - '*.md' - 'LICENSE' - - 'skills/**' - 'scripts/**' - '.github/scripts/**' - '.github/workflows/auto-translate.yml' diff --git a/Skills.qmd b/Skills.qmd index 4f69374494..de8a07fe1c 100644 --- a/Skills.qmd +++ b/Skills.qmd @@ -19,11 +19,11 @@ The skill package works with any AI tool that supports custom instructions or kn - **ChatGPT / GPT-4**: Load as custom instructions + knowledge file - **Claude**: Upload as project files -- **GitHub Copilot Chat**: Reference with `#file:skill.md` +- **GitHub Copilot Chat**: Reference with `#file:SKILL.md` - **Local LLMs** (Ollama, LM Studio): Load as system prompt context ::: callout-tip -**Quick start**: Download the ZIP below → Load `skill.md` as your AI's instructions → Upload `gallery_data.csv` as a knowledge file → Ask: *"Help me create a volcano plot for my differential expression results"* +**Quick start**: Download the ZIP below → Load `SKILL.md` as your AI's instructions → Upload `gallery_data.csv` as a knowledge file → Ask: *"Help me create a volcano plot for my differential expression results"* ::: --- @@ -32,7 +32,7 @@ The skill package works with any AI tool that supports custom instructions or kn The ZIP contains: -- **`skill.md`** — AI skill instructions: teaches your AI assistant how to use Bizard for visualization recommendations and code generation +- **`SKILL.md`** — AI skill instructions: teaches your AI assistant how to use Bizard for visualization recommendations and code generation - **`gallery_data.csv`** — 793 visualization examples with image URLs, tutorial links, descriptions, and categories - **`gallery_data_zh.csv`** — Chinese version of the gallery data - **`README.md`** — Installation guide for different AI tools @@ -61,12 +61,6 @@ The ZIP contains: ``` ---- - -## Download Resources - -- **[Download Skill ZIP](bizard-skill.zip)** — Complete unified skill package - ## Regenerating Skills `SKILL.md` is **automatically regenerated** when tutorials are updated on the main branch. To regenerate manually: diff --git a/Skills.zh.qmd b/Skills.zh.qmd index ed27394266..f54e7f491d 100644 --- a/Skills.zh.qmd +++ b/Skills.zh.qmd @@ -19,11 +19,11 @@ from: markdown+emoji - **ChatGPT / GPT-4**:作为自定义指令 + 知识文件加载 - **Claude**:作为项目文件上传 -- **GitHub Copilot Chat**:使用 `#file:skill.md` 引用 +- **GitHub Copilot Chat**:使用 `#file:SKILL.md` 引用 - **本地 LLM**(Ollama、LM Studio):作为系统提示上下文加载 ::: callout-tip -**快速开始**:下载下方 ZIP 包 → 将 `skill.md` 加载为 AI 指令 → 上传 `gallery_data.csv` 作为知识文件 → 提问:*"帮我为差异表达结果创建一个火山图"* +**快速开始**:下载下方 ZIP 包 → 将 `SKILL.md` 加载为 AI 指令 → 上传 `gallery_data.csv` 作为知识文件 → 提问:*"帮我为差异表达结果创建一个火山图"* ::: --- @@ -32,7 +32,7 @@ from: markdown+emoji ZIP 包含: -- **`skill.md`** — AI 技能指令:教会你的 AI 助手如何使用 Bizard 进行可视化推荐和代码生成 +- **`SKILL.md`** — AI 技能指令:教会你的 AI 助手如何使用 Bizard 进行可视化推荐和代码生成 - **`gallery_data.csv`** — 793 个可视化示例,包含图片 URL、教程链接、描述和分类 - **`gallery_data_zh.csv`** — 画廊数据的中文版本 - **`README.md`** — 不同 AI 工具的安装指南 @@ -61,12 +61,6 @@ ZIP 包含: ``` ---- - -## 下载资源 - -- **[下载技能 ZIP 包](bizard-skill.zip)** — 完整的统一技能包 - ## 重新生成技能 技能在教程更新到主分支时**自动重新生成**。手动重新生成: diff --git a/skill-spec.md b/skill-spec.md index 03d2eea0f4..ba08627ca3 100644 --- a/skill-spec.md +++ b/skill-spec.md @@ -23,19 +23,13 @@ self-contained recipe for a specific visualization technique. ## Skill File Specification -### File Naming +### Output: Unified `SKILL.md` -``` -skills//_skill.md -``` - -- `` matches the tutorial directory (e.g., `Distribution`, `Omics`, `Hiplot`) -- `` matches the QMD filename without extension (e.g., `ViolinPlot`) -- Always use `_skill.md` suffix - -### Document Structure +All skills are consolidated into a single **`SKILL.md`** file at the repository root. +This file is auto-generated by `generate_skills.py` and serves as the primary AI +skill document. -Every skill file **must** contain exactly these sections in order: +Individual skill cards within `SKILL.md` follow this structure: ```markdown # Skill: (<Language>) @@ -249,28 +243,15 @@ Before finalizing a skill file, verify: --- -## JSON Index Format - -In addition to individual skill files, maintain two JSON files: - -### `skills/index.json` (lightweight) - -```json -[ - { - "name": "Violin Plot", - "category": "Distribution", - "language": "R", - "packages": ["ggplot2", "dplyr", "viridis"], - "use_when": "Visualize data distribution shape across groups...", - "tutorial_url": "https://openbiox.github.io/Bizard/Distribution/ViolinPlot.html", - "source_file": "Distribution/ViolinPlot.qmd", - "skill_file": "skills/Distribution/ViolinPlot_skill.md" - } -] -``` +## Regenerating `SKILL.md` + +```bash +# LLM mode (requires API key in environment) +python .github/scripts/generate_skills.py --verbose -### `skills/bizard_skills.json` (full) +# Offline mode (rule-based extraction) +python .github/scripts/generate_skills.py --offline --verbose +``` -Same structure as `index.json` but with an additional `"content"` field containing -the full Markdown skill document. +`SKILL.md` is also automatically regenerated by the `Generate Skills` GitHub Actions +workflow when tutorials are updated on the main branch.