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

Use autolim kwarg in add_collection to prevent duplication of effort.#3100

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 1 commit intomatplotlib:masterfromefiring:set_autolim
Jun 2, 2014
Merged
Show file tree
Hide file tree
Changes fromall commits
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
31 changes: 16 additions & 15 deletionslib/matplotlib/axes/_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -965,7 +965,7 @@ def hlines(self, y, xmin, xmax, colors='k', linestyles='solid',
for thisxmin, thisxmax, thisy in zip(xmin, xmax, y)]
coll = mcoll.LineCollection(verts, colors=colors,
linestyles=linestyles, label=label)
self.add_collection(coll)
self.add_collection(coll, autolim=False)
coll.update(kwargs)

if len(y) > 0:
Expand DownExpand Up@@ -1045,7 +1045,7 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
#print 'creating line collection'
coll = mcoll.LineCollection(verts, colors=colors,
linestyles=linestyles, label=label)
self.add_collection(coll)
self.add_collection(coll, autolim=False)
coll.update(kwargs)

if len(x) > 0:
Expand DownExpand Up@@ -1210,7 +1210,7 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
linewidth=linewidth,
color=color,
linestyle=linestyle)
self.add_collection(coll)
self.add_collection(coll, autolim=False)
coll.update(kwargs)
colls.append(coll)

Expand DownExpand Up@@ -3937,7 +3937,7 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
self.autoscale_view(tight=True)

# add the collection last
self.add_collection(collection)
self.add_collection(collection, autolim=False)
if not marginals:
return collection

Expand DownExpand Up@@ -3983,7 +3983,7 @@ def coarse_bin(x, y, coarse):
hbar.set_norm(norm)
hbar.set_alpha(alpha)
hbar.update(kwargs)
self.add_collection(hbar)
self.add_collection(hbar, autolim=False)

coarse = np.linspace(ymin, ymax, gridsize)
ycoarse = coarse_bin(yorig, C, coarse)
Expand DownExpand Up@@ -4011,7 +4011,7 @@ def coarse_bin(x, y, coarse):
vbar.set_norm(norm)
vbar.set_alpha(alpha)
vbar.update(kwargs)
self.add_collection(vbar)
self.add_collection(vbar, autolim=False)

collection.hbar = hbar
collection.vbar = vbar
Expand DownExpand Up@@ -4073,7 +4073,7 @@ def quiver(self, *args, **kw):
self.cla()
q = mquiver.Quiver(self, *args, **kw)

self.add_collection(q, True)
self.add_collection(q,autolim=True)
self.autoscale_view()
return q
quiver.__doc__ = mquiver.Quiver.quiver_doc
Expand DownExpand Up@@ -4113,7 +4113,7 @@ def barbs(self, *args, **kw):
if not self._hold:
self.cla()
b = mquiver.Barbs(self, *args, **kw)
self.add_collection(b)
self.add_collection(b, autolim=True)
self.autoscale_view()
return b

Expand DownExpand Up@@ -4301,9 +4301,10 @@ def get_interp_point(ind):
XY2 = np.array([x[where], y2[where]]).T
self.dataLim.update_from_data_xy(XY1, self.ignore_existing_data_limits,
updatex=True, updatey=True)
self.ignore_existing_data_limits = False
Copy link
Member

Choose a reason for hiding this comment

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

Why did this get added?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This flag is initialized to True bycla(); subsequently, anything that updates the dataLim needs to set it to False so that the updating is cumulative rather than starting again from scratch.

self.dataLim.update_from_data_xy(XY2, self.ignore_existing_data_limits,
updatex=False, updatey=True)
self.add_collection(collection)
self.add_collection(collection, autolim=False)
self.autoscale_view()
return collection

Expand DownExpand Up@@ -4408,10 +4409,10 @@ def fill_betweenx(self, y, x1, x2=0, where=None, **kwargs):
X2Y = np.array([x2[where], y[where]]).T
self.dataLim.update_from_data_xy(X1Y, self.ignore_existing_data_limits,
updatex=True, updatey=True)

self.ignore_existing_data_limits = False
self.dataLim.update_from_data_xy(X2Y, self.ignore_existing_data_limits,
updatex=False, updatey=True)
self.add_collection(collection)
updatex=True, updatey=False)
self.add_collection(collection, autolim=False)
self.autoscale_view()
return collection

Expand DownExpand Up@@ -4886,7 +4887,7 @@ def pcolor(self, *args, **kwargs):
corners = (minx, miny), (maxx, maxy)
self.update_datalim(corners)
self.autoscale_view()
self.add_collection(collection)
self.add_collection(collection, autolim=False)
return collection

@docstring.dedent_interpd
Expand DownExpand Up@@ -5032,7 +5033,7 @@ def pcolormesh(self, *args, **kwargs):
corners = (minx, miny), (maxx, maxy)
self.update_datalim(corners)
self.autoscale_view()
self.add_collection(collection)
self.add_collection(collection, autolim=False)
Copy link
Member

Choose a reason for hiding this comment

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

I think the better solution (but not the quicker solution, so I'm happy this PR was merged) would be to implement an appropriate data limit updater on the QuadMeshCollection - I'm not sure I'll get around to doing this anytime soon, so just wanted to post it here as a reminder.

return collection

@docstring.dedent_interpd
Expand DownExpand Up@@ -5184,7 +5185,7 @@ def pcolorfast(self, *args, **kwargs):
collection.set_array(C)
collection.set_cmap(cmap)
collection.set_norm(norm)
self.add_collection(collection)
self.add_collection(collection, autolim=False)
xl, xr, yb, yt = X.min(), X.max(), Y.min(), Y.max()
ret = collection

Expand Down
4 changes: 2 additions & 2 deletionslib/matplotlib/contour.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -939,7 +939,7 @@ def __init__(self, ax, *args, **kwargs):
alpha=self.alpha,
transform=self.get_transform(),
zorder=zorder)
self.ax.add_collection(col)
self.ax.add_collection(col, autolim=False)
self.collections.append(col)
else:
tlinewidths = self._process_linewidths()
Expand All@@ -961,7 +961,7 @@ def __init__(self, ax, *args, **kwargs):
transform=self.get_transform(),
zorder=zorder)
col.set_label('_nolegend_')
self.ax.add_collection(col, False)
self.ax.add_collection(col,autolim=False)
self.collections.append(col)
self.changed() # set the colors

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp