Code Monkey home page Code Monkey logo

plottoterminal's Introduction

plottoterminal

A plotting utility (library) for plotting data into the terminal encoded as unicode characters as an xy graph, inspired by matplotlib. This tool doesn't have any dependencies on gnuplot or numpy.

Supports:

  • multi scatter plots
  • automatic tick setting for linear scales
  • automatic data rescaling to fit large numbers as tick labels
  • axis labels
  • unit labels
  • command line interface for plotting xy data file ($ plottoterminal file)

Planned:

  • command line interface for xy(z) data plotting
  • bar plot
  • legends
  • z value heatmap
  • color coding support
  • custom marker styles

Example:

import plottoterminal as ptt
import numpy as np

f = ptt.Figure(figsize=(57, 20))
xs = np.linspace(-10, 10, 200)

ys = xs ** 2
f.scatter(xs, ys)

ys2 = -xs ** 2
f.scatter(xs, ys2)

f.set_x_label("x")
f.set_y_label("x*x")
f.set_x_unit("m")
f.set_y_unit("m^2")
f.show()

Output:

   1.0ᐃxx                                         xx     
×10^2 │ xx                                       xx      
[m^2] │  xxx                                   xxx       
      │    xx                                 xx         
   0.5├      xx                             xx           
      │       xxxx                       xxxx            
      │          xxx                   xxx               
x     │             xxxx           xxxx                  
*  0.0├                *************                     
x     │             ****           ****                  
      │          ***                   ***               
      │       ****                       ****            
  -0.5├      **                             **           
      │    **                                 **         
      │  ***                                   ***       
      │ **                                       **      
  -1.0├**                                         **     
      └┴──────────┴──────────┴──────────┴──────────┴────ᐅ
       -1.0       -0.5       0.0        0.5        1.0   
                                x               ×10^1 [m]

Setup

Installing from source:

git clone https://github.com/bitromortac/plottoterminal
cd plottoterminal
python3 -m pip install --user .

Installing from pypi:

python3 -m pip install --user plottoterminal

Command line usage

To plot a file composed of rows of x and y data separated by whitespace, run the command $ plottoterminal file.xy.

plottoterminal's People

Contributors

bitromortac avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.