10000 make plt.subplot() act as plt.subplot(111) · matplotlib/matplotlib@bf83c16 · GitHub
[go: up one dir, main page]

Skip to content

Commit bf83c16

Browse files
committed
make plt.subplot() act as plt.subplot(111)
Since plt.subplots() make an assumption of what you want when you call it without arguments, and as does plt.axes(), there's no reason why plt.subplot() shouldn't make the same assumption.
1 parent 2044223 commit bf83c16

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
E024
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2012-11-09 Make plt.subplot() without arguments act as subplot(111) - PI
2+
13
2012-10-05 Add support for saving animations as animated GIFs. - JVDP
24

35
2012-08-11 Fix path-closing bug in patches.Polygon, so that regardless

lib/matplotlib/pyplot.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,9 @@ def subplot(*args, **kwargs):
727727
728728
``subplot(111)`` is the default axis.
729729
730+
``subplot()`` by itself is the same as ``subplot(111)``
731+
732+
730733
New subplots that overlap old will delete the old axes. If you do
731734
not want this behavior, use
732735
:meth:`~matplotlib.figure.Figure.add_subplot` or the
@@ -768,6 +771,10 @@ def subplot(*args, **kwargs):
768771
.. plot:: mpl_examples/pylab_examples/subplot_demo.py
769772
770773
"""
774+
# if subplot called without arguments, create subplot(1,1,1)
775+
if len(args)==0:
776+
args=(1,1,1)
777+
771778
# This check was added because it is very easy to type
772779
# subplot(1, 2, False) when subplots(1, 2, False) was intended
773780
# (sharex=False, that is). In most cases, no error will

0 commit comments

Comments
 (0)
0