plotfig 1.0.0__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. {plotfig-1.0.0 → plotfig-1.1.0}/PKG-INFO +7 -14
  2. {plotfig-1.0.0 → plotfig-1.1.0}/README.md +7 -14
  3. {plotfig-1.0.0 → plotfig-1.1.0}/plotfig.egg-info/PKG-INFO +7 -14
  4. {plotfig-1.0.0 → plotfig-1.1.0}/pyproject.toml +1 -1
  5. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/bar.py +22 -1
  6. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/correlation.py +13 -2
  7. {plotfig-1.0.0 → plotfig-1.1.0}/LICENSE +0 -0
  8. {plotfig-1.0.0 → plotfig-1.1.0}/plotfig.egg-info/SOURCES.txt +0 -0
  9. {plotfig-1.0.0 → plotfig-1.1.0}/plotfig.egg-info/dependency_links.txt +0 -0
  10. {plotfig-1.0.0 → plotfig-1.1.0}/plotfig.egg-info/requires.txt +0 -0
  11. {plotfig-1.0.0 → plotfig-1.1.0}/plotfig.egg-info/top_level.txt +0 -0
  12. {plotfig-1.0.0 → plotfig-1.1.0}/setup.cfg +0 -0
  13. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/__init__.py +0 -0
  14. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/brain_connection.py +0 -0
  15. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/brain_surface.py +0 -0
  16. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/circos.py +0 -0
  17. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/atlas_tables/chimpanzee_bna.csv +0 -0
  18. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/atlas_tables/human_bna.csv +0 -0
  19. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/atlas_tables/human_glasser.csv +0 -0
  20. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/atlas_tables/macaque_bna.csv +0 -0
  21. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/atlas_tables/macaque_charm5.csv +0 -0
  22. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/atlas_tables/macaque_charm5_add_13_sgms.csv +0 -0
  23. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/atlas_tables/macaque_charm6.csv +0 -0
  24. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/atlas_tables/macaque_d99.csv +0 -0
  25. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/chimpanzee_BNA/ChimpBNA.L.32k_fs_LR.label.gii +0 -0
  26. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/chimpanzee_BNA/ChimpBNA.R.32k_fs_LR.label.gii +0 -0
  27. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/human_BNA/fsaverage.L.BNA.32k_fs_LR.label.gii +0 -0
  28. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/human_BNA/fsaverage.R.BNA.32k_fs_LR.label.gii +0 -0
  29. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/human_Glasser/fsaverage.L.Glasser.32k_fs_LR.label.gii +0 -0
  30. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/human_Glasser/fsaverage.R.Glasser.32k_fs_LR.label.gii +0 -0
  31. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/macaque_BNA/MBNA_124_32k_L.label.gii +0 -0
  32. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/macaque_BNA/MBNA_124_32k_R.label.gii +0 -0
  33. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/macaque_CHARM5/L.charm5.label.gii +0 -0
  34. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/macaque_CHARM5/R.charm5.label.gii +0 -0
  35. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/macaque_CHARM6/L.charm6.label.gii +0 -0
  36. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/macaque_CHARM6/R.charm6.label.gii +0 -0
  37. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/macaque_D99/L.d99.label.gii +0 -0
  38. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/atlases/macaque_D99/R.d99.label.gii +0 -0
  39. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/chimpanzee_BNA/ChimpYerkes29_v1.2.L.midthickness.32k_fs_LR.surf.gii +0 -0
  40. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/chimpanzee_BNA/ChimpYerkes29_v1.2.L.veryinflated.32k_fs_LR.surf.gii +0 -0
  41. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/chimpanzee_BNA/ChimpYerkes29_v1.2.R.midthickness.32k_fs_LR.surf.gii +0 -0
  42. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/chimpanzee_BNA/ChimpYerkes29_v1.2.R.veryinflated.32k_fs_LR.surf.gii +0 -0
  43. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/README.md +0 -0
  44. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-L_desc-nomedialwall_dparc.label.gii +0 -0
  45. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-L_desc-sulc_midthickness.shape.gii +0 -0
  46. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-L_desc-vaavg_midthickness.shape.gii +0 -0
  47. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-L_inflated.surf.gii +0 -0
  48. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-L_midthickness.surf.gii +0 -0
  49. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-L_sphere.surf.gii +0 -0
  50. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-L_veryinflated.surf.gii +0 -0
  51. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-R_desc-nomedialwall_dparc.label.gii +0 -0
  52. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-R_desc-sulc_midthickness.shape.gii +0 -0
  53. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-R_desc-vaavg_midthickness.shape.gii +0 -0
  54. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-R_inflated.surf.gii +0 -0
  55. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-R_midthickness.surf.gii +0 -0
  56. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-R_sphere.surf.gii +0 -0
  57. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_den-32k_hemi-R_veryinflated.surf.gii +0 -0
  58. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_space-fsaverage_den-32k_hemi-L_sphere.surf.gii +0 -0
  59. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/human_fsLR/tpl-fsLR_space-fsaverage_den-32k_hemi-R_sphere.surf.gii +0 -0
  60. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_BNA/civm.L.inflated.32k_fs_LR.surf.gii +0 -0
  61. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_BNA/civm.L.midthickness.32k_fs_LR.surf.gii +0 -0
  62. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_BNA/civm.L.pial.32k_fs_LR.surf.gii +0 -0
  63. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_BNA/civm.L.veryinflated.32k_fs_LR.surf.gii +0 -0
  64. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_BNA/civm.L.white.32k_fs_LR.surf.gii +0 -0
  65. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_BNA/civm.R.inflated.32k_fs_LR.surf.gii +0 -0
  66. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_BNA/civm.R.midthickness.32k_fs_LR.surf.gii +0 -0
  67. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_BNA/civm.R.pial.32k_fs_LR.surf.gii +0 -0
  68. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_BNA/civm.R.veryinflated.32k_fs_LR.surf.gii +0 -0
  69. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_BNA/civm.R.white.32k_fs_LR.surf.gii +0 -0
  70. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/L.gray_surface.inf_300.surf.gii +0 -0
  71. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/L.gray_surface.surf.gii +0 -0
  72. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/L.mid_surface.inf_300.surf.gii +0 -0
  73. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/L.mid_surface.surf.gii +0 -0
  74. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/L.white_surface.inf_300.surf.gii +0 -0
  75. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/L.white_surface.surf.gii +0 -0
  76. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/R.gray_surface.inf_300.surf.gii +0 -0
  77. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/R.gray_surface.surf.gii +0 -0
  78. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/R.mid_surface.inf_300.surf.gii +0 -0
  79. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/R.mid_surface.surf.gii +0 -0
  80. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/R.white_surface.inf_300.surf.gii +0 -0
  81. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/surfaces/macaque_NMT2/R.white_surface.surf.gii +0 -0
  82. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/data/neurodata/volumes/macaque_NMT2/CHARM5_add_13_sgms_asym.nii.gz +0 -0
  83. {plotfig-1.0.0 → plotfig-1.1.0}/src/plotfig/matrix.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotfig
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Scientific plotting package for Cognitive neuroscience
5
5
  Author-email: Ricardo Ryn <ricardoRyn1317@gmail.com>
6
6
  Keywords: neuroscience,plotting,visualization
@@ -32,20 +32,13 @@ Dynamic: license-file
32
32
  # 功能
33
33
 
34
34
  画图种类:
35
- 1. 单组柱状/小提琴图
35
+ 1. 单组柱状图
36
36
  1. 多组柱状图
37
- 1. 相关图
38
- 1. 矩阵图
39
- 1. 脑区图
40
- 1. 人类Glasser脑区图
41
- 1. 人类BNA脑区图
42
- 1. 猕猴CHARM 5-level脑区图
43
- 1. 猕猴CHARM 6-level脑区图
44
- 1. 猕猴BNA脑区图
45
- 1. 连线图(circos图)
46
- 1. 对称circos图
47
- 1. 不对称circos图
48
- 1. 脑连接图
37
+ 1. 相关点线图
38
+ 1. 矩阵图/热图
39
+ 1. 图集脑区图
40
+ 1. 连线图/circos图
41
+ 1. 玻璃脑连接图
49
42
 
50
43
  # 叠甲
51
44
 
@@ -13,20 +13,13 @@
13
13
  # 功能
14
14
 
15
15
  画图种类:
16
- 1. 单组柱状/小提琴图
16
+ 1. 单组柱状图
17
17
  1. 多组柱状图
18
- 1. 相关图
19
- 1. 矩阵图
20
- 1. 脑区图
21
- 1. 人类Glasser脑区图
22
- 1. 人类BNA脑区图
23
- 1. 猕猴CHARM 5-level脑区图
24
- 1. 猕猴CHARM 6-level脑区图
25
- 1. 猕猴BNA脑区图
26
- 1. 连线图(circos图)
27
- 1. 对称circos图
28
- 1. 不对称circos图
29
- 1. 脑连接图
18
+ 1. 相关点线图
19
+ 1. 矩阵图/热图
20
+ 1. 图集脑区图
21
+ 1. 连线图/circos图
22
+ 1. 玻璃脑连接图
30
23
 
31
24
  # 叠甲
32
25
 
@@ -38,4 +31,4 @@
38
31
 
39
32
  最自嗨!
40
33
 
41
- > 🌟 “调包侠再得一分!”🐶
34
+ > 🌟 “调包侠再得一分!”🐶
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotfig
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Scientific plotting package for Cognitive neuroscience
5
5
  Author-email: Ricardo Ryn <ricardoRyn1317@gmail.com>
6
6
  Keywords: neuroscience,plotting,visualization
@@ -32,20 +32,13 @@ Dynamic: license-file
32
32
  # 功能
33
33
 
34
34
  画图种类:
35
- 1. 单组柱状/小提琴图
35
+ 1. 单组柱状图
36
36
  1. 多组柱状图
37
- 1. 相关图
38
- 1. 矩阵图
39
- 1. 脑区图
40
- 1. 人类Glasser脑区图
41
- 1. 人类BNA脑区图
42
- 1. 猕猴CHARM 5-level脑区图
43
- 1. 猕猴CHARM 6-level脑区图
44
- 1. 猕猴BNA脑区图
45
- 1. 连线图(circos图)
46
- 1. 对称circos图
47
- 1. 不对称circos图
48
- 1. 脑连接图
37
+ 1. 相关点线图
38
+ 1. 矩阵图/热图
39
+ 1. 图集脑区图
40
+ 1. 连线图/circos图
41
+ 1. 玻璃脑连接图
49
42
 
50
43
  # 叠甲
51
44
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "plotfig"
3
- version = "1.0.0"
3
+ version = "1.1.0"
4
4
  description = "Scientific plotting package for Cognitive neuroscience"
5
5
  keywords = ["neuroscience", "plotting", "visualization"]
6
6
  readme = "README.md"
@@ -5,6 +5,7 @@ import numpy as np
5
5
  import numpy.typing as npt
6
6
  from matplotlib.axes import Axes
7
7
  from matplotlib.ticker import FuncFormatter, ScalarFormatter
8
+ from matplotlib.colors import LinearSegmentedColormap
8
9
  from scipy import stats
9
10
 
10
11
  # 类型别名
@@ -156,6 +157,10 @@ def plot_one_group_bar_figure(
156
157
  test_method: str = "ttest_ind",
157
158
  p_list: list[float] | None = None,
158
159
  errorbar_type: str = "se",
160
+ use_gradient_color: bool = False,
161
+ colors_start = None,
162
+ colors_end = None,
163
+ edgecolor: str | None = None,
159
164
  **kwargs: Any,
160
165
  ) -> None:
161
166
  """绘制单组柱状图,包含散点和误差条。
@@ -208,7 +213,22 @@ def plot_one_group_bar_figure(
208
213
  error_values = ses
209
214
 
210
215
  # 绘制柱子
211
- ax.bar(x_positions, means, width=width, color=colors, alpha=1, edgecolor="k")
216
+ if use_gradient_color:
217
+ if colors_start is None: # 默认颜色
218
+ colors_start = ['#e38a48'] * len(x_positions) # 左边颜色
219
+ if colors_end is None: # 默认颜色
220
+ colors_end = ['#4573a5'] * len(x_positions) # 右边颜色
221
+ for x, h, c1, c2 in zip(x_positions, means, colors_start, colors_end):
222
+ # 生成线性渐变 colormap
223
+ cmap = LinearSegmentedColormap.from_list("grad_cmap", [c1, "white", c2])
224
+ gradient = np.linspace(0, 1, 100).reshape(1, -1) # 横向渐变
225
+ # 计算渐变矩形位置:跟bar完全对齐
226
+ extent = [x - width/2, x + width/2, 0, h]
227
+ # 叠加渐变矩形(imshow)
228
+ ax.imshow(gradient, aspect='auto', cmap=cmap, extent=extent, zorder=0)
229
+ else :
230
+ ax.bar(x_positions, means, width=width, color=colors, alpha=1, edgecolor=edgecolor)
231
+
212
232
  ax.errorbar(
213
233
  x_positions,
214
234
  means,
@@ -227,6 +247,7 @@ def plot_one_group_bar_figure(
227
247
  add_scatter(ax, scatter_positions[i], d, dots_color[i], dots_size)
228
248
 
229
249
  # 美化
250
+ ax.set_xlim(min(x_positions) - 0.5, max(x_positions) + 0.5)
230
251
  ax.spines[["top", "right"]].set_visible(False)
231
252
  ax.set_title(
232
253
  title_name,
@@ -6,6 +6,7 @@ from matplotlib.ticker import (
6
6
  MultipleLocator,
7
7
  FormatStrFormatter,
8
8
  )
9
+ from matplotlib.colors import LinearSegmentedColormap
9
10
  from scipy import stats
10
11
 
11
12
  from typing import TypeAlias
@@ -43,6 +44,9 @@ def plot_correlation_figure(
43
44
  y_format: str = "normal", # 支持 "normal", "sci", "1f", "percent"
44
45
  asterisk_fontsize: int = 10,
45
46
  show_p_value: bool = False,
47
+ hexbin: bool = False,
48
+ hexbin_cmap: bool = None,
49
+ hexbin_gridsize:int = 50,
46
50
  ) -> None:
47
51
  """
48
52
  绘制两个数据集之间的相关性图,支持线性回归、置信区间和统计方法(Spearman 或 Pearson)。
@@ -121,8 +125,13 @@ def plot_correlation_figure(
121
125
  x_seq = np.linspace(A.min(), A.max(), 100)
122
126
  y_pred = slope * x_seq + intercept
123
127
 
124
- ax.scatter(A, B, c=dots_color, s=dots_size, alpha=0.8)
125
- ax.plot(x_seq, y_pred, line_color, lw=2)
128
+ if hexbin:
129
+ if hexbin_cmap is None:
130
+ hexbin_cmap = LinearSegmentedColormap.from_list('custom', ['#ffffff', '#4573a5'])
131
+ hb = ax.hexbin(A, B, gridsize=hexbin_gridsize, cmap=hexbin_cmap)
132
+ else:
133
+ ax.scatter(A, B, c=dots_color, s=dots_size, alpha=0.8)
134
+ ax.plot(x_seq, y_pred, line_color, lw=1)
126
135
 
127
136
  if ci:
128
137
  n = len(A)
@@ -192,6 +201,8 @@ def plot_correlation_figure(
192
201
  va="center",
193
202
  fontsize=asterisk_fontsize,
194
203
  )
204
+ if hexbin:
205
+ return hb
195
206
  return
196
207
 
197
208
 
File without changes
File without changes
File without changes
File without changes
File without changes