|
a |
|
b/man/enrichment_circlize.Rd |
|
|
1 |
% Generated by roxygen2: do not edit by hand |
|
|
2 |
% Please edit documentation in R/EnrichCirclize.R |
|
|
3 |
\name{enrichment_circlize} |
|
|
4 |
\alias{enrichment_circlize} |
|
|
5 |
\title{Draw Chord Diagram with Legends} |
|
|
6 |
\usage{ |
|
|
7 |
enrichment_circlize( |
|
|
8 |
all_combined_df, |
|
|
9 |
original_colors, |
|
|
10 |
labels, |
|
|
11 |
colors, |
|
|
12 |
labels2, |
|
|
13 |
colors2, |
|
|
14 |
font_size = 10 |
|
|
15 |
) |
|
|
16 |
} |
|
|
17 |
\arguments{ |
|
|
18 |
\item{all_combined_df}{A dataframe containing the matrix for the chord diagram.} |
|
|
19 |
|
|
|
20 |
\item{original_colors}{A vector of colors for the grid columns of the chord diagram.} |
|
|
21 |
|
|
|
22 |
\item{labels}{A vector of labels for the first legend.} |
|
|
23 |
|
|
|
24 |
\item{colors}{A vector of colors corresponding to the first legend's labels.} |
|
|
25 |
|
|
|
26 |
\item{labels2}{A vector of labels for the second legend.} |
|
|
27 |
|
|
|
28 |
\item{colors2}{A vector of colors corresponding to the second legend's labels.} |
|
|
29 |
|
|
|
30 |
\item{font_size}{The font size used for legend texts, defaults to 10.} |
|
|
31 |
} |
|
|
32 |
\value{ |
|
|
33 |
Invisible, primarily used for its side effects of drawing on a graphics device. |
|
|
34 |
} |
|
|
35 |
\description{ |
|
|
36 |
This function creates a chord diagram from a specified dataframe and draws two sets of legends for it. |
|
|
37 |
It adjusts the track height of the chord diagram to optimize space and uses specified colors for the grid. |
|
|
38 |
Legends are drawn at specified positions with configurable text alignments and font sizes. |
|
|
39 |
} |
|
|
40 |
\examples{ |
|
|
41 |
# Sample Chord Diagram Matrix |
|
|
42 |
all_combined_df <- data.frame( |
|
|
43 |
A = c(10, 20, 30), |
|
|
44 |
B = c(15, 25, 35), |
|
|
45 |
C = c(5, 10, 15) |
|
|
46 |
) |
|
|
47 |
rownames(all_combined_df) <- c("A", "B", "C") |
|
|
48 |
|
|
|
49 |
# Colors for the grid of the chord diagram (corresponding to columns of the matrix) |
|
|
50 |
original_colors <- c("red", "green", "blue") |
|
|
51 |
|
|
|
52 |
# Name the colors according to the sectors (A, B, C) |
|
|
53 |
names(original_colors) <- colnames(all_combined_df) |
|
|
54 |
|
|
|
55 |
# Labels and Colors for the First Legend |
|
|
56 |
labels <- c("Label 1", "Label 2", "Label 3") |
|
|
57 |
colors <- c("yellow", "purple", "cyan") |
|
|
58 |
|
|
|
59 |
# Labels and Colors for the Second Legend |
|
|
60 |
labels2 <- c("Label A", "Label B", "Label C") |
|
|
61 |
colors2 <- c("orange", "pink", "brown") |
|
|
62 |
|
|
|
63 |
# Font size for the legend texts (optional, default is 10) |
|
|
64 |
font_size <- 10 |
|
|
65 |
|
|
|
66 |
# Call the enrichment_circlize function with the sample data |
|
|
67 |
# This is just an example; the plot will be rendered in an appropriate graphics context |
|
|
68 |
# such as RStudio's plot pane or an external plotting window. |
|
|
69 |
plot1 <- enrichment_circlize(all_combined_df, |
|
|
70 |
original_colors, |
|
|
71 |
labels, |
|
|
72 |
colors, |
|
|
73 |
labels2, |
|
|
74 |
colors2, |
|
|
75 |
font_size |
|
|
76 |
) |
|
|
77 |
|
|
|
78 |
} |