Coder Social home page Coder Social logo

matplotlib-terminal's Introduction

matplotlib-terminal

Matplotlib backend to plot in terminal using matrach/img2unicode

This is in proof of concept stage, so stay tuned! The library is optimized for Gnome Terminal with Ubuntu Mono font. Nevertheless 'block' and 'braille' renderers should work with most modern terminals.

Install it with:

$ pip install matplotlib-terminal

To speed ~10x up the braille and gamma renderers, install an optional dependency of img2unicode:

$ pip install 'img2unicode[n2]'

Alternatives, which operate on raster output

Usage:

import matplotlib_terminal
import matplotlib.pyplot as plt
# Or in short:
# from matplotlib_terminal import plt


plt.plot([0, 1], [0, 1])
plt.plot([1, 0], [0, 1], lw=3)
plt.scatter([0], [.5])

plt.show()
plt.show('gamma') # Use RendererGamma-fast/noblock from img2unicode renderer
plt.show('block') # Use Renderer-fast/block from img2unicode, dual color!
plt.show('braille') # Use RendererGamma-fast/braille from img2unicode renderer
plt.close()

Sample results

Gamma renderer: gamma renderer Block renderer: block renderer Braille renderer: braille renderer

TODO

  • figure out how to configure the lib in matplotlib-ish way (eg. rcParams)
  • allow to specify figure size in terms of cells
  • compare with alternatives
  • auto select backend from alternatives

matplotlib-terminal's People

Contributors

matrach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

matplotlib-terminal's Issues

Can't install on windows

pip install isn't working, and I tried manually installing as well. Am I missing something?

PS super dope project!!

Support sixel (and other native image displaying protocols)

This repo is getting more attention that I initially anticipated. Since people actually use the tool, it would be nice to support native image rendering in some terminals (most notably through sixel).
Reference of modern terminals capabilities: https://github.com/dankamongmen/notcurses/blob/master/TERMINALS.md

Ref:
https://github.com/saitoha/libsixel
Pure Python: https://pypi.org/project/PySixel/
https://github.com/dankamongmen/notcurses

How to make it work on a ubuntu server?

I installed it on ubuntu server 20.04. If i connect to it by ssh on a gnome-terminal, this package works fine. Otherwise if i am directly using the server the special caracters dont appear and the result is not good. Do you have any tip to solve it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.