Python: Show plots in the terminal, ptpython, plotext ver. 2

Last Updated on September 10, 2022 by shibatau

I. What will you learn?

III is added.

Let me show you how to show simple a plot in Python in the terminal. We’ll use Ptpython and Plotext for that.

II. ptpython

It reads at https://github.com/prompt-toolkit/ptpython.

Ptpython is an advanced Python REPL. It should work on all Python versions from 2.6 up to 3.9 and work cross platform (Linux, BSD, OS X and Windows).
Note: this version of ptpython requires at least Python 3.6. Install ptpython 2.0.5 for older Python versions.

Open a virtual environment or create a new environment and activate it. In my case I use anaconda on Mac and here is the command:

conda activate MYENVIRONMENT

Open ptpython with the command:

ptpython

I have created histograms with the following sample data:

https://pastebin.com/raw/cSZ8pYWh

III.plotext

Refer to https://github.com/piccolomo/plotext

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.