Coder Social home page Coder Social logo

grid-plot's Introduction

grid-plot

grid-plot is a simple utility for plotting and visualizing data on a 2D grid.

Installation

pip install -e git://github.com/doggan/grid-plot.git#egg=grid-plot

or

git clone git://github.com/doggan/grid-plot.git
cd grid-plot
python setup.py install

Usage

$ grid-plot --help
usage: grid-plot [-h] infile outfile

positional arguments:
infile      the input data file
outfile     the output file

optional arguments:
-h, --help  show this help message and exit

Example

$ grid-plot ./examples/01.txt example_01.png
Processing [./examples/01.txt]...
Successfully created image [example_01.png].
Elapsed time: 0.1(s)

Data File Description

The input description file is JSON, and must follow the format below:

{
    "_comment": "The size of a single cell in pixels.",
    "cellSizeInPixels":[64,64],

    "_comment": "The start [x, y] and end [x, y] coordinates of the grid.",
    "coordinates":[
        [0,0],
        [4,4]
    ],

    "_comment": "Layers contain the actual cell data to be plotted on the grid. Multiple layers can exist, and are specified from low priority to high priority. High priority layers will be rendered on top of lower priority layers.",
    "layers":[
        {
            "_comment": "The color of the layer specified as an [R,G,B,A] value.",
            "color":[255,0,0,255],

            "_comment": "The cell data (points) to be plotted on the grid for this layer.",
            "cells":[
                [0,0],[1,0],[2,0],
                [1,1],[2,1],
                [2,2]
            ]
        },
        {
            "color":[0,0,255,255],
            "cells":[
                [2,2]
            ]
        }
    ],

    "_comment": "(Optional) The interval at which major lines will be drawn.",
    "majorLineInterval":5,

    "_comment": "(Optional) The thickness of drawn major lines.",
    "majorLineThickness":3,

    "_comment": "(Optional) Supply an image to be used as the background for the output grid. Must be a valid image path.",
    "backgroundImage":"path/to/image.png"
}

grid-plot's People

Contributors

doggan avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

grid-plot's Issues

Cross-platform font loading

Currently, the font path is hard-coded (:cry:), so grid coordinates in the final image may or may not display on some platforms. This needs to be implemented in a way to ensure that a valid font can be loaded on all platforms.

Ref:
python-pillow/Pillow#1054

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.