Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cleanup imports.#9938

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
efiring merged 2 commits intomatplotlib:masterfromanntzer:more-unused-imports
Dec 29, 2017
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
And some more.
  • Loading branch information
@anntzer
anntzer committedDec 28, 2017
commit23bd9dfa773948ebd8992125c0641728e34eb06b
23 changes: 10 additions & 13 deletionslib/matplotlib/cbook/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,26 +29,25 @@
import types
import warnings
from weakref import ref, WeakKeyDictionary
from .deprecation import deprecated, warn_deprecated
from .deprecation import mplDeprecation, MatplotlibDeprecationWarning

import numpy as np

import matplotlib
from .deprecation import deprecated, warn_deprecated
from .deprecation import mplDeprecation, MatplotlibDeprecationWarning

# On some systems, locale.getpreferredencoding returns None,
# which can break unicode; and the sage project reports that
# some systems have incorrect locale specifications, e.g.,
# an encoding instead of a valid locale name. Another
# pathological case that has been reported is an empty string.

# On some systems, getpreferredencoding sets the locale, which has
# side effects. Passing False eliminates those side effects.

def unicode_safe(s):
import matplotlib

if isinstance(s, bytes):
try:
# On some systems, locale.getpreferredencoding returns None,
# which can break unicode; and the sage project reports that
# some systems have incorrect locale specifications, e.g.,
# an encoding instead of a valid locale name. Another
# pathological case that has been reported is an empty string.
# On some systems, getpreferredencoding sets the locale, which has
# side effects. Passing False eliminates those side effects.
preferredencoding = locale.getpreferredencoding(
matplotlib.rcParams['axes.formatter.use_locale']).strip()
if not preferredencoding:
Expand DownExpand Up@@ -644,8 +643,6 @@ def get_sample_data(fname, asfileobj=True):

If the filename ends in .gz, the file is implicitly ungzipped.
"""
import matplotlib

if matplotlib.rcParams['examples.directory']:
root = matplotlib.rcParams['examples.directory']
else:
Expand Down
25 changes: 8 additions & 17 deletionslib/matplotlib/collections.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,17 +23,8 @@

import numpy as np
import matplotlib as mpl
import matplotlib.cbook as cbook
import matplotlib.colors as mcolors
import matplotlib.cm as cm
from matplotlib import docstring
import matplotlib.transforms as transforms
import matplotlib.artist as artist
from matplotlib.artist import allow_rasterization
import matplotlib.path as mpath
from matplotlib import _path
import matplotlib.mlab as mlab
import matplotlib.lines as mlines
from . import (_path, artist, cbook, cm, colors as mcolors, docstring,
lines as mlines, mlab, path as mpath, transforms)

CIRCLE_AREA_FACTOR = 1.0 / np.sqrt(np.pi)

Expand DownExpand Up@@ -264,7 +255,7 @@ def _prepare_points(self):

return transform, transOffset, offsets, paths

@allow_rasterization
@artist.allow_rasterization
def draw(self, renderer):
if not self.get_visible():
return
Expand DownExpand Up@@ -917,7 +908,7 @@ def set_sizes(self, sizes, dpi=72.0):
self._transforms[:, 2, 2] = 1.0
self.stale = True

@allow_rasterization
@artist.allow_rasterization
def draw(self, renderer):
self.set_sizes(self._sizes, self.figure.dpi)
Collection.draw(self, renderer)
Expand DownExpand Up@@ -1118,7 +1109,7 @@ def get_numsides(self):
def get_rotation(self):
return self._rotation

@allow_rasterization
@artist.allow_rasterization
def draw(self, renderer):
self.set_sizes(self._sizes, self.figure.dpi)
self._transforms = [
Expand DownExpand Up@@ -1691,7 +1682,7 @@ def _set_transforms(self):
m[:2, 2:] = 0
self.set_transform(_affine(m))

@allow_rasterization
@artist.allow_rasterization
def draw(self, renderer):
self._set_transforms()
Collection.draw(self, renderer)
Expand DownExpand Up@@ -1797,7 +1788,7 @@ def convert_mesh_to_paths(tri):
tri.y[triangles][..., np.newaxis]), axis=2)
return [Path(x) for x in verts]

@allow_rasterization
@artist.allow_rasterization
def draw(self, renderer):
if not self.get_visible():
return
Expand DownExpand Up@@ -1949,7 +1940,7 @@ def convert_mesh_to_triangles(self, meshWidth, meshHeight, coordinates):

return triangles, colors

@allow_rasterization
@artist.allow_rasterization
def draw(self, renderer):
if not self.get_visible():
return
Expand Down
28 changes: 10 additions & 18 deletionslib/matplotlib/patches.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,27 +5,19 @@

import six
from six.moves import map, zip
import warnings

import math
import warnings

import matplotlib as mpl
import numpy as np
import matplotlib.cbook as cbook
import matplotlib.artist as artist
from matplotlib.artist import allow_rasterization
import matplotlib.colors as colors
from matplotlib import docstring
import matplotlib.transforms as transforms
from matplotlib.path import Path
import matplotlib.lines as mlines

from matplotlib.bezier import split_bezier_intersecting_with_closedpath
from matplotlib.bezier import get_intersection, inside_circle, get_parallels
from matplotlib.bezier import make_wedged_bezier2
from matplotlib.bezier import split_path_inout, get_cos_sin
from matplotlib.bezier import make_path_regular, concatenate_paths

import matplotlib as mpl
from . import artist, cbook, colors, docstring, lines as mlines, transforms
from .bezier import (
concatenate_paths, get_cos_sin, get_intersection, get_parallels,
inside_circle, make_path_regular, make_wedged_bezier2,
split_bezier_intersecting_with_closedpath, split_path_inout)
from .path import Path

_patch_alias_map = {
'antialiased': ['aa'],
Expand DownExpand Up@@ -490,7 +482,7 @@ def get_hatch(self):
'Return the current hatching pattern'
return self._hatch

@allow_rasterization
@artist.allow_rasterization
def draw(self, renderer):
'Draw the :class:`Patch` to the given *renderer*.'
if not self.get_visible():
Expand DownExpand Up@@ -1579,7 +1571,7 @@ def __init__(self, xy, width, height, angle=0.0,
self.theta1 = theta1
self.theta2 = theta2

@allow_rasterization
@artist.allow_rasterization
def draw(self, renderer):
"""
Ellipses are normally drawn using an approximation that uses
Expand Down
18 changes: 9 additions & 9 deletionslib/matplotlib/text.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,13 +14,13 @@

import numpy as np

frommatplotlib import artist, cbook, docstring, rcParams
frommatplotlib.artist import Artist, allow_rasterization
frommatplotlib.font_manager import FontProperties
frommatplotlib.lines import Line2D
frommatplotlib.patches import FancyArrowPatch, FancyBboxPatch, Rectangle
frommatplotlib.textpath import TextPath # Unused, but imported by others.
frommatplotlib.transforms import (
from. import artist, cbook, docstring, rcParams
from .artist import Artist
from .font_manager import FontProperties
from .lines import Line2D
from .patches import FancyArrowPatch, FancyBboxPatch, Rectangle
from .textpath import TextPath # Unused, but imported by others.
from .transforms import (
Affine2D, Bbox, BboxBase, BboxTransformTo, IdentityTransform, Transform)


Expand DownExpand Up@@ -690,7 +690,7 @@ def _get_wrapped_text(self):

return wrapped_str + line

@allow_rasterization
@artist.allow_rasterization
def draw(self, renderer):
"""
Draws the :class:`Text` object to the given *renderer*.
Expand DownExpand Up@@ -2276,7 +2276,7 @@ def _update_position_xytext(self, renderer, xy_pixel):

self.arrow_patch.set_patchA(r)

@allow_rasterization
@artist.allow_rasterization
def draw(self, renderer):
"""
Draw the :class:`Annotation` object to the given *renderer*.
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp