8000 Closes issue #1120. There were two problems: barbs were being printe… · matplotlib/matplotlib@11ffa8a · GitHub
[go: up one dir, main page]

Skip to content

Commit 11ffa8a

Browse files
committed
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.
1 parent 0f9f85f commit 11ffa8a

File tree

9 files changed

+1493
-1493
lines changed

9 files changed

+1493
-1493
lines changed

lib/matplotlib/_cm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
"""
66

7-
from __future__ import print_function
7+
from __future__ import print_function, division
88
import numpy as np
99

1010
_binary_data = {
@@ -1625,7 +1625,7 @@ def gfunc32(x):
16251625
}
16261626

16271627
# This bipolar color map was generated from CoolWarmFloat33.csv of
1628-
# "Diverging Color Maps for Scientific Visualization" by Kenneth Moreland.
1628+
# "Diverging Color Maps for Scientific Visualization" by Kenneth Moreland.
16291629
# <http://www.cs.unm.edu/~kmorel/documents/ColorMaps/>
16301630
_coolwarm_data = {
16311631
'red': [

lib/matplotlib/cm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
and a mixin class for adding color mapping functionality.
55
66
"""
7-
from __future__ import print_function
7+
from __future__ import print_function, division
88

99
import os
1010

lib/matplotlib/collections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def get_transforms(self):
158158

159159
def get_offset_transform(self):
160160
t = self._transOffset
161-
if (not isinstance(t, transforms.Transform)
161+
if (not isinstance(t, transforms.Transform)
162162
and hasattr(t, '_as_mpl_transform')):
163163
t = t._as_mpl_transform(self.axes)
164164
return t

lib/matplotlib/colors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
Finally, legal html names for colors, like 'red', 'burlywood' and
4949
'chartreuse' are supported.
5050
"""
51-
from __future__ import print_function
51+
from __future__ import print_function, division
5252
import re
5353
import numpy as np
5454
from numpy import ma
@@ -219,7 +219,7 @@ def is_color_like(c):
219219

220220
def rgb2hex(rgb):
221221
'Given an rgb or rgba sequence of 0-1 floats, return the hex string'
222-
return '#%02x%02x%02x' % tuple([round(val*255) for val in rgb[:3]])
222+
return '#%02x%02x%02x' % tuple([np.round(val*255) for val in rgb[:3]])
223223

224224
hexColorPattern = re.compile("\A#[a-fA-F0-9]{6}\Z")
225225

lib/matplotlib/quiver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"""
1616

1717

18-
from __future__ import print_function
18+
from __future__ import print_function, division
1919
import numpy as np
2020
from numpy import ma
2121
import matplotlib.collections as collections
Binary file not shown.
Loading

0 commit comments

Comments
 (0)
0