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

WIP : major Axes refactor#3944

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

Closed
tacaswell wants to merge8 commits intomatplotlib:masterfromtacaswell:axes_refactor
Closed
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
WIP : use container to draw errorbar
tests are still failing
  • Loading branch information
@tacaswell
tacaswell committedMar 8, 2015
commitdd4051e181d3ae52f4868be17bd330d40ed72ba7
21 changes: 13 additions & 8 deletionslib/matplotlib/axes/_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@

import six
from six.moves import reduce, xrange, zip, zip_longest

import itertools
import math
import warnings

Expand DownExpand Up@@ -35,7 +35,8 @@
import matplotlib.transforms as mtransforms
import matplotlib.tri as mtri
import matplotlib.transforms as mtrans
from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer
from matplotlib.container import (BarContainer, ErrorbarContainer,
StemContainer, Container)
from matplotlib.axes._base import _AxesBase
from matplotlib.axes._base import _process_plot_format

Expand DownExpand Up@@ -2755,7 +2756,7 @@ def xywhere(xs, ys, mask):

if xerr is not None:
if (iterable(xerr) and len(xerr) == 2 and
iterable(xerr[0]) and iterable(xerr[1])):
iterable(xerr[0]) and iterable(xerr[1])):
# using list comps rather than arrays to preserve units
left = [thisx - thiserr for (thisx, thiserr)
in cbook.safezip(x, xerr[0])]
Expand DownExpand Up@@ -2886,14 +2887,18 @@ def xywhere(xs, ys, mask):
self.autoscale_view()
self._hold = holdstate

errorbar_container = ErrorbarContainer((l0, tuple(caplines),
tuple(barcols)),
# hack to put these artist in the right place in the
# draw tree
for ll in itertools.chain((l0, ), caplines, barcols):
ll.remove()

errorbar_container = ErrorbarContainer((l0,
Container(caplines),
Container(barcols)),
has_xerr=(xerr is not None),
has_yerr=(yerr is not None),
label=label)
self.containers.append(errorbar_container)

return errorbar_container # (l0, caplines, barcols)
return self.add_container(errorbar_container)

def boxplot(self, x, notch=False, sym=None, vert=True, whis=1.5,
positions=None, widths=None, patch_artist=False,
Expand Down
13 changes: 10 additions & 3 deletionslib/matplotlib/axes/_base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1605,13 +1605,19 @@ def add_container(self, container):
Add a :class:`~matplotlib.container.Container` instance
to the axes.

Returns thecollection.
Returns thecontainer.
"""
container.set_axes(self)
self._set_artist_props(container)
self.containers.append(container)

container.set_clip_path(self.patch)
container.set_remove_method(lambda h: self.containers.remove(h))

label = container.get_label()
if not label:
container.set_label('_container%d' % len(self.containers))
self.containers.append(container)
container.set_remove_method(lambda h: self.containers.remove(h))

return container

def relim(self, visible_only=False):
Expand DownExpand Up@@ -1998,6 +2004,7 @@ def draw(self, renderer=None, inframe=False):
artists.extend(self.lines)
artists.extend(self.texts)
artists.extend(self.artists)
artists.extend(self.containers)

# the frame draws the edges around the axes patch -- we
# decouple these so the patch can be in the background and the
Expand Down
5 changes: 3 additions & 2 deletionslib/matplotlib/container.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,8 @@ class Container(tuple, Artist):
"""
Base class for containers.
"""
_no_broadcast = ['label', ]
_no_broadcast = ['label', 'visible', 'zorder', 'animated',
'agg_filter']

def __repr__(self):
return "<Container object of %d artists>" % (len(self))
Expand All@@ -22,7 +23,7 @@ def __init__(self, kl, label=None, **kwargs):
# set up the artist details
Artist.__init__(self, **kwargs)
# for some reason we special case label
self.set_label(label=label)
self.set_label(label)

def remove(self):
# remove the children
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp