[Python-modules-commits] [python-mplexporter] 40/135: add some documentation
Wolfgang Borgert
debacle at moszumanska.debian.org
Tue Sep 23 21:19:02 UTC 2014
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to branch master
in repository python-mplexporter.
commit 02fde6c9264b80b65b78547bb130a05753bf2cac
Author: Jake Vanderplas <vanderplas at astro.washington.edu>
Date: Mon Feb 24 21:46:24 2014 -0800
add some documentation
---
mplexporter/renderers/__init__.py | 8 +++++++
mplexporter/renderers/base.py | 45 +++++++++++++++++++++++++++++++++------
mplexporter/utils.py | 18 ++++++++++++++--
3 files changed, 62 insertions(+), 9 deletions(-)
diff --git a/mplexporter/renderers/__init__.py b/mplexporter/renderers/__init__.py
index cd481fc..f6165d6 100644
--- a/mplexporter/renderers/__init__.py
+++ b/mplexporter/renderers/__init__.py
@@ -1,3 +1,11 @@
+"""
+Matplotlib Renderers
+====================
+This submodule contains renderer objects which define renderer behavior used
+within the Exporter class. The base renderer class is :class:`Renderer`, an
+abstract base class
+"""
+
from .base import Renderer
from .vega_renderer import VegaRenderer, fig_to_vega
from .vincent_renderer import VincentRenderer, fig_to_vincent
diff --git a/mplexporter/renderers/base.py b/mplexporter/renderers/base.py
index 318b2ec..1e0725c 100644
--- a/mplexporter/renderers/base.py
+++ b/mplexporter/renderers/base.py
@@ -1,9 +1,3 @@
-"""
-Matplotlib Renderer
-===================
-This submodule contains renderer objects which define renderer behavior used
-within the Exporter class.
-"""
import warnings
import itertools
from contextlib import contextmanager
@@ -66,15 +60,51 @@ class Renderer(object):
# Following are the functions which should be overloaded in subclasses
def open_figure(self, fig, properties):
+ """
+ Begin commands for a particular figure.
+
+ Parameters
+ ----------
+ fig : matplotlib.Figure
+ The Figure which will contain the ensuing axes and elements
+ properties : dictionary
+ The dictionary of figure properties
+ """
pass
def close_figure(self, fig):
+ """
+ Finish commands for a particular figure.
+
+ Parameters
+ ----------
+ fig : matplotlib.Figure
+ The figure which is finished being drawn.
+ """
pass
def open_axes(self, ax, properties):
+ """
+ Begin commands for a particular axes.
+
+ Parameters
+ ----------
+ ax : matplotlib.Axes
+ The Axes which will contain the ensuing axes and elements
+ properties : dictionary
+ The dictionary of axes properties
+ """
pass
def close_axes(self, ax):
+ """
+ Finish commands for a particular axes.
+
+ Parameters
+ ----------
+ ax : matplotlib.Axes
+ The Axes which is finished being drawn.
+ """
pass
def draw_line(self, data, coordinates, style, mplobj=None):
@@ -104,7 +134,8 @@ class Renderer(object):
pathstyle['edgewidth'] = pathstyle.pop('linewidth')
self.draw_path(data, coordinates, pathcodes, pathstyle, mplobj=mplobj)
- def _iter_path_collection(self, paths, path_transforms, offsets, styles):
+ @staticmethod
+ def _iter_path_collection(paths, path_transforms, offsets, styles):
"""Build an iterator over the elements of the path collection"""
N = max(len(paths), len(offsets))
diff --git a/mplexporter/utils.py b/mplexporter/utils.py
index 3d0cfed..96079f9 100644
--- a/mplexporter/utils.py
+++ b/mplexporter/utils.py
@@ -39,7 +39,20 @@ LINESTYLES = many_to_one({('solid', '-', (None, None)): "10,0",
def get_dasharray(obj, i=None):
- """Get an SVG dash array for the given matplotlib linestyle"""
+ """Get an SVG dash array for the given matplotlib linestyle
+
+ Parameters
+ ----------
+ obj : matplotlib object
+ The matplotlib line or path object, which must have a get_linestyle()
+ method which returns a valid matplotlib line code
+ i : integer (optional)
+
+ Returns
+ -------
+ dasharray : string
+ The HTML/SVG dasharray code associated with the object.
+ """
if obj.__dict__.get('_dashSeq', None) is not None:
return ','.join(map(str, obj._dashSeq))
else:
@@ -165,6 +178,7 @@ def get_text_style(text):
def get_axis_properties(axis):
+ """Return the property dictionary for a matplotlib.Axis instance"""
props = {}
label1On = axis._major_tick_kw.get('label1On', True)
@@ -214,7 +228,7 @@ def image_to_base64(image):
Returns
-------
image_base64 : string
- The base64 string representation of the image.
+ The UTF8-encoded base64 string representation of the png image.
"""
ax = image.axes
binary_buffer = io.BytesIO()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-mplexporter.git
More information about the Python-modules-commits
mailing list