[Python-modules-commits] [python-mplexporter] 101/135: Removed `lines` and `markers` variables from draw_line in exporter.

Wolfgang Borgert debacle at moszumanska.debian.org
Tue Sep 23 21:19:08 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 c555507f1910548be20ed1eace15327687fb29ab
Author: theengineear <andseier at gmail.com>
Date:   Fri Mar 14 10:56:47 2014 -0700

    Removed `lines` and `markers` variables from draw_line in exporter.
    
    If there is no `dasharray` for a Line2D obj, the `linestyle` dict is set
    to `None`. Same goes when `marker` is not populated.
    
    This way, the `base` renderer uses `linestyle` and `markerstyle` in
    `draw_marked_line` to decide which or both of the `draw_line` and
    `draw_markers` methods to call.
---
 mplexporter/exporter.py       | 10 ++++++----
 mplexporter/renderers/base.py | 16 ++++++++--------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/mplexporter/exporter.py b/mplexporter/exporter.py
index d6bc563..092cd7e 100644
--- a/mplexporter/exporter.py
+++ b/mplexporter/exporter.py
@@ -164,13 +164,15 @@ class Exporter(object):
                                                    ax, line.get_xydata(),
                                                    force_trans=force_trans)
         linestyle = utils.get_line_style(line)
+        if linestyle['dsharray'] in ['None', 'none', None]:
+            linestyle = None
         markerstyle = utils.get_marker_style(line)
-        lines = linestyle['dasharray'] not in ['None', 'none', None]
-        markers = markerstyle['marker'] not in ['None', 'none', None]
+        if (markerstyle['marker'] in ['None', 'none', None]
+                or markerstyle['markerpath'][0].size == 0):
+            markerstyle = None
         label = line.get_label()
-        if markers and not lines and markerstyle['markerpath'][0].size > 0:
+        if markerstyle or linestyle:
             self.renderer.draw_marked_line(data=data, coordinates=coordinates,
-                                           lines=lines, markers=markers,
                                            linestyle=linestyle,
                                            markerstyle=markerstyle,
                                            label=label,
diff --git a/mplexporter/renderers/base.py b/mplexporter/renderers/base.py
index 1e5c6b8..13d9855 100644
--- a/mplexporter/renderers/base.py
+++ b/mplexporter/renderers/base.py
@@ -107,21 +107,21 @@ class Renderer(object):
         """
         pass
 
-    def draw_marked_line(self, data, coordinates, lines, markers, linestyle,
-                         markerstyle, label, mplobj=None):
+    def draw_marked_line(self, data, coordinates, linestyle, markerstyle,
+                         label, mplobj=None):
         """Draw a line that also has markers.
 
         If this isn't reimplemented by a renderer object, by default, it will
-        make a call to BOTH draw_line and draw_markers when both markers and
-        lines are present in the same Line2D object.
+        make a call to BOTH draw_line and draw_markers when both markerstyle
+        and linestyle are not None in the same Line2D object.
 
         """
-        if lines:
+        if linestyle is not None:
             self.draw_line(data, coordinates, linestyle, label, mplobj)
-        if markers:
+        if markerstyle is not None:
             self.draw_markers(data, coordinates, markerstyle, label, mplobj)
 
-    def draw_line(self, data, coordinates, style, mplobj=None):
+    def draw_line(self, data, coordinates, style, label, mplobj=None):
         """
         Draw a line. By default, draw the line via the draw_path() command.
         Some renderers might wish to override this and provide more
@@ -236,7 +236,7 @@ class Renderer(object):
                            offset_coordinates=offset_coordinates,
                            mplobj=mplobj)
 
-    def draw_markers(self, data, coordinates, style, mplobj=None):
+    def draw_markers(self, data, coordinates, style, label, mplobj=None):
         """
         Draw a set of markers. By default, this is done by repeatedly
         calling draw_path(), but renderers should generally overload

-- 
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