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

Axes.__init__ speedup#8626

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
tacaswell merged 3 commits intomatplotlib:masterfromQuLogic:Axes-init-speedup
Nov 8, 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
NextNext commit
Don't clear a new Axis when registering with a Spine.
If the Axis was just created, calling Axis.cla is redundant because itjust happened.
  • Loading branch information
@QuLogic
QuLogic committedMay 16, 2017
commit72821afa9a8126eaa6908768a9c0cc05564870e2
8 changes: 4 additions & 4 deletionslib/matplotlib/axes/_base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -610,11 +610,11 @@ def get_window_extent(self, *args, **kwargs):
def _init_axis(self):
"move this out of __init__ because non-separable axes don't use it"
self.xaxis = maxis.XAxis(self)
self.spines['bottom'].register_axis(self.xaxis)
self.spines['top'].register_axis(self.xaxis)
self.spines['bottom'].register_axis(self.xaxis, _init=True)
self.spines['top'].register_axis(self.xaxis, _init=True)
self.yaxis = maxis.YAxis(self)
self.spines['left'].register_axis(self.yaxis)
self.spines['right'].register_axis(self.yaxis)
self.spines['left'].register_axis(self.yaxis, _init=True)
self.spines['right'].register_axis(self.yaxis, _init=True)
self._update_transScale()

def set_figure(self, fig):
Expand Down
6 changes: 4 additions & 2 deletionslib/matplotlib/spines.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -151,15 +151,17 @@ def _ensure_position_is_set(self):
self._position = ('outward', 0.0) # in points
self.set_position(self._position)

def register_axis(self, axis):
def register_axis(self, axis, _init=False):
"""register an axis

An axis should be registered with its corresponding spine from
the Axes instance. This allows the spine to clear any axis
properties when needed.
"""
self.axis = axis
if self.axis is not None:
if not _init and self.axis is not None:
# Clear the axis when added, but *not* if the caller says it was
# just created.
self.axis.cla()
self.stale = True

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp