Giter VIP home page Giter VIP logo

uniplot's Introduction

uniplot

uniplot is simple utility which aims to unify plotting. The issue with modern plotting programs such as EasyPlot and Origin (apart from the fact you have to pay for them D:) is that they all use a different format to represent their plots, meaning you have to have all the programs installed on your computer to use these plots (an even bigger issue since these plots never seem to be exportable to images). uniplot aims to seperate the plot data from the data representation so that any file format can be used (as long as a parser exists) and you can even write your graphs by hand if you wish.

uniplot is written in Python meaning it's cross-platform, easy to install and will always be free (both as in speech and as in beer).

Installation

uniplot is currently not available on PyPI but installation is still as simple as cloning the repo and using pip:

$ git clone https://github.com/Sean1708/uniplot.git
$ pip install .

Usage

To get an up-to-date overview of all flags use the --help option:

$ uniplot --help

The simplest usage of uniplot is to supply a single file name, this will use that file to plot the graph (automatically guessing the file format) and save it as a PDF using the original file name as a base. For example:

$ uniplot graphs/AwesomeData.hip

will create a PDF in graphs called AwesomeData.pdf. By supplying a second file name you can specify the file name, location and type:

$ uniplot graphs/AwesomeData.yml plots/AwesomePlot.png

This will create a PNG in plots called AwesomePlot.png.

uniplot uses matplotlib as a backend so to get a list of the filetypes (with their extensions) that you can save as run the following in a Python interpreter:

>>> from matplotlib import pyplot
>>> fig = pyplot.figure()
>>> print(fig.canvas.get_supported_filetypes())
{'bmp': 'Windows bitmap',
'eps': 'Encapsulated Postscript',
'gif': 'Graphics Interchange Format',
'jpeg': 'JPEG',
'jpg': 'JPEG',
'pdf': 'Portable Document Format',
'pgf': 'PGF code for LaTeX',
'png': 'Portable Network Graphics',
'ps': 'Postscript',
'raw': 'Raw RGBA bitmap',
'rgba': 'Raw RGBA bitmap',
'svg': 'Scalable Vector Graphics',
'svgz': 'Scalable Vector Graphics',
'tif': 'Tagged Image Format File',
'tiff': 'Tagged Image Format File'}

Using Stylesheets

matplotlib allows you to define stylesheets so that you can easily adapt your graphs to your liking. uniplot takes advantage of this functionality and also allows you to use your own stylesheets. To do so you must put your stylesheet in $HOME/.uniplot/style then use it by supplying the filename to the -s flag. For example if you wrote a stylesheet called uber_mega_style you would write it in $HOME/.uniplot/style/uber_mega_style and call it like:

$ uniplot -s uber_mega_style my_data.hip

alternatively you can give your top-level graph a style attribute:

style: "a_style"
graphs: ...

matplotlib comes with some predefined stylesheets which can be used, to see which ones are installed on your computer use the following python snippet:

>>> from matplotlib import pyplot
>>> print(pyplot.style.available)
['dark_background', 'ggplot', 'grayscale', 'bmh', 'fivethirtyeight']

uniplot also comes with some predefined styles, shamelessly stolen from ctokheim, which are placed in $HOME/.uniplot/style. If you're interested in writing your own I suggest you start here since the matplotlib documentation is quite lacking.

The Data Structure

I'll write it soon I promise!

Writing Your Own Parser

Ditto.

uniplot's People

Contributors

sean1708 avatar

Watchers

 avatar  avatar  avatar

uniplot's Issues

Get rid of plot files vs data files.

Just have data files and allow a data file to be used as a template. The plot file is read and the plot set up, then any data from the template file overwrites the equivalent data from the data file.

You can no longer have a file name in the values or errors section.

Template file does not have to be of the same type as data file.

$ uniplot -t mytemplate.yaml data1.hip data2.toml data3.csv data4.lvm

Allow many files to be specified.

Instead of using second argument as output filename have an -o option to specify output name. If many files are specified and -o is, then prepend #- to the name where # is the number of this file.

$ uniplot -o myplot.pdf data1.csv data2.yml
1-myplot.pdf
2-myplot.pdf

Also allow a serch-replace regex to be used (probably -r but maybe it could be merged with -o). Delimited by the first character (probably suggest :).

$ uniplot -r ':(.*)-data:\1-plot.pdf:' some-data.yml more-data.toml this-data.lvm
some-plot.pdf
more-plot.pdf
this-plot.pdf

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.