yxsplot 0.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-present Xiaosheng Yang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
yxsplot-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,470 @@
1
+ Metadata-Version: 2.4
2
+ Name: yxsplot
3
+ Version: 0.1.0
4
+ Summary: Smooth and interactive 2D plotting for large-scale datasets.
5
+ Author: Xiaosheng Yang
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026-present Xiaosheng Yang
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Project-URL: Homepage, https://github.com/yangxiaosheng27/yxsplot
28
+ Project-URL: Repository, https://github.com/yangxiaosheng27/yxsplot
29
+ Project-URL: Changelog, https://github.com/yangxiaosheng27/yxsplot/blob/master/CHANGELOG.md
30
+ Classifier: Development Status :: 3 - Alpha
31
+ Classifier: Intended Audience :: Developers
32
+ Classifier: Intended Audience :: Science/Research
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Operating System :: OS Independent
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: Programming Language :: Python :: 3.13
38
+ Classifier: Topic :: Scientific/Engineering :: Visualization
39
+ Requires-Python: >=3.12
40
+ Description-Content-Type: text/markdown
41
+ License-File: LICENSE.txt
42
+ Requires-Dist: numpy>=1.26.4
43
+ Requires-Dist: matplotlib>=3.8.0
44
+ Requires-Dist: mplcursors<=0.7.1,>=0.5.3
45
+ Dynamic: license-file
46
+
47
+ # yxsplot
48
+
49
+ **Smooth and interactive 2D plotting for large-scale datasets.**
50
+
51
+ 🌍 **Language: [English](#english) | [中文](#中文)**
52
+
53
+ ---
54
+
55
+ ## English
56
+
57
+ `yxsplot` is a **user-friendly** Python visualization library built on top of **Matplotlib** and **mplcursors**. It is designed to help you **explore large datasets smoothly** by implementing automatic data decimation and compression. Beyond performance, it provides a comprehensive suite of native mouse interactions (zoom, pan, annotate, measure) without requiring complex event-handling code.
58
+
59
+ ## ✨ Core Features
60
+
61
+ - 🚀 **Smooth Large-Scale Plotting**: Automatically compresses and decimates data during rendering, ensuring fluid interaction even with datasets containing over 1,000,000 points.
62
+ - 🖱️ **Rich Native Interactions**: Full support for Left, Right, and Middle mouse button actions including zooming, panning, annotating, and measuring.
63
+ - 📏 **Built-in Tools**: Includes ruler tools, time-range sliders, color bars, and view history navigation.
64
+ - 📊 **Flexible Layouts**: Easy support for multi-subplot sharing (X/Y axes), logarithmic scales, and equal aspect ratios.
65
+ - 🏷️ **Smart Annotations**: Click to show/hide data labels, click legends to toggle visibility, and custom data info tooltips.
66
+
67
+ ## 🖱️ Interaction Guide
68
+
69
+ `yxsplot` comes with an intuitive default interaction scheme. No extra code is needed to enable these features:
70
+
71
+ | Action | Mouse / Keyboard | Description |
72
+ | :--- | :--- | :--- |
73
+ | **Zoom In** | Left Drag | Draw a box to zoom into a specific region. |
74
+ | **Reset View** | Right Click | Reset the plot to the original full view. |
75
+ | **Pan** | Right Drag | Move the view horizontally or vertically. |
76
+ | **Zoom Scroll** | Middle Wheel | Zoom in/out centered on the cursor. |
77
+ | **Auto-Scale Y** | Right Long Press | Automatically adjust the Y-axis scale to fit visible data. |
78
+ | **Show Label** | Left Click (on point) | Display data label for the specific point. |
79
+ | **Hide Label** | Right Click (on label) | Remove the displayed data label. |
80
+ | **Toggle Curve** | Left Click (on legend) | Show or hide the corresponding curve. |
81
+ | **Ruler Tool** | Middle Drag | Draw a ruler to measure distance between points. |
82
+ | **Clear Ruler** | Middle Click | Clear all active rulers. |
83
+ | **History Back** | Keyboard ← | Go to the previous view state. |
84
+ | **History Forward**| Keyboard → | Go to the next view state. |
85
+ | **Reload Uncompressed View** | Left Click ↻ | Reload and render the view without data compression (may be time-consuming). |
86
+
87
+ ## 📦 Installation
88
+
89
+ ```bash
90
+ pip install yxsplot
91
+ ```
92
+
93
+ > **Requirements**: Python 3.12+, numpy, matplotlib, mplcursors.
94
+
95
+ ## 🚀 Quick Start Examples
96
+
97
+ ### 1. Basic Plotting with Large-Scale Data
98
+
99
+ Get started with a simple sine wave. Notice how `yxsplot` handles 1 million points effortlessly. You can also apply masks to filter data dynamically.
100
+
101
+ ```python
102
+ import numpy as np
103
+ from yxsplot import plot, show_figure
104
+
105
+ # Generate 1 million points
106
+ n = 1_000_000
107
+ x = np.linspace(0, 2 * np.pi, n)
108
+ y = np.sin(x)
109
+
110
+ # Create an interactive plot
111
+ # 'mask' allows you to filter data visually without changing the source array
112
+ ax = plot(
113
+ x,
114
+ y,
115
+ data_name="Sine Wave (y > -0.5)",
116
+ x_name="Time (s)",
117
+ y_name="Amplitude",
118
+ title="Basic Plotting Demo (1M Points)",
119
+ mask=y > -0.5, # Only display points where y > -0.5
120
+ )
121
+
122
+ # Show the plot window
123
+ show_figure()
124
+ ```
125
+
126
+ ### 2. Multi-Plots with Shared Axes
127
+
128
+ Easily create complex dashboards with shared X/Y axes. `yxsplot` synchronizes interactions across plots automatically.
129
+
130
+ ```python
131
+ import numpy as np
132
+ from yxsplot import plot, show_figure
133
+
134
+ # Generate 1 million data points
135
+ n = 1_000_000
136
+ x = np.linspace(0, 2 * np.pi, n)
137
+ y1 = np.sin(x)
138
+ y2 = np.cos(x)
139
+
140
+ # --- Plot 1: Base Sine Wave (Master View) ---
141
+ # Creates the first figure window and axes. This serves as the "master"
142
+ # for sharing coordinates with other plots.
143
+ ax1 = plot(
144
+ x,
145
+ y1,
146
+ data_name="Sine",
147
+ title="Overlay & Linking Demo (Master View)",
148
+ )
149
+
150
+ # --- Plot 2: Overlay Curve on Same Axes (Not a Subplot) ---
151
+ # Setting 'new_fig=False' draws this curve on the **exact same** axes object as ax1.
152
+ # This adds a new curve that shares the identical X/Y axis scales and limits
153
+ # with the previous one, displaying both lines overlaid on the same canvas.
154
+ ax2 = plot(
155
+ x,
156
+ y2,
157
+ data_name="Cosine",
158
+ new_fig=False, # Critical: Do not create a new window/axes; overlay directly onto ax1
159
+ )
160
+
161
+ # --- Plot 3: Fully Linked View (Synchronized Zoom/Pan) ---
162
+ # This creates a **new**, independent figure window, but binds its axes to ax1.
163
+ # When you zoom or pan in 'ax1' (the first window), 'ax3' (this window) updates identically.
164
+ ax3 = plot(
165
+ x,
166
+ y1,
167
+ data_name="Sine Color Map",
168
+ share_x=ax1, # Link X-axis: Zooming/panning ax1 automatically syncs ax3's X view
169
+ share_y=ax1, # Link Y-axis: Zooming/panning ax1 automatically syncs ax3's Y view
170
+ title="Linked View",
171
+ color=y1, # Enable color mapping: Display gradient based on Y values
172
+ color_name="Value",
173
+ # Note: Since 'new_fig=False' is not set here, this opens in a separate window.
174
+ # However, it stays perfectly synchronized with the first window.
175
+ # Ideal for comparing views (e.g., raw waveforms vs. heatmaps).
176
+ )
177
+
178
+ # Render and display all created interactive windows.
179
+ # Result: Two windows will pop up:
180
+ # 1. [Overlay Plot]: Sine and Cosine curves displayed together in the same coordinate system.
181
+ # 2. [Linked Plot]: An independent color-mapped plot whose view range syncs in real-time with Window 1.
182
+ show_figure()
183
+ ```
184
+
185
+ ### 3. Advanced Features: Log Scale, Time Range & Data Info
186
+
187
+ Explore advanced capabilities like logarithmic scales, time-range sliders, and custom data information tooltips.
188
+
189
+ ```python
190
+ import numpy as np
191
+ from yxsplot import plot, show_figure
192
+
193
+ # Generate 1 million points for a unit circle
194
+ n = 1_000_000
195
+ t = np.linspace(0, 2 * np.pi, n)
196
+ x = np.cos(t)
197
+ y = np.sin(t)
198
+
199
+ # Prepare custom metadata to display in interactive data info.
200
+ # Keys become labels, values must be arrays of length n.
201
+ data_info = {
202
+ "Category": ["Circle"] * n, # Constant string for all points
203
+ "Tag": ["OK"] * n, # Custom tag string
204
+ "Flag (y > 0)": y > 0, # Boolean mask (e.g., Upper half)
205
+ }
206
+
207
+ # --- Plot 1: Logarithmic Scale & Custom Marker ---
208
+ # Transforms coordinates using exp() to demonstrate log-scale visualization.
209
+ # Since x and y are from a circle (-1 to 1), exp(x) and exp(y) will be positive.
210
+ ax = plot(
211
+ np.exp(x), # X data (transformed)
212
+ np.exp(y), # Y data (transformed)
213
+ data_name="exp circle", # Legend label
214
+ x_name="log x", # X-axis label
215
+ y_name="log y", # Y-axis label
216
+ log_x=True, # Enable logarithmic scale for X-axis
217
+ log_y=True, # Enable logarithmic scale for Y-axis
218
+ line_marker="*", # Use star markers instead of default lines/dots
219
+ title="Advanced: Log Scale & Custom Line Marker",
220
+ )
221
+
222
+ # --- Plot 2: Equal Aspect Ratio, Color Mapping & Data Info ---
223
+ # Plots the original circle with additional interactive features.
224
+ ax2 = plot(
225
+ x, # Original X data
226
+ y, # Original Y data
227
+ x_name="x", # X-axis label
228
+ y_name="y", # Y-axis label
229
+ color=t, # Map the parameter 't' (angle) to color
230
+ color_name="t", # Label for the color bar
231
+ data_info=data_info, # Attach custom tooltip data defined above
232
+ equal_scale=True, # Force 1:1 aspect ratio (crucial for circles)
233
+ time_range=[1, 5], # Initialize the time-range slider with this window
234
+ title="Advanced: Equal Scale & Custom Data Info",
235
+ )
236
+
237
+ # Render and display the interactive window containing both plots
238
+ show_figure()
239
+ ```
240
+
241
+ ## 🛠️ Why yxsplot?
242
+
243
+ Standard Matplotlib scripts often struggle with large datasets, becoming sluggish when interacting with more than 100k points. `yxsplot` improves this experience by:
244
+
245
+ 1. **Intelligent Decimation**: Automatically reducing point density based on screen resolution while preserving peak values.
246
+ 2. **Unified Interaction Model**: Combining zoom, pan, annotation, and measurement into a single, consistent mouse interface.
247
+ 3. **Developer Friendly**: A simple functional API that hides the complexity of event connections and blitting.
248
+
249
+ ## 📄 License
250
+
251
+ This project is licensed under the **MIT License**.
252
+
253
+ Copyright (c) 2026-present Xiaosheng Yang
254
+
255
+ ## 🙋‍♂️ Author
256
+
257
+ - **Xiaosheng Yang**
258
+
259
+ 🐛 [Open an Issue](https://github.com/yangxiaosheng27/yxsplot/issues) for bugs or features
260
+ 🔗 [GitHub Repository](https://github.com/yangxiaosheng27/yxsplot)
261
+
262
+ ---
263
+
264
+ ## 中文
265
+
266
+ `yxsplot` 是一个**用户友好型**的 Python 可视化库,基于 **Matplotlib** 和 **mplcursors** 构建。它旨在通过自动数据降采样和压缩技术,帮助你**流畅地探索大规模数据集**。除了性能优化,它还提供了全套原生的鼠标交互功能(缩放、平移、标注、测量),无需编写复杂的事件处理代码。
267
+
268
+ ## ✨ 核心特性
269
+
270
+ - 🚀 **流畅的大规模绘图**:在渲染时自动压缩和降采样数据,即使面对超过 100 万个数据点,也能确保交互流畅。
271
+ - 🖱️ **丰富的原生交互**:全面支持鼠标左、右、中键操作,包括区域缩放、视图平移、数据标注和距离测量。
272
+ - 📏 **内置实用工具**:包含标尺工具、时间范围滑块、颜色条以及视图历史导航功能。
273
+ - 📊 **灵活的布局**:轻松支持多子图坐标轴共享(X/Y 轴)、对数刻度以及等比例显示。
274
+ - 🏷️ **智能标注**:点击数据点显示/隐藏标签,点击图例切换曲线可见性,并支持自定义数据信息提示框。
275
+
276
+ ## 🖱️ 交互指南
277
+
278
+ `yxsplot` 自带一套直观的默认交互方案,无需额外代码即可直接使用:
279
+
280
+ | 操作 | 鼠标 / 键盘 | 描述 |
281
+ | :--- | :--- | :--- |
282
+ | **框选视图** | 左键拖拽 | 绘制矩形框以放大特定区域。 |
283
+ | **重置视图** | 右键单击 | 将视图重置为初始的全景状态。 |
284
+ | **平移视图** | 右键拖拽 | 水平或垂直移动视图。 |
285
+ | **缩放视图** | 中键滚轮 | 以光标为中心进行放大/缩小。 |
286
+ | **纵轴自适应** | 右键长按 | 自动调整 Y 轴刻度以适配当前可见数据。 |
287
+ | **显示数据标签** | 左键单击 (数据点) | 显示该数据点的详细信息标签。 |
288
+ | **隐藏数据标签** | 右键单击 (标签) | 移除已显示的标签。 |
289
+ | **开关曲线显示** | 左键单击 (图例) | 显示或隐藏对应的曲线。 |
290
+ | **标尺工具** | 中键拖拽 | 绘制标尺以测量两点间的距离。 |
291
+ | **清除标尺** | 中键单击 | 清除所有激活的标尺。 |
292
+ | **历史视图后退** | 键盘 ← | 返回上一个视图状态。 |
293
+ | **历史视图前进** | 键盘 → | 进入下一个视图状态。 |
294
+ | **重载无压缩视图** | 左键点击 ↻ | 重新加载并渲染无数据压缩的视图(可能很耗时)。 |
295
+
296
+ ## 📦 安装
297
+
298
+ ```bash
299
+ pip install yxsplot
300
+ ```
301
+
302
+ > **环境要求**: Python 3.12+, numpy, matplotlib, mplcursors.
303
+
304
+ ## 🚀 快速开始示例
305
+
306
+ ### 1. 百万级数据的基础绘图
307
+
308
+ 从一个简单的正弦波开始。注意 `yxsplot` 如何轻松处理 100 万个数据点。你还可以使用掩码(mask)动态过滤数据。
309
+
310
+ ```python
311
+ import numpy as np
312
+ from yxsplot import plot, show_figure
313
+
314
+ # 生成 100 万个数据点
315
+ n = 1_000_000
316
+ x = np.linspace(0, 2 * np.pi, n)
317
+ y = np.sin(x)
318
+
319
+ # 创建交互式图表
320
+ # 'mask' 参数允许你在不修改原始数据数组的情况下,通过布尔索引进行视觉过滤。
321
+ # 只有满足条件的点会被渲染,这能显著提高大数据量下的局部查看性能或突出特定区域。
322
+ ax = plot(
323
+ x,
324
+ y,
325
+ data_name="正弦波(y > -0.5)",
326
+ x_name="时间 (s)",
327
+ y_name="振幅",
328
+ title="基础绘图演示 (100 万数据点)",
329
+ mask=y > -0.5, # 仅显示 y > -0.5 的数据点
330
+ )
331
+
332
+ # 显示绘图窗口
333
+ show_figure()
334
+ ```
335
+
336
+ ### 2. 共享轴的多图
337
+
338
+ 轻松创建带有共享X/Y轴的复杂绘图。`yxsplot`会自动同步各图之间的交互。
339
+
340
+ ```python
341
+ import numpy as np
342
+ from yxsplot import plot, show_figure
343
+
344
+ # 生成 100 万个数据点
345
+ n = 1_000_000
346
+ x = np.linspace(0, 2 * np.pi, n)
347
+ y1 = np.sin(x)
348
+ y2 = np.cos(x)
349
+
350
+ # --- 图 1: 基础正弦 (主视图) ---
351
+ # 创建第一个图形窗口和坐标轴。它将作为其他图表共享坐标轴的“主控端”。
352
+ ax1 = plot(
353
+ x,
354
+ y1,
355
+ data_name="正弦",
356
+ title="同轴叠加与联动演示 (主视图)",
357
+ )
358
+
359
+ # --- 图 2: 同轴叠加曲线 (非子图) ---
360
+ # 设置 'new_fig=False' 将此曲线绘制在与 ax1 **完全相同** 的坐标轴上。
361
+ # 新增另一条曲线,与上一条曲线共享同一套 X/Y 轴刻度和范围,在同一个画布上显示。
362
+ ax2 = plot(
363
+ x,
364
+ y2,
365
+ data_name="余弦",
366
+ new_fig=False, # 关键参数:不建新窗口/新坐标轴,直接叠加到当前 ax1 上
367
+ )
368
+
369
+ # --- 图 3: 完全联动视图 (同步缩放/平移) ---
370
+ # 这将创建一个 **新** 的独立图形窗口,但将其坐标轴与 ax1 绑定。
371
+ # 当你在 'ax1' (第一个窗口) 中进行缩放或平移时,'ax3' (这个窗口) 会完全同步更新。
372
+ ax3 = plot(
373
+ x,
374
+ y1,
375
+ data_name="正弦色谱",
376
+ share_x=ax1, # 联动 X 轴:ax1 的缩放/平移会自动同步到 ax3 的 X 轴视图
377
+ share_y=ax1, # 联动 Y 轴:ax1 的缩放/平移会自动同步到 ax3 的 Y 轴视图
378
+ title="联动视图",
379
+ color=y1, # 启用色谱:根据 Y 值显示颜色梯度
380
+ color_name="数值",
381
+ # 注意:由于未设置 new_fig=False,这将在一个独立的窗口中打开,
382
+ # 但该窗口会与第一个窗口保持完美的视图同步。适合对比观察(如:原始波形 vs 热力图)。
383
+ )
384
+
385
+ # 渲染并显示所有已创建的交互式窗口
386
+ # 运行后将弹出两个窗口:
387
+ # 1. 【叠加图】:同一个坐标系内同时显示正弦和余弦两条曲线。
388
+ # 2. 【联动图】:独立的色谱图,其视图范围随第 1 个窗口实时同步。
389
+ show_figure()
390
+ ```
391
+
392
+ ### 3. 高级功能:对数刻度、时间范围与数据信息
393
+
394
+ 探索对数刻度、时间范围滑块以及自定义数据信息提示框等高级功能。
395
+
396
+ ```python
397
+ import numpy as np
398
+ from yxsplot import plot, show_figure
399
+
400
+ # 生成 100 万个点来构建一个单位圆
401
+ n = 1_000_000
402
+ t = np.linspace(0, 2 * np.pi, n)
403
+ x = np.cos(t)
404
+ y = np.sin(t)
405
+
406
+ # 准备自定义元数据,用于在交互式数据信息框中显示。
407
+ # 字典的键将作为标签,值必须是长度为 n 的数组。
408
+ data_info = {
409
+ "类别": ["圆形"] * n, # 所有点共有的常量字符串
410
+ "标签": ["OK"] * n, # 自定义标签字符串
411
+ "标记 (y > 0)": y > 0, # 布尔掩码(例如:区分上半圆,True/False)
412
+ }
413
+
414
+ # --- 图 1: 对数坐标与自定义标记 ---
415
+ # 使用 exp() 变换坐标以演示对数刻度的可视化效果。
416
+ # 由于 x 和 y 来自单位圆 (-1 到 1),exp(x) 和 exp(y) 将保证为正数,适合对数坐标。
417
+ # 注意:此处未设置 new_fig=False,因此这将弹出一个【独立】的新窗口。
418
+ ax1 = plot(
419
+ np.exp(x), # X 数据(变换后)
420
+ np.exp(y), # Y 数据(变换后)
421
+ data_name="指数圆", # 图例标签
422
+ x_name="log x", # X 轴标签
423
+ y_name="log y", # Y 轴标签
424
+ log_x=True, # 启用 X 轴对数刻度
425
+ log_y=True, # 启用 Y 轴对数刻度
426
+ line_marker="*", # 使用星号标志,而非默认的线点
427
+ title="高级功能:对数刻度、自定义线条标志",
428
+ )
429
+
430
+ # --- 图 2: 等比例约束、色谱与数据信息 ---
431
+ # 绘制原始圆形,并添加更多交互功能。
432
+ # 注意:同样未设置 new_fig=False,因此这将弹出【第二个独立】的新窗口。
433
+ ax2 = plot(
434
+ x, # 原始 X 数据
435
+ y, # 原始 Y 数据
436
+ x_name="x", # X 轴标签
437
+ y_name="y", # Y 轴标签
438
+ color=t, # 将参数 't' (角度) 映射为颜色
439
+ color_name="t", # 颜色条的标签
440
+ data_info=data_info, # 绑定上方定义的自定义提示框数据
441
+ equal_scale=True, # 强制 1:1 纵横比(对于绘制正圆至关重要,否则圆会变椭圆)
442
+ time_range=[1, 5], # 初始化时间范围滑块的默认显示窗口
443
+ title="高级功能:等比例约束、自定义数据信息",
444
+ )
445
+
446
+ # 渲染并显示所有已创建的交互式图窗
447
+ # 由于上面创建了两个独立的图,这里会同时弹出两个窗口
448
+ show_figure()
449
+ ```
450
+
451
+ ## 🛠️ 为什么选择 yxsplot?
452
+
453
+ 标准的 Matplotlib 脚本在处理大数据集时往往表现吃力,当数据点超过 10 万时交互容易变得卡顿。`yxsplot` 通过以下方式改善这一体验:
454
+
455
+ 1. **智能降采样**:根据屏幕分辨率自动降低点密度,同时保留峰值特征。
456
+ 2. **统一的交互模型**:将缩放、平移、标注和测量整合到一个一致且直观的鼠标操作界面中。
457
+ 3. **开发者友好**:提供简洁的函数式 API,隐藏了事件连接和 blitting 的复杂性。
458
+
459
+ ## 📄 许可证
460
+
461
+ 本项目采用 **MIT License** 授权。
462
+
463
+ Copyright (c) 2026-present Xiaosheng Yang
464
+
465
+ ## 🙋‍♂️ 作者
466
+
467
+ - **杨晓生**
468
+
469
+ 🐛 [提交 Issue](https://github.com/yangxiaosheng27/yxsplot/issues) 反馈问题或建议
470
+ 🔗 [GitHub 仓库](https://github.com/yangxiaosheng27/yxsplot)