Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions docs/usage/brain_surface.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
`plot_brain_surface_figure` 函数基于 `surfplot` 库开发,提供了一个统一且简化的接口来绘制人脑、猕猴脑和黑猩猩脑的脑区图。
目前支持多种脑图谱包括:

1. 人 Glasser (HCP-MMP) 图集[^1]。[图集 CSV 文件](../../assets/atlas_csv/human_glasser.csv)。
1. 人 BNA 图集[^2]。[图集 CSV 文件](../../assets/atlas_csv/human_bna.csv)。
1. 黑猩猩 BNA 图集[^3]。[图集 CSV 文件](../../assets/atlas_csv/chimpanzee_bna.csv)。
1. 猕猴 CHARM 5-level [^4]。[图集 CSV 文件](../../assets/atlas_csv/macaque_charm5.csv)。
1. 猕猴 CHARM 6-level [^4]。[图集 CSV 文件](../../assets/atlas_csv/macaque_charm6.csv)。
1. 猕猴 BNA 图集[^5]。[图集 CSV 文件](../../assets/atlas_csv/macaque_bna.csv)。
1. 猕猴 D99 图集[^6]。[图集 CSV 文件](../../assets/atlas_csv/macaque_d99.csv)。
1. 人 Glasser (HCP-MMP) 图集[^1]。[图集 CSV 文件](../assets/atlas_csv/human_glasser.csv)。
1. 人 BNA 图集[^2]。[图集 CSV 文件](../assets/atlas_csv/human_bna.csv)。
1. 黑猩猩 BNA 图集[^3]。[图集 CSV 文件](../assets/atlas_csv/chimpanzee_bna.csv)。
1. 猕猴 CHARM 5-level [^4]。[图集 CSV 文件](../assets/atlas_csv/macaque_charm5.csv)。
1. 猕猴 CHARM 6-level [^4]。[图集 CSV 文件](../assets/atlas_csv/macaque_charm6.csv)。
1. 猕猴 BNA 图集[^5]。[图集 CSV 文件](../assets/atlas_csv/macaque_bna.csv)。
1. 猕猴 D99 图集[^6]。[图集 CSV 文件](../assets/atlas_csv/macaque_d99.csv)。

[^1]:
Glasser, M. F., Coalson, T. S., Robinson, E. C., Hacker, C. D., Harwell, J., Yacoub, E., Ugurbil, K., Andersson, J., Beckmann, C. F., Jenkinson, M., Smith, S. M., & Van Essen, D. C. (2016). A multi-modal parcellation of human cerebral cortex. Nature, 536(7615), Article 7615. https://doi.org/10.1038/nature18933
Expand All @@ -28,8 +28,6 @@
[^6]:
Reveley, C., Gruslys, A., Ye, F. Q., Glen, D., Samaha, J., E. Russ, B., Saad, Z., K. Seth, A., Leopold, D. A., & Saleem, K. S. (2017). Three-Dimensional Digital Template Atlas of the Macaque Brain. Cerebral Cortex, 27(9), 4463–4477. https://doi.org/10.1093/cercor/bhw248

## 全脑

## 快速出图

!!! info
Expand All @@ -46,7 +44,7 @@ ax = plot_brain_surface_figure(data, species="human", atlas="glasser")



![png](brain_surface_files/brain_surface_5_0.png)
![png](brain_surface_files/brain_surface_4_0.png)



Expand All @@ -70,7 +68,7 @@ ax2 = plot_brain_surface_figure(



![png](brain_surface_files/brain_surface_6_0.png)
![png](brain_surface_files/brain_surface_5_0.png)



Expand Down Expand Up @@ -103,7 +101,7 @@ ax4 = plot_brain_surface_figure(plot_data, surf="flat", ax=axes[1,1], title_name



![png](brain_surface_files/brain_surface_9_0.png)
![png](brain_surface_files/brain_surface_8_0.png)



Expand All @@ -127,7 +125,7 @@ ax3 = plot_brain_surface_figure(plot_data, species="chimpanzee", atlas="bna", su



![png](brain_surface_files/brain_surface_11_0.png)
![png](brain_surface_files/brain_surface_10_0.png)



Expand Down Expand Up @@ -159,7 +157,7 @@ ax5 = plot_brain_surface_figure(plot_data, species="macaque", atlas="charm5", su



![png](brain_surface_files/brain_surface_13_0.png)
![png](brain_surface_files/brain_surface_12_0.png)



Expand Down Expand Up @@ -188,6 +186,6 @@ ax = plot_brain_surface_figure(



![png](brain_surface_files/brain_surface_16_0.png)
![png](brain_surface_files/brain_surface_15_0.png)


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/usage/brain_surface_files/brain_surface_5_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
258 changes: 129 additions & 129 deletions docs/usage/multi_groups.md
Original file line number Diff line number Diff line change
@@ -1,129 +1,129 @@
# 多组柱状图

## 快速出图

我们采用了多组柱状图(multi-group bar chart)来展示数据的整体分布情况。
该图包含 两组数据(即两个主类别),每组中包含 三个子柱(bar),分别代表不同的子条件或变量。
在每个 bar 内部,绘制了 10 个样本点,反映个体水平的变异性或观测值。

这种图形结构有助于同时比较:

- 每组内不同条件之间的平均差异;
- 不同组之间的整体趋势;
- 每个条件下样本的离散情况或分布特征。

为了增强信息表达,柱状图上还叠加了误差条(如标准差或准误),并使用散点图展示每个 bar 中的样本分布。


```python
import numpy as np
from plotfig import *

np.random.seed(42)
group1_bar1 = np.random.normal(3, 1, 10)
group1_bar2 = np.random.normal(3, 1, 10)
group1_bar3 = np.random.normal(3, 1, 10)
group2_bar1 = np.random.normal(3, 1, 10)
group2_bar2 = np.random.normal(3, 1, 10)
group2_bar3 = np.random.normal(3, 1, 10)

ax = plot_multi_group_bar_figure([[group1_bar1, group1_bar2, group1_bar3], [group2_bar1, group2_bar2, group2_bar3]])
```



![png](multi_groups_files/multi_groups_3_0.png)



## 图的美化

与单组柱状图类似,多组柱状图也提供了大量可调节的参数,用于灵活控制图像的外观。
本节仅展示其中的一部分参数。

完整参数列表请参见 [`plot_multi_group_bar_figure`](../api/index.md/#plotfig.bar.plot_multi_group_bar_figure) 的 API 文档。


```python
import numpy as np
import matplotlib.pyplot as plt
from plotfig import *

np.random.seed(42)
group1_bar1 = np.random.normal(3, 1, 10)
group1_bar2 = np.random.normal(3, 1, 10)
group1_bar3 = np.random.normal(3, 1, 10)
group2_bar1 = np.random.normal(3, 1, 10)
group2_bar2 = np.random.normal(3, 1, 10)
group2_bar3 = np.random.normal(3, 1, 10)

fig, ax = plt.subplots(figsize=(6, 3))
ax = plot_multi_group_bar_figure(
[[group1_bar1, group1_bar2, group1_bar3], [group2_bar1, group2_bar2, group2_bar3]],
ax=ax,
group_labels=["A", "B"],
bar_labels=["D", "E", "F"],
bar_width=0.2,
bar_gap=0.05,
bar_color=["tab:blue", "tab:orange", "tab:green"],
errorbar_type="sd",
dots_color="pink",
dots_size=15,
title_name="Title name",
title_fontsize=15,
y_label_name="Y label name",
)
```



![png](multi_groups_files/multi_groups_6_0.png)



## 统计

多组柱状图目前仅支持通过外部统计检验传入 p 值,并在组内相应位置标注星号。

关于“外部统计检验”的详细说明,请参见:[单组柱状图 / 统计](./single_group.md/#_7)。


```python
import numpy as np
import matplotlib.pyplot as plt
from plotfig import *

np.random.seed(42)
group1_bar1 = np.random.normal(3, 1, 10)
group1_bar2 = np.random.normal(3, 1, 10)
group1_bar3 = np.random.normal(3, 1, 10)
group2_bar1 = np.random.normal(3, 1, 10)
group2_bar2 = np.random.normal(3, 1, 10)
group2_bar3 = np.random.normal(3, 1, 10)

fig, ax = plt.subplots(figsize=(6, 3))
ax = plot_multi_group_bar_figure(
[[group1_bar1, group1_bar2, group1_bar3], [group2_bar1, group2_bar2, group2_bar3]],
ax=ax,
group_labels=["A", "B"],
bar_labels=["D", "E", "F"],
bar_width=0.2,
bar_gap=0.05,
bar_color=["tab:blue", "tab:orange", "tab:green"],
errorbar_type="se",
dots_color="pink",
dots_size=15,
title_name="Title name",
title_fontsize=15,
y_label_name="Y label name",
statistic=True,
test_method="external",
p_list=[[0.05, 0.01, 0.001], [0.001, 0.01, 0.05]]
)
```



![png](multi_groups_files/multi_groups_9_0.png)


# 多组柱状图
## 快速出图
我们采用了多组柱状图(multi-group bar chart)来展示数据的整体分布情况。
该图包含 两组数据(即两个主类别),每组中包含 三个子柱(bar),分别代表不同的子条件或变量。
在每个 bar 内部,绘制了 10 个样本点,反映个体水平的变异性或观测值。
这种图形结构有助于同时比较:
- 每组内不同条件之间的平均差异;
- 不同组之间的整体趋势;
- 每个条件下样本的离散情况或分布特征。
为了增强信息表达,柱状图上还叠加了误差条(如标准差或准误),并使用散点图展示每个 bar 中的样本分布。
```python
import numpy as np
from plotfig import *
np.random.seed(42)
group1_bar1 = np.random.normal(3, 1, 10)
group1_bar2 = np.random.normal(3, 1, 10)
group1_bar3 = np.random.normal(3, 1, 10)
group2_bar1 = np.random.normal(3, 1, 10)
group2_bar2 = np.random.normal(3, 1, 10)
group2_bar3 = np.random.normal(3, 1, 10)
ax = plot_multi_group_bar_figure([[group1_bar1, group1_bar2, group1_bar3], [group2_bar1, group2_bar2, group2_bar3]])
```
![png](multi_groups_files/multi_groups_3_0.png)
## 图的美化
与单组柱状图类似,多组柱状图也提供了大量可调节的参数,用于灵活控制图像的外观。
本节仅展示其中的一部分参数。
完整参数列表请参见 [`plot_multi_group_bar_figure`](../api/index.md/#plotfig.bar.plot_multi_group_bar_figure) 的 API 文档。
```python
import numpy as np
import matplotlib.pyplot as plt
from plotfig import *
np.random.seed(42)
group1_bar1 = np.random.normal(3, 1, 10)
group1_bar2 = np.random.normal(3, 1, 10)
group1_bar3 = np.random.normal(3, 1, 10)
group2_bar1 = np.random.normal(3, 1, 10)
group2_bar2 = np.random.normal(3, 1, 10)
group2_bar3 = np.random.normal(3, 1, 10)
fig, ax = plt.subplots(figsize=(6, 3))
ax = plot_multi_group_bar_figure(
[[group1_bar1, group1_bar2, group1_bar3], [group2_bar1, group2_bar2, group2_bar3]],
ax=ax,
group_labels=["A", "B"],
bar_labels=["D", "E", "F"],
bar_width=0.2,
bar_gap=0.05,
bar_color=["tab:blue", "tab:orange", "tab:green"],
errorbar_type="sd",
dots_color="pink",
dots_size=15,
title_name="Title name",
title_fontsize=15,
y_label_name="Y label name",
)
```
![png](multi_groups_files/multi_groups_6_0.png)
## 统计
多组柱状图目前仅支持通过外部统计检验传入 p 值,并在组内相应位置标注星号。
关于“外部统计检验”的详细说明,请参见:[单组柱状图 / 统计](single_group.md#_7)。
```python
import numpy as np
import matplotlib.pyplot as plt
from plotfig import *
np.random.seed(42)
group1_bar1 = np.random.normal(3, 1, 10)
group1_bar2 = np.random.normal(3, 1, 10)
group1_bar3 = np.random.normal(3, 1, 10)
group2_bar1 = np.random.normal(3, 1, 10)
group2_bar2 = np.random.normal(3, 1, 10)
group2_bar3 = np.random.normal(3, 1, 10)
fig, ax = plt.subplots(figsize=(6, 3))
ax = plot_multi_group_bar_figure(
[[group1_bar1, group1_bar2, group1_bar3], [group2_bar1, group2_bar2, group2_bar3]],
ax=ax,
group_labels=["A", "B"],
bar_labels=["D", "E", "F"],
bar_width=0.2,
bar_gap=0.05,
bar_color=["tab:blue", "tab:orange", "tab:green"],
errorbar_type="se",
dots_color="pink",
dots_size=15,
title_name="Title name",
title_fontsize=15,
y_label_name="Y label name",
statistic=True,
test_method="external",
p_list=[[0.05, 0.01, 0.001], [0.001, 0.01, 0.05]]
)
```
![png](multi_groups_files/multi_groups_9_0.png)
Loading