Plotting
quicat.pl.barplot(adata, groupby, order=None, color='blue', figsize=(10, 6), xlabel=None, ylabel='Percentage (%)', title=None, show=True, save=None, dpi=150, **kwargs)
¶
Creates a bar plot showing the percentage of each category in a specified variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata |
AnnData
|
The input AnnData object. |
required |
groupby |
str
|
Name of the variable (column in |
required |
order |
Optional[List[str]]
|
Specific order of the categories. If None, categories are ordered from highest to lowest percentage. Defaults to None. |
None
|
color |
Union[str, Tuple[float, float, float]]
|
Color for the bars. Can be a color name, an RGB tuple, or a hex code. Defaults to 'blue'. |
'blue'
|
figsize |
Tuple[float, float]
|
Size of the figure. Defaults to (10, 6). |
(10, 6)
|
xlabel |
Optional[str]
|
Label for the x-axis. Defaults to None. |
None
|
ylabel |
str
|
Label for the y-axis. Defaults to 'Percentage (%)'. |
'Percentage (%)'
|
title |
Optional[str]
|
Title of the plot. Defaults to None. |
None
|
show |
bool
|
If True, displays the plot. If False, returns the figure object. Defaults to True. |
True
|
save |
Optional[str]
|
Path to save the figure. If None, the figure is not saved. Defaults to None. |
None
|
dpi |
int
|
Resolution of the saved figure. Defaults to 150. |
150
|
**kwargs |
Additional keyword arguments to pass to |
{}
|
Returns:
| Type | Description |
|---|---|
Optional[Figure]
|
Optional[plt.Figure]: The matplotlib Figure object if |
Source code in src/quicat/plotting/_barplot.py
quicat.pl.stacked_barplot(adata, groupby, obs_key, palette=None, cmap=None, figsize=(10, 6), xlabel=None, ylabel='Percentage (%)', title=None, legend_title=None, show=True, save=None, dpi=150, **kwargs)
¶
Creates a stacked bar plot showing the percentage distribution of one categorical variable over another.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata |
AnnData
|
The input AnnData object containing observations. |
required |
groupby |
str
|
The categorical variable in |
required |
obs_key |
str
|
The categorical variable in |
required |
palette |
Union[str, List[str]]
|
Seaborn palette or list of colors. Defaults to None. |
None
|
cmap |
Optional[Dict[str, str]]
|
Dictionary mapping categories in |
None
|
figsize |
Tuple[float, float]
|
Figure size. Defaults to (10, 6). |
(10, 6)
|
xlabel |
Optional[str]
|
Label for the x-axis. Defaults to |
None
|
ylabel |
str
|
Label for the y-axis. Defaults to 'Percentage (%)'. |
'Percentage (%)'
|
title |
Optional[str]
|
Title of the plot. Defaults to None. |
None
|
legend_title |
Optional[str]
|
Title for the legend. Defaults to the |
None
|
show |
bool
|
If True, shows the plot. If False, returns the figure. Defaults to True. |
True
|
save |
Optional[str]
|
Path to save the figure. Defaults to None. |
None
|
dpi |
int
|
DPI for the saved figure. Defaults to 150. |
150
|
**kwargs |
Additional arguments passed to |
{}
|
Returns:
| Type | Description |
|---|---|
Optional[Figure]
|
Optional[plt.Figure]: The matplotlib Figure object if |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/quicat/plotting/_stacked_barplot.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
quicat.pl.boxplot(adata, groupby, obs_key, hue=None, palette=None, cmap=None, figsize=(10, 6), xlabel=None, ylabel=None, title=None, legend_title=None, show=True, save=None, dpi=150, **kwargs)
¶
Creates a box plot showing the distribution of a variable across categories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata |
AnnData
|
The input AnnData object containing observations. |
required |
groupby |
str
|
The categorical variable in |
required |
obs_key |
str
|
The variable in |
required |
hue |
str
|
The categorical variable in |
None
|
palette |
Union[str, List[str], Dict[str, str]]
|
Seaborn palette name, list of colors, or a dictionary mapping categories to colors. Defaults to None. |
None
|
cmap |
Optional[Dict[str, str]]
|
Dictionary mapping categories in |
None
|
figsize |
Tuple[float, float]
|
Figure size. Defaults to (10, 6). |
(10, 6)
|
xlabel |
Optional[str]
|
Label for the x-axis. Defaults to |
None
|
ylabel |
Optional[str]
|
Label for the y-axis. Defaults to |
None
|
title |
Optional[str]
|
Title of the plot. Defaults to None. |
None
|
legend_title |
Optional[str]
|
Title for the legend. Defaults to the |
None
|
show |
bool
|
If True, shows the plot. If False, returns the figure. Defaults to True. |
True
|
save |
Optional[str]
|
Path to save the figure. Defaults to None. |
None
|
dpi |
int
|
DPI for the saved figure. Defaults to 150. |
150
|
**kwargs |
Additional arguments passed to |
{}
|
Returns:
| Type | Description |
|---|---|
Optional[Figure]
|
Optional[plt.Figure]: The matplotlib Figure object if |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/quicat/plotting/_boxplot.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |