Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2aff7ca

Browse files
committed
Use batch ax.set() method
1 parent dba02be commit 2aff7ca

35 files changed

+56
-115
lines changed

examples/animation/animate_decay.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ def data_gen():
2222

2323

2424
def init():
25-
ax.set_ylim(-1.1, 1.1)
26-
ax.set_xlim(0, 10)
25+
ax.set(xlim=(0, 10), ylim=(-1.1, 1.1))
2726
del xdata[:]
2827
del ydata[:]
2928
line.set_data(xdata, ydata)

examples/animation/bayes_update.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def __init__(self, ax, prob=0.5):
3030
self.ax = ax
3131

3232
# Set up plot parameters
33-
self.ax.set_xlim(0, 1)
34-
self.ax.set_ylim(0, 10)
33+
self.ax.set(xlim=(0, 1), ylim=(0, 10))
3534
self.ax.grid(True)
3635

3736
# This vertical line represents the theoretical value, to

examples/animation/rain.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
# Create new Figure and an Axes which fills it.
2121
fig = plt.figure(figsize=(7, 7))
2222
ax = fig.add_axes([0, 0, 1, 1], frameon=False)
23-
ax.set_xlim(0, 1), ax.set_xticks([])
24-
ax.set_ylim(0, 1), ax.set_yticks([])
23+
ax.set(xticks=[], xlim=(0, 1),
24+
yticks=[], ylim=(0, 1))
2525

2626
# Create rain data
2727
n_drops = 50

examples/animation/strip_chart.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ def __init__(self, ax, maxt=2, dt=0.02):
2121
self.ydata = [0]
2222
self.line = Line2D(self.tdata, self.ydata)
2323
self.ax.add_line(self.line)
24-
self.ax.set_ylim(-.1, 1.1)
25-
self.ax.set_xlim(0, self.maxt)
24+
self.ax.set(xlim=(0, self.maxt), ylim=(-.1, 1.1))
2625

2726
def update(self, y):
2827
lastt = self.tdata[-1]

examples/axisartist/axis_direction.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
def setup_axes(fig, pos):
1212
ax = fig.add_subplot(pos, axes_class=axisartist.Axes)
1313

14-
ax.set_ylim(-0.1, 1.5)
15-
ax.set_yticks([0, 1])
14+
ax.set(ylim=(-0.1, 1.5), yticks=[0, 1])
1615

1716
ax.axis[:].set_visible(False)
1817

examples/axisartist/demo_ticklabel_alignment.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,16 @@ def setup_axes(fig, pos):
2323
fig.subplots_adjust(left=0.5, hspace=0.7)
2424

2525
ax = setup_axes(fig, 311)
26-
ax.set_ylabel("ha=right")
27-
ax.set_xlabel("va=baseline")
26+
ax.set(xlabel="va=baseline", ylabel="ha=right")
2827

2928
ax = setup_axes(fig, 312)
3029
ax.axis["left"].major_ticklabels.set_ha("center")
3130
ax.axis["bottom"].major_ticklabels.set_va("top")
32-
ax.set_ylabel("ha=center")
33-
ax.set_xlabel("va=top")
31+
ax.set(xlabel="va=top", ylabel="ha=center")
3432

3533
ax = setup_axes(fig, 313)
3634
ax.axis["left"].major_ticklabels.set_ha("left")
3735
ax.axis["bottom"].major_ticklabels.set_va("bottom")
38-
ax.set_ylabel("ha=left")
39-
ax.set_xlabel("va=bottom")
36+
ax.set(xlabel="va=bottom", ylabel="ha=left")
4037

4138
plt.show()

examples/axisartist/demo_ticklabel_direction.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
def setup_axes(fig, pos):
1313
ax = fig.add_subplot(pos, axes_class=axislines.Axes)
14-
ax.set_yticks([0.2, 0.8])
15-
ax.set_xticks([0.2, 0.8])
14+
ax.set(xticks=[0.2, 0.8], yticks=[0.2, 0.8])
1615
return ax
1716

1817

examples/axisartist/simple_axis_direction03.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
def setup_axes(fig, pos):
1313
ax = fig.add_subplot(pos, axes_class=axisartist.Axes)
14-
ax.set_yticks([0.2, 0.8])
15-
ax.set_xticks([0.2, 0.8])
14+
ax.set(xticks=[0.2, 0.8], yticks=[0.2, 0.8])
1615
return ax
1716

1817

examples/event_handling/poly_editor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def on_mouse_move(self, event):
205205
ax.add_patch(poly)
206206
p = PolygonInteractor(ax, poly)
207207

208-
ax.set_title('Click and drag a point to move it')
209-
ax.set_xlim((-2, 2))
210-
ax.set_ylim((-2, 2))
208+
ax.set(xlim=(-2, 2), ylim=(-2, 2),
209+
title='Click and drag a point to move it')
210+
211211
plt.show()

examples/images_contours_and_fields/affine_image.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ def do_plot(ax, Z, transform):
4040
x1, x2, y1, y2 = im.get_extent()
4141
ax.plot([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], "y--",
4242
transform=trans_data)
43-
ax.set_xlim(-5, 5)
44-
ax.set_ylim(-4, 4)
43+
ax.set(xlim=(-5, 5), ylim=(-4, 4))
4544

4645

4746
# prepare image and figure

0 commit comments

Comments
 (0)