Skip to content

Commit

Permalink
added version 5.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
piccolomo committed Sep 24, 2022
1 parent b080e23 commit 63125c9
Show file tree
Hide file tree
Showing 73 changed files with 3,802 additions and 2,549 deletions.
33 changes: 21 additions & 12 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,45 +1,54 @@
<p align="left"> <img src="https://raw.githubusercontent.com/piccolomo/plotext/master/data/logo.png" /></p>

`plotext` plots **directly on terminal**
- it allows for [scatter](https://github.com/piccolomo/plotext/blob/master/readme/basic.md#scatter-plot), [line](https://github.com/piccolomo/plotext/blob/master/readme/basic.md#line-plot), [bar](https://github.com/piccolomo/plotext/blob/master/readme/bar.md#simple-bar-plot), [histogram](https://github.com/piccolomo/plotext/blob/master/readme/bar.md#histogram-plot), [error](https://github.com/piccolomo/plotext/blob/master/readme/other.md#error-plot) and [date-time](https://github.com/piccolomo/plotext/blob/master/readme/datetime.md#datetime-plot) plots (including [candlestick](https://github.com/piccolomo/plotext/blob/master/readme/datetime.md#candlestick-plot)),
- it can also [plot images](https://github.com/piccolomo/plotext/blob/master/readme/image.md#image-plot) (including [GIFs](https://github.com/piccolomo/plotext/blob/master/readme/image.md#gif-plot)) and [stream video](https://github.com/piccolomo/plotext/blob/master/readme/video.md#video-plot) with audio (including [YouTube](https://github.com/piccolomo/plotext/blob/master/readme/video.md#play-youtube)),
`plotext` **plots directly on terminal**
- it allows for [scatter](https://github.com/piccolomo/plotext/blob/master/readme/basic.md#scatter-plot), [line](https://github.com/piccolomo/plotext/blob/master/readme/basic.md#line-plot), [bar](https://github.com/piccolomo/plotext/blob/master/readme/bar.md#simple-bar-plot), [histogram](https://github.com/piccolomo/plotext/blob/master/readme/bar.md#histogram-plot) and [date-time](https://github.com/piccolomo/plotext/blob/master/readme/datetime.md#datetime-plot) plots (including [candlestick](https://github.com/piccolomo/plotext/blob/master/readme/datetime.md#candlestick-plot)),
- it can also plot [error bars](https://github.com/piccolomo/plotext/blob/master/readme/other.md#error-plot), [confusion matrices](https://github.com/piccolomo/plotext/blob/master/readme/matrix.md#confusion-matrix), and add extra [text](https://github.com/piccolomo/plotext/blob/master/readme/other.md#text-plot), [lines](https://github.com/piccolomo/plotext/blob/master/readme/other.md#line-plot) and [shapes](https://github.com/piccolomo/plotext/blob/master/readme/other.md#shape-plot) to the plot,
- you could use it to [plot images](https://github.com/piccolomo/plotext/blob/master/readme/image.md#image-plot) (including [GIFs](https://github.com/piccolomo/plotext/blob/master/readme/image.md#gif-plot)) and [stream video](https://github.com/piccolomo/plotext/blob/master/readme/video.md#video-plot) with audio (including [YouTube](https://github.com/piccolomo/plotext/blob/master/readme/video.md#play-youtube)),
- it has **no dependencies** (except for optional dependencies for image/video plotting),
- it provides a simple [command line tool](https://github.com/piccolomo/plotext/blob/master/readme/utilities.md#command-line-tool),
- it can [save plots](https://github.com/piccolomo/plotext/blob/master/readme/utilities.md#useful-functions) as text or as colored `html`,
- it provides a tool to [color strings](https://github.com/piccolomo/plotext/blob/master/readme/utilities.md#colored-text)
- it provides a tool to [color strings](https://github.com/piccolomo/plotext/blob/master/readme/utilities.md#colored-text).

![subplots](https://raw.githubusercontent.com/piccolomo/plotext/master/data/subplots.png)
image code [here](https://github.com/piccolomo/plotext/blob/master/readme/subplots.md)
image code [here](https://github.com/piccolomo/plotext/blob/master/readme/subplots.md#subplots)


## Install
- `pip install plotext` for normal installation,
- `pip install plotext --upgrade` to upgrade to the latest version,
- `pip install plotext --upgrade` to upgrade to the latest PyPi version,
- `pip install "plotext[image]"` to install the optional dependency for **image plotting** (including GIFs),
- `pip install "plotext[video]"` to install the optional dependencies for **video rendering**, which will also allow to plot images,
- `pip install "plotext[completion]"` to allow TAB completion in the [command line tool](https://github.com/piccolomo/plotext/blob/master/readme/utilities.md#command-line-tool) (under development),
- `pip install git+https://github.com/piccolomo/plotext`, to install the [GitHub version](https://github.com/piccolomo/plotext), if more updated and you feel courageous,
- `pip install "plotext[image] @ git+https://github.com/piccolomo/plotext.git"` to include image plotting dependencies,
- `pip install "plotext[video] @ git+https://github.com/piccolomo/plotext.git"` to include video plotting dependencies,
- the optional packages are `pillow` (for image plotting), `opencv-python` (for video rendering), `ffpyplayer` (to stream audio), `pafy` and `youtube-dl` (to stream YouTube),
- use the function `test()` to quickly test (up to image rendering) your newly installed version of `plotext`.
- `pip install "plotext[completion] @ git+https://github.com/piccolomo/plotext.git"` to include the TAB completion dependency,
- the optional packages are `pillow` (for image plotting), `opencv-python` (for video rendering), `ffpyplayer` (to stream audio), `pafy` and `youtube-dl` (to stream YouTube), `shtab` (for TAB completion),
- use the function `test()` to quickly test (up to image rendering) your newly installed version of `plotext`: any issue report is very welcomed. This function will download and finally remove a test image.
- created and tested in Ubuntu 22.04 and Python 3.10,



## Guide


#### Main Plots
- [Basic Plots](https://github.com/piccolomo/plotext/blob/master/readme/basic.md)
- [Bar Plots](https://github.com/piccolomo/plotext/blob/master/readme/bar.md)
- [Datetime Plots](https://github.com/piccolomo/plotext/blob/master/readme/datetime.md)
- [Other Plots](https://github.com/piccolomo/plotext/blob/master/readme/other.md)

#### 2D Plots
- [Image Plots](https://github.com/piccolomo/plotext/blob/master/readme/image.md)
- [Play Videos](https://github.com/piccolomo/plotext/blob/master/readme/video.md)

#### Plotting Utilities
- [Settings](https://github.com/piccolomo/plotext/blob/master/readme/settings.md)
- [Aspect](https://github.com/piccolomo/plotext/blob/master/readme/aspect.md)
- [Subplots](https://github.com/piccolomo/plotext/blob/master/readme/subplots.md)

#### 2D Plots
- [Matrix Plots](https://github.com/piccolomo/plotext/blob/master/readme/matrix.md)
- [Image Plots](https://github.com/piccolomo/plotext/blob/master/readme/image.md)
- [Play Videos](https://github.com/piccolomo/plotext/blob/master/readme/video.md)


#### Other Resources
- [Utilities](https://github.com/piccolomo/plotext/blob/master/readme/utilities.md)
- [Environments](https://github.com/piccolomo/plotext/blob/master/readme/environments.md)
Expand Down
Empty file modified data/bar_data.txt
100755 → 100644
Empty file.
Binary file added data/candlestick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data/cat.jpg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/cmatrix.png
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 data/color-codes.png
100755 → 100644
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 data/command-tool.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data/data.txt
100755 → 100644
Empty file.
Empty file modified data/error.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/eventplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data/homer-rendered.gif
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/homer.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data/image.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/indicator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data/integer-codes.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data/labelled-bar.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Empty file modified data/markers.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/matplotlib.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/matrix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/moonwalk.mp4
Binary file not shown.
Empty file modified data/rich.gif
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data/scatter-tool.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/shapes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/simple-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/simple-multiple-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/simple-stacked-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data/stream.gif
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data/styles.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data/subplots.png
100755 → 100644
Binary file added data/text.png
Empty file modified data/themes.png
100755 → 100644
Empty file modified data/ticks.png
100755 → 100644
Empty file modified data/tkinter.png
100755 → 100644
57 changes: 3 additions & 54 deletions plotext/__init__.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,58 +1,7 @@
"""\nplotext plots directly on terminal"""

__name__ = "plotext"
__version__ = "5.1.0"

from plotext._core import *
from plotext._test import test


def themes():
import plotext as plt
from plotext._utility import themes
from math import sqrt, ceil
themes = list(themes.keys())[::]
l = len(themes)
rows = int(sqrt(l))
cols = ceil(l / rows)
y1 = plt.sin(periods = 1)
y2 = [-el for el in plt.sin(periods = 1)]
plt.clf()
plt.subplots(rows, cols)
for row in range(1, rows + 1):
for col in range(1, cols + 1):
i = (row - 1) * cols + col - 1
if i < l:
plt.subplot(row, col)
plt.theme(themes[i])
plt.title(themes[i])
plt.scatter(y1); plt.scatter(y2)
plt.show()
plt.clf()

def markers():
import plotext as plt
from plotext._utility import marker_codes, hd_symbols
from math import sqrt, ceil
markers = list(hd_symbols.keys())[::-1] + list(marker_codes.keys())
l = len(markers)
rows = int(sqrt(l))
cols = ceil(l / rows)
y = plt.sin(1)
plt.clf(); plt.theme('pro'); plt.xfrequency(0); plt.yfrequency(0); plt.frame(1)
plt.subplots(rows, cols)
plt.frame(0)
for row in range(1, rows + 1):
for col in range(1, cols + 1):
i = (row - 1) * cols + col - 1
if i < l:
plt.subplot(row, col)
plt.frame(1)
default = ' [default]' if markers[i] == 'hd' else ''
plt.title(markers[i] + default)
plt.scatter(y, marker = markers[i])
plt.ticks_style('bold')
#plt.ticks_color(plt._utility.title_color)
plt.show()
plt.clf()
__version__ = "5.2.2"

from ._core import *
from .plotext_cli import build_parser
2 changes: 2 additions & 0 deletions plotext/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .plotext_cli import main
main()
Loading

0 comments on commit 63125c9

Please sign in to comment.