Permalink
Browse files

Closes issue #1120. There were two problems: barbs were being printed…

… slightly differently on Python 3 due to the difference of old vs. division. Colors were being converted to hex slightly wrong on Python 2 -- the use of np.round rather than Python's builtin round provides consistent behavior.
  • Loading branch information...
1 parent 0f9f85f commit 11ffa8ad995b195d72d8e3eec6cf643078bea421 @mdboom committed Sep 4, 2012
@@ -4,7 +4,7 @@
"""
-from __future__ import print_function
+from __future__ import print_function, division
import numpy as np
_binary_data = {
@@ -1625,7 +1625,7 @@ def gfunc32(x):
}
# This bipolar color map was generated from CoolWarmFloat33.csv of
-# "Diverging Color Maps for Scientific Visualization" by Kenneth Moreland.
+# "Diverging Color Maps for Scientific Visualization" by Kenneth Moreland.
# <http://www.cs.unm.edu/~kmorel/documents/ColorMaps/>
_coolwarm_data = {
'red': [
@@ -4,7 +4,7 @@
and a mixin class for adding color mapping functionality.
"""
-from __future__ import print_function
+from __future__ import print_function, division
import os
@@ -158,7 +158,7 @@ def get_transforms(self):
def get_offset_transform(self):
t = self._transOffset
- if (not isinstance(t, transforms.Transform)
+ if (not isinstance(t, transforms.Transform)
and hasattr(t, '_as_mpl_transform')):
t = t._as_mpl_transform(self.axes)
return t
@@ -48,7 +48,7 @@
Finally, legal html names for colors, like 'red', 'burlywood' and
'chartreuse' are supported.
"""
-from __future__ import print_function
+from __future__ import print_function, division
import re
import numpy as np
from numpy import ma
@@ -219,7 +219,7 @@ def is_color_like(c):
def rgb2hex(rgb):
'Given an rgb or rgba sequence of 0-1 floats, return the hex string'
- return '#%02x%02x%02x' % tuple([round(val*255) for val in rgb[:3]])
+ return '#%02x%02x%02x' % tuple([np.round(val*255) for val in rgb[:3]])
hexColorPattern = re.compile("\A#[a-fA-F0-9]{6}\Z")
@@ -15,7 +15,7 @@
"""
-from __future__ import print_function
+from __future__ import print_function, division
import numpy as np
from numpy import ma
import matplotlib.collections as collections
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 11ffa8a

Please sign in to comment.