@@ -435,9 +435,9 @@ def __init__(self, fig, rect,
435
435
436
436
Optional keyword arguments:
437
437
438
- ================ =========================================
438
+ ================ ==============================================
439
439
Keyword Description
440
- ================ =========================================
440
+ ================ ==============================================
441
441
*adjustable* [ 'box' | 'datalim' | 'box-forced']
442
442
*alpha* float: the alpha transparency (can be None)
443
443
*anchor* [ 'C', 'SW', 'S', 'SE', 'E', 'NE', 'N',
@@ -458,10 +458,10 @@ def __init__(self, fig, rect,
458
458
toolbar button status
459
459
*position* [left, bottom, width, height] in
460
460
class:`~matplotlib.figure.Figure` coords
461
- *sharex* an class:`~matplotlib.axes.Axes` instance
462
- to share the x-axis with
463
- *sharey* an class:`~matplotlib.axes.Axes` instance
464
- to share the y-axis with
461
+ *sharex* another class:`~matplotlib.axes.Axes` instance
462
+ in *fig* to share the x-axis with
463
+ *sharey* another class:`~matplotlib.axes.Axes` instance
464
+ in *fig* to share the y-axis with
465
465
*title* the title string
466
466
*visible* [ *True* | *False* ] whether the axes is
467
467
visible
@@ -475,7 +475,7 @@ def __init__(self, fig, rect,
475
475
*yscale* [%(scale)s]
476
476
*yticklabels* sequence of strings
477
477
*yticks* sequence of floats
478
- ================ =========================================
478
+ ================ ==============================================
479
479
""" % {'scale' : ' | ' .join (
480
480
[repr (x ) for x in mscale .get_scale_names ()])}
481
481
martist .Artist .__init__ (self )
@@ -494,13 +494,17 @@ def __init__(self, fig, rect,
494
494
self ._sharex = sharex
495
495
self ._sharey = sharey
496
496
if sharex is not None :
497
+ if sharex .get_figure () is not fig :
498
+ raise ValueError ('Shared Axes must be in the same figure' )
497
499
self ._shared_x_axes .join (self , sharex )
498
500
if sharex ._adjustable == 'box' :
499
501
sharex ._adjustable = 'datalim'
500
502
# warnings.warn(
501
503
# 'shared axes: "adjustable" is being changed to "datalim"')
502
504
self ._adjustable = 'datalim'
503
505
if sharey is not None :
506
+ if sharey .get_figure () is not fig :
507
+ raise ValueError ('Shared Axes must be in the same figure' )
504
508
self ._shared_y_axes .join (self , sharey )
505
509
if sharey ._adjustable == 'box' :
506
510
sharey ._adjustable = 'datalim'
0 commit comments