plotille 4.0.2__tar.gz → 6.0.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.
Potentially problematic release.
This version of plotille might be problematic. Click here for more details.
- plotille-4.0.2/README.md → plotille-6.0.0/PKG-INFO +101 -14
- plotille-4.0.2/PKG-INFO → plotille-6.0.0/README.md +73 -44
- {plotille-4.0.2 → plotille-6.0.0}/plotille/__init__.py +13 -16
- {plotille-4.0.2 → plotille-6.0.0}/plotille/_canvas.py +134 -69
- {plotille-4.0.2 → plotille-6.0.0}/plotille/_cmaps.py +44 -31
- plotille-6.0.0/plotille/_cmaps_data.py +1601 -0
- {plotille-4.0.2 → plotille-6.0.0}/plotille/_colors.py +178 -119
- plotille-6.0.0/plotille/_data_metadata.py +103 -0
- {plotille-4.0.2 → plotille-6.0.0}/plotille/_dots.py +50 -36
- plotille-6.0.0/plotille/_figure.py +982 -0
- plotille-6.0.0/plotille/_figure_data.py +295 -0
- plotille-6.0.0/plotille/_graphs.py +373 -0
- {plotille-4.0.2 → plotille-6.0.0}/plotille/_input_formatter.py +89 -61
- plotille-6.0.0/plotille/_util.py +92 -0
- {plotille-4.0.2 → plotille-6.0.0}/plotille/data.py +41 -34
- plotille-6.0.0/pyproject.toml +147 -0
- plotille-4.0.2/LICENSE.txt +0 -21
- plotille-4.0.2/plotille/_cmaps_data.py +0 -1592
- plotille-4.0.2/plotille/_figure.py +0 -604
- plotille-4.0.2/plotille/_figure_data.py +0 -221
- plotille-4.0.2/plotille/_graphs.py +0 -214
- plotille-4.0.2/plotille/_util.py +0 -137
- plotille-4.0.2/pyproject.toml +0 -88
- plotille-4.0.2/setup.py +0 -30
|
@@ -1,17 +1,44 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: plotille
|
|
3
|
+
Version: 6.0.0
|
|
4
|
+
Summary: Plot in the terminal using braille dots.
|
|
5
|
+
Keywords: plot,scatter,histogram,terminal,braille,unicode,timeseries
|
|
6
|
+
Author: Tammo Ippen
|
|
7
|
+
Author-email: Tammo Ippen <tammo.ippen@posteo.de>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
22
|
+
Classifier: Topic :: Terminals
|
|
23
|
+
Requires-Python: >=3.10, <4
|
|
24
|
+
Project-URL: Homepage, https://github.com/tammoippen/plotille
|
|
25
|
+
Project-URL: Repository, https://github.com/tammoippen/plotille
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
1
28
|

|
|
2
29
|
|
|
3
30
|
# Plotille
|
|
4
31
|
|
|
5
32
|
[](https://github.com/tammoippen/plotille/actions/workflows/CI.yml)
|
|
6
33
|
[](https://codecov.io/gh/tammoippen/plotille)
|
|
7
|
-
[](https://img.shields.io/badge/pypy-2.7--7.3%2C%203.7--7.3%2C%203.8--7.3-brightgreen.svg)
|
|
34
|
+
[](https://img.shields.io/badge/cpython-3.10%2C%203.11%2C%203.12%2C%203.13%203.14-brightgreen.svg)
|
|
35
|
+
[](https://img.shields.io/badge/pypy-3.11-brightgreen.svg)
|
|
10
36
|
[](https://pypi.python.org/pypi/plotille)
|
|
11
37
|
[](https://pepy.tech/project/plotille)
|
|
12
38
|
[](https://pypi.python.org/pypi/plotille)
|
|
39
|
+
[](https://github.com/astral-sh/ruff)
|
|
13
40
|
|
|
14
|
-
|
|
41
|
+
Plots, scatter plots, histograms and heatmaps in the terminal using braille dots, and foreground and background colors - with no dependencies. Make complex figures using the Figure class or make fast and simple plots using graphing function - similar to a very small sibling to matplotlib. Or use the canvas to plot dots, lines and images yourself.
|
|
15
42
|
|
|
16
43
|
Install:
|
|
17
44
|
|
|
@@ -26,7 +53,11 @@ Similar to other libraries:
|
|
|
26
53
|
- like [termgraph](https://github.com/sgeisler/termgraph) (not on pypi), but very different style.
|
|
27
54
|
- like [terminalplot](https://github.com/kressi/terminalplot), but with braille, X/Y-axis, histogram, linear interpolation.
|
|
28
55
|
|
|
29
|
-
Basic support for timeseries plotting is provided with release 3.2: for any `X` or `Y` values you can also add `datetime.datetime
|
|
56
|
+
Basic support for timeseries plotting is provided with release 3.2: for any `X` or `Y` values you can also add `datetime.datetime` or `numpy.datetime64` values. Labels are generated respecting the difference of `x_limits` and `y_limits`.
|
|
57
|
+
|
|
58
|
+
Support for heatmaps using background colors for figures and displaying images binary with braille, or in color with background colors using the canvas - provided with release 4.0
|
|
59
|
+
|
|
60
|
+
If you are still using python 2.7, please use plotille v4 or before. With v5 I am dropping support for python 2.7, as the effort to maintain the discontinued version is too much.
|
|
30
61
|
|
|
31
62
|
## Documentation
|
|
32
63
|
|
|
@@ -38,7 +69,7 @@ In [3]: X = np.sort(np.random.normal(size=1000))
|
|
|
38
69
|
|
|
39
70
|
### Figure
|
|
40
71
|
|
|
41
|
-
To construct plots the
|
|
72
|
+
To construct plots the recommended way is to use a `Figure`:
|
|
42
73
|
|
|
43
74
|
```python
|
|
44
75
|
In [12]: plotille.Figure?
|
|
@@ -152,10 +183,10 @@ Parameters:
|
|
|
152
183
|
X: List[float] X values.
|
|
153
184
|
Y: List[float] Y values. X and Y must have the same number of entries.
|
|
154
185
|
width: int The number of characters for the width (columns) of the canvas.
|
|
155
|
-
|
|
186
|
+
height: int The number of characters for the height (rows) of the canvas.
|
|
156
187
|
X_label: str Label for X-axis.
|
|
157
188
|
Y_label: str Label for Y-axis. max 8 characters.
|
|
158
|
-
linesep: str The requested line
|
|
189
|
+
linesep: str The requested line separator. default: os.linesep
|
|
159
190
|
interp: Optional[str] Specify interpolation; values None, 'linear'
|
|
160
191
|
x_min, x_max: float Limits for the displayed X values.
|
|
161
192
|
y_min, y_max: float Limits for the displayed Y values.
|
|
@@ -207,10 +238,10 @@ Parameters:
|
|
|
207
238
|
X: List[float] X values.
|
|
208
239
|
Y: List[float] Y values. X and Y must have the same number of entries.
|
|
209
240
|
width: int The number of characters for the width (columns) of the canvas.
|
|
210
|
-
|
|
241
|
+
height: int The number of characters for the height (rows) of the canvas.
|
|
211
242
|
X_label: str Label for X-axis.
|
|
212
243
|
Y_label: str Label for Y-axis. max 8 characters.
|
|
213
|
-
linesep: str The requested line
|
|
244
|
+
linesep: str The requested line separator. default: os.linesep
|
|
214
245
|
x_min, x_max: float Limits for the displayed X values.
|
|
215
246
|
y_min, y_max: float Limits for the displayed Y values.
|
|
216
247
|
lc: multiple Give the line color.
|
|
@@ -256,7 +287,7 @@ Parameters:
|
|
|
256
287
|
bins: int The number of bins to put X entries in (rows).
|
|
257
288
|
width: int The number of characters for the width (columns).
|
|
258
289
|
log_scale: bool Scale the histogram with `log` function.
|
|
259
|
-
linesep: str The requested line
|
|
290
|
+
linesep: str The requested line separator. default: os.linesep
|
|
260
291
|
lc: multiple Give the line color.
|
|
261
292
|
bg: multiple Give the background color.
|
|
262
293
|
color_mode: str Specify color input mode; 'names' (default), 'byte' or 'rgb'
|
|
@@ -270,6 +301,56 @@ In [9]: print(plotille.hist(np.random.normal(size=10000)))
|
|
|
270
301
|
|
|
271
302
|

|
|
272
303
|
|
|
304
|
+
#### Hist (aggregated)
|
|
305
|
+
|
|
306
|
+
This function allows you to create a histogram when your data is already aggregated (aka you don't have access to raw values, but you have access to bins and counts for each bin).
|
|
307
|
+
|
|
308
|
+
This comes handy when working with APIs such as [OpenTelemetry Metrics API](https://opentelemetry-python.readthedocs.io/en/latest/api/metrics.html)
|
|
309
|
+
where views such as [ExplicitBucketHistogramAggregation](https://opentelemetry-python.readthedocs.io/en/latest/sdk/metrics.view.html#opentelemetry.sdk.metrics.view.ExplicitBucketHistogramAggregation)
|
|
310
|
+
only expose access to aggregated values (counts for each bin / bucket).
|
|
311
|
+
|
|
312
|
+
```python
|
|
313
|
+
In [8]: plotille.hist_aggregated?
|
|
314
|
+
Signature:
|
|
315
|
+
plotille.hist_aggregated(
|
|
316
|
+
counts,
|
|
317
|
+
bins,
|
|
318
|
+
width=80,
|
|
319
|
+
log_scale=False,
|
|
320
|
+
linesep='\n',
|
|
321
|
+
lc=None,
|
|
322
|
+
bg=None,
|
|
323
|
+
color_mode='names',
|
|
324
|
+
)
|
|
325
|
+
Docstring:
|
|
326
|
+
Create histogram for aggregated data.
|
|
327
|
+
|
|
328
|
+
Parameters:
|
|
329
|
+
counts: List[int] Counts for each bucket.
|
|
330
|
+
bins: List[float] Limits for the bins for the provided counts: limits for
|
|
331
|
+
bin `i` are `[bins[i], bins[i+1])`.
|
|
332
|
+
Hence, `len(bins) == len(counts) + 1`.
|
|
333
|
+
width: int The number of characters for the width (columns).
|
|
334
|
+
log_scale: bool Scale the histogram with `log` function.
|
|
335
|
+
linesep: str The requested line separator. default: os.linesep
|
|
336
|
+
lc: multiple Give the line color.
|
|
337
|
+
bg: multiple Give the background color.
|
|
338
|
+
color_mode: str Specify color input mode; 'names' (default), 'byte' or 'rgb'
|
|
339
|
+
see plotille.color.__docs__
|
|
340
|
+
Returns:
|
|
341
|
+
str: histogram over `X` from left to right.
|
|
342
|
+
|
|
343
|
+
In [9]: counts = [1945, 0, 0, 0, 0, 0, 10555, 798, 0, 28351, 0]
|
|
344
|
+
In [10]: bins = [float('-inf'), 10, 50, 100, 200, 300, 500, 800, 1000, 2000, 10000, float('+inf')]
|
|
345
|
+
In [11]: print(plotille.hist_aggregated(counts, bins))
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Keep in mind that there must always be n+1 bins (n is a total number of count values, 11 in the example above).
|
|
349
|
+
|
|
350
|
+
In this example the first bin is from [-inf, 10) with a count of 1945 and the last bin is from [10000, +inf] with a count of 0.
|
|
351
|
+
|
|
352
|
+

|
|
353
|
+
|
|
273
354
|
#### Histogram
|
|
274
355
|
|
|
275
356
|
There is also another more 'usual' histogram function available:
|
|
@@ -306,7 +387,7 @@ Parameters:
|
|
|
306
387
|
height: int The number of characters for the height (rows).
|
|
307
388
|
X_label: str Label for X-axis.
|
|
308
389
|
Y_label: str Label for Y-axis. max 8 characters.
|
|
309
|
-
linesep: str The requested line
|
|
390
|
+
linesep: str The requested line separator. default: os.linesep
|
|
310
391
|
x_min, x_max: float Limits for the displayed X values.
|
|
311
392
|
y_min, y_max: float Limits for the displayed Y values.
|
|
312
393
|
lc: multiple Give the line color.
|
|
@@ -358,7 +439,7 @@ Initiate a Canvas object
|
|
|
358
439
|
|
|
359
440
|
Parameters:
|
|
360
441
|
width: int The number of characters for the width (columns) of the canvas.
|
|
361
|
-
|
|
442
|
+
height: int The number of characters for the height (rows) of the canvas.
|
|
362
443
|
xmin, ymin: float Lower left corner of reference system.
|
|
363
444
|
xmax, ymax: float Upper right corner of reference system.
|
|
364
445
|
background: multiple Background color of the canvas.
|
|
@@ -506,7 +587,7 @@ Docstring:
|
|
|
506
587
|
Transform canvas into `print`-able string
|
|
507
588
|
|
|
508
589
|
Parameters:
|
|
509
|
-
linesep: str The requested line
|
|
590
|
+
linesep: str The requested line separator. default: os.linesep
|
|
510
591
|
|
|
511
592
|
Returns:
|
|
512
593
|
unicode: The canvas as a string.
|
|
@@ -555,3 +636,9 @@ In [29]: print(cvs.plot())
|
|
|
555
636
|
## Stargazers over time
|
|
556
637
|
|
|
557
638
|
[](https://starchart.cc/tammoippen/plotille)
|
|
639
|
+
|
|
640
|
+
## Sponsoring the project
|
|
641
|
+
|
|
642
|
+
If you like the project and want to buy me a coffee, feel free to send some coins ;)
|
|
643
|
+
|
|
644
|
+
[<img src="https://api.gitsponsors.com/api/badge/img?id=105019800" height="20">](https://api.gitsponsors.com/api/badge/link?p=gkBol1u2+g2pjgZGRaDLy4k0XbPDRXdPWJWnueCUGo/wcSsqyE8nr+n9nvqfeuqXee6JhLARGZS5bP0ZvorS7y6t4INyHLtTrprYh9c+MYkqAZeSqNIf7WL0ZRTI070RVQA3L9QW9IZNFlMbulW+BQ==)
|
|
@@ -1,47 +1,17 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: plotille
|
|
3
|
-
Version: 4.0.2
|
|
4
|
-
Summary: Plot in the terminal using braille dots.
|
|
5
|
-
Home-page: https://github.com/tammoippen/plotille
|
|
6
|
-
License: MIT
|
|
7
|
-
Keywords: plot,scatter,histogram,terminal,braille,unicode,timeseries
|
|
8
|
-
Author: Tammo Ippen
|
|
9
|
-
Author-email: tammo.ippen@posteo.de
|
|
10
|
-
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
|
|
11
|
-
Classifier: Environment :: Console
|
|
12
|
-
Classifier: Intended Audience :: Science/Research
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
-
Classifier: Programming Language :: Python
|
|
15
|
-
Classifier: Programming Language :: Python :: 2
|
|
16
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
17
|
-
Classifier: Programming Language :: Python :: 3
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
24
|
-
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
25
|
-
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
26
|
-
Classifier: Topic :: Terminals
|
|
27
|
-
Requires-Dist: six (>=1.16,<2.0)
|
|
28
|
-
Project-URL: Repository, https://github.com/tammoippen/plotille
|
|
29
|
-
Description-Content-Type: text/markdown
|
|
30
|
-
|
|
31
1
|

|
|
32
2
|
|
|
33
3
|
# Plotille
|
|
34
4
|
|
|
35
5
|
[](https://github.com/tammoippen/plotille/actions/workflows/CI.yml)
|
|
36
6
|
[](https://codecov.io/gh/tammoippen/plotille)
|
|
37
|
-
[](https://img.shields.io/badge/pypy-2.7--7.3%2C%203.7--7.3%2C%203.8--7.3-brightgreen.svg)
|
|
7
|
+
[](https://img.shields.io/badge/cpython-3.10%2C%203.11%2C%203.12%2C%203.13%203.14-brightgreen.svg)
|
|
8
|
+
[](https://img.shields.io/badge/pypy-3.11-brightgreen.svg)
|
|
40
9
|
[](https://pypi.python.org/pypi/plotille)
|
|
41
10
|
[](https://pepy.tech/project/plotille)
|
|
42
11
|
[](https://pypi.python.org/pypi/plotille)
|
|
12
|
+
[](https://github.com/astral-sh/ruff)
|
|
43
13
|
|
|
44
|
-
|
|
14
|
+
Plots, scatter plots, histograms and heatmaps in the terminal using braille dots, and foreground and background colors - with no dependencies. Make complex figures using the Figure class or make fast and simple plots using graphing function - similar to a very small sibling to matplotlib. Or use the canvas to plot dots, lines and images yourself.
|
|
45
15
|
|
|
46
16
|
Install:
|
|
47
17
|
|
|
@@ -56,7 +26,11 @@ Similar to other libraries:
|
|
|
56
26
|
- like [termgraph](https://github.com/sgeisler/termgraph) (not on pypi), but very different style.
|
|
57
27
|
- like [terminalplot](https://github.com/kressi/terminalplot), but with braille, X/Y-axis, histogram, linear interpolation.
|
|
58
28
|
|
|
59
|
-
Basic support for timeseries plotting is provided with release 3.2: for any `X` or `Y` values you can also add `datetime.datetime
|
|
29
|
+
Basic support for timeseries plotting is provided with release 3.2: for any `X` or `Y` values you can also add `datetime.datetime` or `numpy.datetime64` values. Labels are generated respecting the difference of `x_limits` and `y_limits`.
|
|
30
|
+
|
|
31
|
+
Support for heatmaps using background colors for figures and displaying images binary with braille, or in color with background colors using the canvas - provided with release 4.0
|
|
32
|
+
|
|
33
|
+
If you are still using python 2.7, please use plotille v4 or before. With v5 I am dropping support for python 2.7, as the effort to maintain the discontinued version is too much.
|
|
60
34
|
|
|
61
35
|
## Documentation
|
|
62
36
|
|
|
@@ -68,7 +42,7 @@ In [3]: X = np.sort(np.random.normal(size=1000))
|
|
|
68
42
|
|
|
69
43
|
### Figure
|
|
70
44
|
|
|
71
|
-
To construct plots the
|
|
45
|
+
To construct plots the recommended way is to use a `Figure`:
|
|
72
46
|
|
|
73
47
|
```python
|
|
74
48
|
In [12]: plotille.Figure?
|
|
@@ -182,10 +156,10 @@ Parameters:
|
|
|
182
156
|
X: List[float] X values.
|
|
183
157
|
Y: List[float] Y values. X and Y must have the same number of entries.
|
|
184
158
|
width: int The number of characters for the width (columns) of the canvas.
|
|
185
|
-
|
|
159
|
+
height: int The number of characters for the height (rows) of the canvas.
|
|
186
160
|
X_label: str Label for X-axis.
|
|
187
161
|
Y_label: str Label for Y-axis. max 8 characters.
|
|
188
|
-
linesep: str The requested line
|
|
162
|
+
linesep: str The requested line separator. default: os.linesep
|
|
189
163
|
interp: Optional[str] Specify interpolation; values None, 'linear'
|
|
190
164
|
x_min, x_max: float Limits for the displayed X values.
|
|
191
165
|
y_min, y_max: float Limits for the displayed Y values.
|
|
@@ -237,10 +211,10 @@ Parameters:
|
|
|
237
211
|
X: List[float] X values.
|
|
238
212
|
Y: List[float] Y values. X and Y must have the same number of entries.
|
|
239
213
|
width: int The number of characters for the width (columns) of the canvas.
|
|
240
|
-
|
|
214
|
+
height: int The number of characters for the height (rows) of the canvas.
|
|
241
215
|
X_label: str Label for X-axis.
|
|
242
216
|
Y_label: str Label for Y-axis. max 8 characters.
|
|
243
|
-
linesep: str The requested line
|
|
217
|
+
linesep: str The requested line separator. default: os.linesep
|
|
244
218
|
x_min, x_max: float Limits for the displayed X values.
|
|
245
219
|
y_min, y_max: float Limits for the displayed Y values.
|
|
246
220
|
lc: multiple Give the line color.
|
|
@@ -286,7 +260,7 @@ Parameters:
|
|
|
286
260
|
bins: int The number of bins to put X entries in (rows).
|
|
287
261
|
width: int The number of characters for the width (columns).
|
|
288
262
|
log_scale: bool Scale the histogram with `log` function.
|
|
289
|
-
linesep: str The requested line
|
|
263
|
+
linesep: str The requested line separator. default: os.linesep
|
|
290
264
|
lc: multiple Give the line color.
|
|
291
265
|
bg: multiple Give the background color.
|
|
292
266
|
color_mode: str Specify color input mode; 'names' (default), 'byte' or 'rgb'
|
|
@@ -300,6 +274,56 @@ In [9]: print(plotille.hist(np.random.normal(size=10000)))
|
|
|
300
274
|
|
|
301
275
|

|
|
302
276
|
|
|
277
|
+
#### Hist (aggregated)
|
|
278
|
+
|
|
279
|
+
This function allows you to create a histogram when your data is already aggregated (aka you don't have access to raw values, but you have access to bins and counts for each bin).
|
|
280
|
+
|
|
281
|
+
This comes handy when working with APIs such as [OpenTelemetry Metrics API](https://opentelemetry-python.readthedocs.io/en/latest/api/metrics.html)
|
|
282
|
+
where views such as [ExplicitBucketHistogramAggregation](https://opentelemetry-python.readthedocs.io/en/latest/sdk/metrics.view.html#opentelemetry.sdk.metrics.view.ExplicitBucketHistogramAggregation)
|
|
283
|
+
only expose access to aggregated values (counts for each bin / bucket).
|
|
284
|
+
|
|
285
|
+
```python
|
|
286
|
+
In [8]: plotille.hist_aggregated?
|
|
287
|
+
Signature:
|
|
288
|
+
plotille.hist_aggregated(
|
|
289
|
+
counts,
|
|
290
|
+
bins,
|
|
291
|
+
width=80,
|
|
292
|
+
log_scale=False,
|
|
293
|
+
linesep='\n',
|
|
294
|
+
lc=None,
|
|
295
|
+
bg=None,
|
|
296
|
+
color_mode='names',
|
|
297
|
+
)
|
|
298
|
+
Docstring:
|
|
299
|
+
Create histogram for aggregated data.
|
|
300
|
+
|
|
301
|
+
Parameters:
|
|
302
|
+
counts: List[int] Counts for each bucket.
|
|
303
|
+
bins: List[float] Limits for the bins for the provided counts: limits for
|
|
304
|
+
bin `i` are `[bins[i], bins[i+1])`.
|
|
305
|
+
Hence, `len(bins) == len(counts) + 1`.
|
|
306
|
+
width: int The number of characters for the width (columns).
|
|
307
|
+
log_scale: bool Scale the histogram with `log` function.
|
|
308
|
+
linesep: str The requested line separator. default: os.linesep
|
|
309
|
+
lc: multiple Give the line color.
|
|
310
|
+
bg: multiple Give the background color.
|
|
311
|
+
color_mode: str Specify color input mode; 'names' (default), 'byte' or 'rgb'
|
|
312
|
+
see plotille.color.__docs__
|
|
313
|
+
Returns:
|
|
314
|
+
str: histogram over `X` from left to right.
|
|
315
|
+
|
|
316
|
+
In [9]: counts = [1945, 0, 0, 0, 0, 0, 10555, 798, 0, 28351, 0]
|
|
317
|
+
In [10]: bins = [float('-inf'), 10, 50, 100, 200, 300, 500, 800, 1000, 2000, 10000, float('+inf')]
|
|
318
|
+
In [11]: print(plotille.hist_aggregated(counts, bins))
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Keep in mind that there must always be n+1 bins (n is a total number of count values, 11 in the example above).
|
|
322
|
+
|
|
323
|
+
In this example the first bin is from [-inf, 10) with a count of 1945 and the last bin is from [10000, +inf] with a count of 0.
|
|
324
|
+
|
|
325
|
+

|
|
326
|
+
|
|
303
327
|
#### Histogram
|
|
304
328
|
|
|
305
329
|
There is also another more 'usual' histogram function available:
|
|
@@ -336,7 +360,7 @@ Parameters:
|
|
|
336
360
|
height: int The number of characters for the height (rows).
|
|
337
361
|
X_label: str Label for X-axis.
|
|
338
362
|
Y_label: str Label for Y-axis. max 8 characters.
|
|
339
|
-
linesep: str The requested line
|
|
363
|
+
linesep: str The requested line separator. default: os.linesep
|
|
340
364
|
x_min, x_max: float Limits for the displayed X values.
|
|
341
365
|
y_min, y_max: float Limits for the displayed Y values.
|
|
342
366
|
lc: multiple Give the line color.
|
|
@@ -388,7 +412,7 @@ Initiate a Canvas object
|
|
|
388
412
|
|
|
389
413
|
Parameters:
|
|
390
414
|
width: int The number of characters for the width (columns) of the canvas.
|
|
391
|
-
|
|
415
|
+
height: int The number of characters for the height (rows) of the canvas.
|
|
392
416
|
xmin, ymin: float Lower left corner of reference system.
|
|
393
417
|
xmax, ymax: float Upper right corner of reference system.
|
|
394
418
|
background: multiple Background color of the canvas.
|
|
@@ -536,7 +560,7 @@ Docstring:
|
|
|
536
560
|
Transform canvas into `print`-able string
|
|
537
561
|
|
|
538
562
|
Parameters:
|
|
539
|
-
linesep: str The requested line
|
|
563
|
+
linesep: str The requested line separator. default: os.linesep
|
|
540
564
|
|
|
541
565
|
Returns:
|
|
542
566
|
unicode: The canvas as a string.
|
|
@@ -586,3 +610,8 @@ In [29]: print(cvs.plot())
|
|
|
586
610
|
|
|
587
611
|
[](https://starchart.cc/tammoippen/plotille)
|
|
588
612
|
|
|
613
|
+
## Sponsoring the project
|
|
614
|
+
|
|
615
|
+
If you like the project and want to buy me a coffee, feel free to send some coins ;)
|
|
616
|
+
|
|
617
|
+
[<img src="https://api.gitsponsors.com/api/badge/img?id=105019800" height="20">](https://api.gitsponsors.com/api/badge/link?p=gkBol1u2+g2pjgZGRaDLy4k0XbPDRXdPWJWnueCUGo/wcSsqyE8nr+n9nvqfeuqXee6JhLARGZS5bP0ZvorS7y6t4INyHLtTrprYh9c+MYkqAZeSqNIf7WL0ZRTI070RVQA3L9QW9IZNFlMbulW+BQ==)
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
3
|
-
|
|
4
1
|
# The MIT License
|
|
5
2
|
|
|
6
|
-
# Copyright (c) 2017 -
|
|
3
|
+
# Copyright (c) 2017 - 2025 Tammo Ippen, tammo.ippen@posteo.de
|
|
7
4
|
|
|
8
5
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
6
|
# of this software and associated documentation files (the "Software"), to deal
|
|
@@ -27,18 +24,18 @@ from ._canvas import Canvas
|
|
|
27
24
|
from ._cmaps import Colormap, ListedColormap
|
|
28
25
|
from ._colors import color, hsl
|
|
29
26
|
from ._figure import Figure
|
|
30
|
-
from ._graphs import hist, histogram, plot, scatter
|
|
31
|
-
|
|
27
|
+
from ._graphs import hist, hist_aggregated, histogram, plot, scatter
|
|
32
28
|
|
|
33
29
|
__all__ = [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
"Canvas",
|
|
31
|
+
"Colormap",
|
|
32
|
+
"Figure",
|
|
33
|
+
"ListedColormap",
|
|
34
|
+
"color",
|
|
35
|
+
"hist",
|
|
36
|
+
"hist_aggregated",
|
|
37
|
+
"histogram",
|
|
38
|
+
"hsl",
|
|
39
|
+
"plot",
|
|
40
|
+
"scatter",
|
|
44
41
|
]
|