Total Pageviews

Friday, 14 February 2014

webplotlib

As a developer, the need to display data charts and graphs on your web
site/service presents two major generation options: server-side, or
client/browser-side.

- The primary benefits of server-side chart generation are: completely
  consistent display across browsers (even IE can handle showing
  images), and re-use of the chart image outside the browser, e.g. in
  generating PDF documents.

- The primary benefit of client/browser-side chart generation is:
  interactivity (if needed), or generally more dynamic behavior,
  e.g. immediately updated charts with a user's new input.

webplotlib could be for you if you want Python server-side chart
generation, providing a convenient and modular package/API.  It is GPL
licensed.


Installation
------------

NOTE: Even though I wrote this package for a Django context, it can
easily be used without/outside Django.  See below for more details.

webplotlib has these direct dependencies:

1. Numpy, which Matplotlib also depends on.  You can install this
   globally (e.g. sudo pip install numpy) or just for the relevant
   virtualenv.  For its full functionality you'll want to install
   system dependencies (like Fortran), e.g. on Ubuntu, the packages
   libatlas-base-dev, gfortran, gcc, g++.
2. Matplotlib - you can get this via your OS packaging system (likely
   too old), from PyPI, or from source.  The latest version, 1.0.1, is
   ostensibly on PyPI, but pip pulls down the wrong version currently
   (as of May 2011; not pip's fault, see this `SO discussion`_),
   unless you do the following:
   pip install -f http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz matplotlib
   You can also install this globally or locally to one virtualenv.
   Note that Matplotlib has numerous system dependencies depending on
   usage: e.g. for server usage on Ubuntu, install packages: python,
   python-dev, libpng12-dev, libfreetype6-dev.
3. py.test, if you want to run the unit tests.


.. _SO discussion: http://stackoverflow.com/questions/3555551/why-does-pip-install-matplotlib-version-0-91-1-when-pypi-shows-version-1-0-0


With dependencies installed (and within the relevant virtualenv),
install webplotlib from PyPI with:

::

    pip install webplotlib


Or you can install from source via github.


Usage
-----

While I wrote webplotlib to work with a Django project, currently
there are no direct dependencies on Django, so you can treat
webplotlib like any other Python package and call it directly.
 
from  https://github.com/limist/webplotlib