rsplotlib 0.1.4__tar.gz → 0.1.5__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 (40) hide show
  1. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/.gitignore +1 -0
  2. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/Cargo.lock +1 -1
  3. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/Cargo.toml +1 -1
  4. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/PKG-INFO +21 -4
  5. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/build_wheel.sh +6 -0
  6. rsplotlib-0.1.5/pyproject.toml +48 -0
  7. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/python/rsplotlib/api.py +5 -6
  8. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/python/rsplotlib/gridspec.py +13 -2
  9. rsplotlib-0.1.5/python/rsplotlib/pyplot.py +996 -0
  10. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/axes.rs +305 -8
  11. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/axes_bounds.rs +68 -0
  12. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/axes_render_elements.rs +117 -0
  13. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/elements.rs +45 -0
  14. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/figure.rs +21 -11
  15. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/lib.rs +7 -0
  16. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/pyfuncs.rs +117 -13
  17. rsplotlib-0.1.4/pyproject.toml +0 -28
  18. rsplotlib-0.1.4/python/rsplotlib/pyplot.py +0 -545
  19. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/.github/ci.yml +0 -0
  20. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/.github/release.yml +0 -0
  21. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/LICENSE +0 -0
  22. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/README.md +0 -0
  23. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/README_zh.md +0 -0
  24. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/python/rsplotlib/__init__.py +0 -0
  25. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/python/rsplotlib/_figure_defaults.py +0 -0
  26. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/python/rsplotlib/_font_resolver.py +0 -0
  27. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/python/rsplotlib/_rcparams.py +0 -0
  28. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/python/rsplotlib/pylab.py +0 -0
  29. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/python/rsplotlib/style.py +0 -0
  30. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/python/rsplotlib/ticker.py +0 -0
  31. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/rust-toolchain.toml +0 -0
  32. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/axes_grid.rs +0 -0
  33. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/axes_legend.rs +0 -0
  34. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/axes_mesh.rs +0 -0
  35. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/axes_title.rs +0 -0
  36. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/axis.rs +0 -0
  37. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/colormap.rs +0 -0
  38. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/colors.rs +0 -0
  39. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/marker.rs +0 -0
  40. {rsplotlib-0.1.4 → rsplotlib-0.1.5}/src/text_utils.rs +0 -0
@@ -27,6 +27,7 @@ uv.lock
27
27
  Thumbs.db
28
28
 
29
29
  # Data / plots
30
+ testing/
30
31
  main*.py
31
32
  out/
32
33
  wheelhouse/
@@ -339,7 +339,7 @@ dependencies = [
339
339
 
340
340
  [[package]]
341
341
  name = "rsplotlib"
342
- version = "0.1.4"
342
+ version = "0.1.5"
343
343
  dependencies = [
344
344
  "plotters",
345
345
  "png",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rsplotlib"
3
- version = "0.1.4"
3
+ version = "0.1.5"
4
4
  edition = "2024"
5
5
  readme = "README.md"
6
6
 
@@ -1,16 +1,33 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rsplotlib
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: 3
6
+ Classifier: Programming Language :: Python :: 3 :: Only
7
+ Classifier: Programming Language :: Python :: 3.8
8
+ Classifier: Programming Language :: Python :: 3.9
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
6
13
  Classifier: Programming Language :: Python :: Implementation :: CPython
7
14
  Classifier: License :: OSI Approved :: MIT License
8
- Classifier: Operating System :: OS Independent
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: POSIX :: Linux
9
18
  Classifier: Topic :: Scientific/Engineering :: Visualization
10
- Requires-Dist: xlrd>=2.0.2
19
+ Requires-Dist: pytest>=7.0 ; extra == 'dev'
20
+ Requires-Dist: pillow>=9.0 ; extra == 'dev'
21
+ Requires-Dist: numpy>=1.20 ; extra == 'dev'
22
+ Requires-Dist: pytest>=7.0 ; extra == 'test'
23
+ Requires-Dist: pillow>=9.0 ; extra == 'test'
24
+ Requires-Dist: numpy>=1.20 ; extra == 'test'
25
+ Provides-Extra: dev
26
+ Provides-Extra: test
11
27
  License-File: LICENSE
12
28
  Summary: A high-performance matplotlib-compatible plotting library powered by Rust
13
- Author: rsplotlib contributors
29
+ Keywords: plotting,matplotlib,visualization,rust,scientific
30
+ Author: YJ-Niu
14
31
  License: MIT
15
32
  Requires-Python: >=3.8
16
33
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
@@ -6,10 +6,16 @@ set -euo pipefail
6
6
 
7
7
  RELEASE=true
8
8
  OUT_DIR="wheelhouse"
9
+ cache_file="/Users/user/Desktop/rust_project/rsplotlib/python/rsplotlib/rsplotlib.cpython-313-darwin.so"
9
10
  # 如果 wheelhouse 目录存在, 则删除
10
11
  if [[ -d "$OUT_DIR" ]]; then
11
12
  rm -rf "$OUT_DIR"
12
13
  fi
14
+ # 如果 cache_file 目录存在, 则删除
15
+ if [[ -f "$cache_file" ]]; then
16
+ rm "$cache_file"
17
+ fi
18
+
13
19
  # Default python executable; may be overridden by --python or positional arg
14
20
  PYTHON_EXEC="python"
15
21
  # Flag set when the user explicitly provided a Python executable
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["maturin>=1.13,<2.0"]
3
+ build-backend = "maturin"
4
+
5
+ [project]
6
+ name = "rsplotlib"
7
+ version = "0.1.5"
8
+ description = "A high-performance matplotlib-compatible plotting library powered by Rust"
9
+ readme = "README_zh.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.8"
12
+ authors = [
13
+ { name = "YJ-Niu" },
14
+ ]
15
+ classifiers = [
16
+ "Programming Language :: Rust",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3 :: Only",
19
+ "Programming Language :: Python :: 3.8",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: Implementation :: CPython",
26
+ "License :: OSI Approved :: MIT License",
27
+ "Operating System :: MacOS",
28
+ "Operating System :: Microsoft :: Windows",
29
+ "Operating System :: POSIX :: Linux",
30
+ "Topic :: Scientific/Engineering :: Visualization",
31
+ ]
32
+ keywords = ["plotting", "matplotlib", "visualization", "rust", "scientific"]
33
+ dependencies = []
34
+
35
+ [project.optional-dependencies]
36
+ test = [
37
+ "pytest>=7.0",
38
+ "pillow>=9.0",
39
+ "numpy>=1.20",
40
+ ]
41
+ dev = [
42
+ "pytest>=7.0",
43
+ "pillow>=9.0",
44
+ "numpy>=1.20",
45
+ ]
46
+
47
+ [tool.maturin]
48
+ python-source = "python"
@@ -301,7 +301,7 @@ def contourf(X, Y, Z, levels=None, cmap='coolwarm', alpha=1.0):
301
301
 
302
302
  def stackplot(x, *args, labels=None, colors=None, alpha=1.0):
303
303
  """绘制堆叠面积图
304
-
304
+
305
305
  Args:
306
306
  x: x 轴数据
307
307
  *args: 多个 y 数据数组
@@ -309,11 +309,10 @@ def stackplot(x, *args, labels=None, colors=None, alpha=1.0):
309
309
  colors: 颜色列表 (默认: None)
310
310
  alpha: 透明度 (默认: 1.0)
311
311
  """
312
- try:
313
- return _rsplotlib.stackplot(x, args, labels, colors, alpha)
314
- except AttributeError:
315
- _warnings.warn("stackplot is not yet implemented in rsplotlib")
316
- return None
312
+ y_data = list(args) if args else []
313
+ if len(y_data) == 1 and isinstance(y_data[0], (list, tuple)) and y_data[0] and isinstance(y_data[0][0], (list, tuple)):
314
+ y_data = list(y_data[0])
315
+ return _rsplotlib.stackplot(_to_list(x), y_data, labels, colors, alpha)
317
316
 
318
317
 
319
318
  # ==================== 辅助元素 ====================
@@ -78,8 +78,13 @@ class SubplotSpec:
78
78
  self.row_end = row_end
79
79
  self.col_start = col_start
80
80
  self.col_end = col_end
81
- self.numRows = gridspec.nrows
82
- self.numCols = gridspec.ncols
81
+ if gridspec is not None:
82
+ self.numRows = gridspec.nrows
83
+ self.numCols = gridspec.ncols
84
+ else:
85
+ # 用于模式 (nrows, ncols, index) 调用 add_subplot
86
+ self.numRows = max(row_end, 1)
87
+ self.numCols = max(col_end, 1)
83
88
  self.rowStart = row_start
84
89
  self.rowStop = row_end
85
90
  self.colStart = col_start
@@ -87,6 +92,12 @@ class SubplotSpec:
87
92
 
88
93
  def get_position(self, figure):
89
94
  """返回子图位置 (left, bottom, width, height)"""
95
+ if self.gridspec is None:
96
+ # 没有 gridspec 时使用均匀划分
97
+ return (self.colStart / self.numCols,
98
+ 1.0 - self.rowEnd / self.numRows,
99
+ (self.colEnd - self.colStart) / self.numCols,
100
+ (self.rowEnd - self.rowStart) / self.numRows)
90
101
  row_heights = self.gridspec.height_ratios
91
102
  col_widths = self.gridspec.width_ratios
92
103