Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAIL: matplotlib.tests.test_transforms.test_pre_transform_plotting.test on Python 3.x #1120

Merged
merged 1 commit into from Sep 5, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/matplotlib/_cm.py
Expand Up @@ -4,7 +4,7 @@

"""

from __future__ import print_function
from __future__ import print_function, division
import numpy as np

_binary_data = {
Expand Down Expand Up @@ -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': [
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/cm.py
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/collections.py
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/colors.py
Expand Up @@ -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
Expand Down Expand Up @@ -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]])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Micro-optimization: the part on the right is a bit quicker and perhaps more readable as
tuple(np.round(np.asarray(rgb[:3]) * 255)).

Or tuple((np.asarray(rgb[:3]) * 255).round()), which is slightly more efficient. Not that efficiency matters at this microsecond level.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watch out when doing asarray(). We support masked arrays, so it really should be asanyarray(). Although, admittedly, in this context, it probably makes no difference.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but I don't think either version would work sensibly with rgb as a masked array. And the docstring says "floats", with no mention of masked array support.


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

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/quiver.py
Expand Up @@ -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
Expand Down
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.