8000 Do not use an explicit fignum plt.figure(1) in simple cases by timhoffm · Pull Request #11999 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion examples/axes_grid1/demo_imagegrid_aspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import matplotlib.pyplot as plt

from mpl_toolkits.axes_grid1 import ImageGrid
fig = plt.figure(1)
fig = plt.figure()

grid1 = ImageGrid(fig, 121, (2, 2), axes_pad=0.1,
aspect=True, share_all=True)
Expand Down
2 changes: 1 addition & 1 deletion examples/axes_grid1/simple_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_rgb():
return R, G, B


fig = plt.figure(1)
fig = plt.figure()
ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8])

r, g, b = get_rgb()
Expand Down
2 changes: 1 addition & 1 deletion examples/axisartist/demo_axisline_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import numpy as np

if 1:
fig = plt.figure(1)
fig = plt.figure()
ax = SubplotZero(fig, 111)
fig.add_subplot(ax)

Expand Down
2 changes: 1 addition & 1 deletion examples/axisartist/demo_parasite_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import matplotlib.pyplot as plt


fig = plt.figure(1)
fig = plt.figure()

host = HostAxes(fig, [0.15, 0.1, 0.65, 0.8])
par1 = ParasiteAxes(host, sharex=host)
Expand Down
2 changes: 1 addition & 1 deletion examples/axisartist/simple_axisartist1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import matplotlib.pyplot as plt
import mpl_toolkits.axisartist as AA

fig = plt.figure(1)
fig = plt.figure()
fig.subplots_adjust(right=0.85)
ax = AA.Subplot(fig, 1, 1, 1)
fig.add_subplot(ax)
Expand Down
2 changes: 1 addition & 1 deletion examples/axisartist/simple_axisline.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from mpl_toolkits.axisartist.axislines import SubplotZero


fig = plt.figure(1)
fig = plt.figure()
fig.subplots_adjust(right=0.85)
ax = SubplotZero(fig, 1, 1, 1)
fig.add_subplot(ax)
Expand Down
2 changes: 1 addition & 1 deletion examples/lines_bars_and_markers/errorbar_limits_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

###############################################################################

fig = plt.figure(1)
fig = plt.figure()
x = np.arange(10.0) / 10.0
y = (x + 0.1)**2

Expand Down
2 changes: 1 addition & 1 deletion examples/pyplots/pyplot_scales.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
x = np.arange(len(y))

# plot with various axes scales
plt.figure(1)
plt.figure()

# linear
plt.subplot(221)
Expand Down
2 changes: 1 addition & 1 deletion examples/pyplots/pyplot_two_subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def f(t):
t1 = np.arange(0.0, 5.0, 0.1)
t2 = np.arange(0.0, 5.0, 0.02)

plt.figure(1)
plt.figure()
plt.subplot(211)
plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')

Expand Down
2 changes: 1 addition & 1 deletion examples/pyplots/whats_new_99_axes_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_rgb():
return R, G, B


fig = plt.figure(1)
fig = plt.figure()
ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8])

r, g, b = get_rgb()
Expand Down
2 changes: 1 addition & 1 deletion examples/text_labels_and_annotations/demo_text_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def draw(self, renderer=None):

usetex = plt.rcParams["text.usetex"]

fig = plt.figure(1)
fig = plt.figure()

# EXAMPLE 1

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ def add_axes(self, *args, **kwargs):
Some simple examples::

rect = l, b, w, h
fig = plt.figure(1)
fig = plt.figure()
fig.add_axes(rect,label=label1)
fig.add_axes(rect,label=label2)
fig.add_axes(rect, frameon=False, facecolor='g')
Expand Down Expand Up @@ -1308,7 +1308,7 @@ def add_subplot(self, *args, **kwargs):
--------
::

fig=plt.figure(1)
fig=plt.figure()
fig.add_subplot(221)

# equivalent but more general
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/offsetbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,7 @@ def update_offset(self, dx, dy):

if __name__ == "__main__":
import matplotlib.pyplot as plt
fig = plt.figure(1)
fig = plt.figure()
fig.clf()
ax = plt.subplot(121)

Expand Down
4 changes: 2 additions & 2 deletions tutorials/introductory/pyplot.py
< 10919 td class="blob-code blob-code-context js-file-line">
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def f(t):
t1 = np.arange(0.0, 5.0, 0.1)
t2 = np.arange(0.0, 5.0, 0.02)
plt.figure(1)
plt.figure()
plt.subplot(211)
plt.plot(t1, f(t1), 'bo', t2, f(t2), 'k')

Expand Down Expand Up @@ -432,7 +432,7 @@ def f(t):
x = np.arange(len(y))

# plot with various axes scales
plt.figure(1)
plt.figure()

# linear
plt.subplot(221)
Expand Down
2 changes: 1 addition & 1 deletion tutorials/toolkits/axes_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@

from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes

fig = plt.figure(1)
fig = plt.figure()
ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8])

r, g, b = get_rgb() # r,g,b are 2-d images
Expand Down
2 changes: 1 addition & 1 deletion tutorials/toolkits/axisartist.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
To create an axes, ::

import mpl_toolkits.axisartist as AA
fig = plt.figure(1)
fig = plt.figure()
ax = AA.Axes(fig, [0.1, 0.1, 0.8, 0.8])
fig.add_axes(ax)

Expand Down
0