@@ -499,58 +499,76 @@ def make_subplots(rows=1, cols=1,
499
499
with the subplots domain set in 'layout'.
500
500
501
501
Example 1:
502
- # stack two subplots vertically
503
- fig = tools.get_subplots(rows=2)
504
- fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x1', yaxis='y1')]
505
- fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')]
502
+ # stack two subplots vertically
503
+ >>> fig = tools.make_subplots(rows=2, print_grid=True)
504
+ This is the format of your plot grid!
505
+ [ (1,1) x1,y1 ]
506
+ [ (2,1) x2,y2 ]
507
+
508
+ >>> fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x1', yaxis='y1')]
509
+ >>> fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')]
506
510
507
511
Example 2:
508
- # subplots with shared x axes
509
- fig = tools.get_subplots(rows=2, shared_xaxes=True)
510
- fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], yaxis='y1')]
511
- fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], yaxis='y2')]
512
+ # subplots with shared x axes
513
+ >>> fig = tools.make_subplots(rows=2, shared_xaxes=True, print_grid=True)
514
+
515
+ TODO What's the default behavior here??
516
+
517
+ >>> fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], yaxis='y1')]
518
+ >>> fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], yaxis='y2')]
512
519
513
520
Example 3:
514
- # irregular subplot layout
515
- fig = tools.get_subplots(rows=2, columns=2,
516
- specs=[[{}, {}], [{'colspan': 2}]])
517
- fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x1', yaxis='y1')]
518
- fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')]
519
- fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x3', yaxis='y3')]
521
+ # irregular subplot layout (more examples below under 'specs')
522
+ >>> fig = tools.make_subplots(rows=2, cols=2,
523
+ specs=[[{}, {}],
524
+ [{'colspan': 2}, None]],
525
+ print_grid=True)
526
+ This is the format of your plot grid!
527
+ [ (1,1) x1,y1 ] [ (1,2) x2,y2 ]
528
+ [ (2,1) x3,y3 - ]
529
+
530
+ >>> fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x1', yaxis='y1')]
531
+ >>> fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')]
532
+ >>> fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x3', yaxis='y3')]
520
533
521
534
Example 4:
522
- # insets
523
- fig = tools.get_subplots(insets=[{'cell':(0,0), 'l': 0.7, 'b': 0.3}])
524
- fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2])]
525
- fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')]
535
+ # insets
536
+ >>> fig = tools.make_subplots(insets=[{'cell': (1,1), 'l': 0.7, 'b': 0.3}],
537
+ print_grid=True)
538
+ This is the format of your plot grid!
539
+ [ (1,1) x1,y1 ]
526
540
527
- Example 5:
528
- # print out string showing the subplot grid you've put in the layout
529
- fig = tools.get_subplots(rows=3, columns=2, print_grid=True)
541
+ With insets:
542
+ [ x2,y2 ] over [ (1,1) x1,y1 ]
543
+
544
+ >>> fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2])]
545
+ >>> fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')]
530
546
531
547
Keywords arguments with constant defaults:
532
548
533
549
rows (kwarg, int, default=1):
534
- Number of rows on the figure .
550
+ Number of rows in the subplot grid .
535
551
536
- columns (kwarg, int, default=1):
537
- Number of columns on the figure .
552
+ cols (kwarg, int, default=1):
553
+ Number of columns in the subplot grid .
538
554
539
555
shared_xaxes (kwarg, boolean or list, default=False)
540
556
Assign shared x axes.
541
557
If True, all x axes are shared.
558
+
542
559
To assign shared x axes per subplot grid cell (see 'specs'),
543
560
send list (or list of lists, one list per shared axis)
544
561
of cell index tuples.
545
562
546
563
shared_yaxes (kwarg, boolean or list, default=False)
547
564
Assign shared y axes.
548
565
If True, all y axes are shared.
566
+
549
567
To assign shared y axes per subplot grid cell (see 'specs'),
550
568
send list (or list of lists, one list per shared axis)
551
569
of cell index tuples.
552
570
553
- start_cell (kwarg, 'bottom-left' or 'top-left', default='bottom -left')
571
+ start_cell (kwarg, 'bottom-left' or 'top-left', default='top -left')
554
572
Choose the starting cell in the subplot grid used to set the
555
573
domains of the subplots.
556
574
@@ -560,54 +578,61 @@ def make_subplots(rows=1, cols=1,
560
578
561
579
Keyword arguments with variable defaults:
562
580
563
- horizontal_spacing (kwarg, float in [0,1], default=0.2 / columns ):
581
+ horizontal_spacing (kwarg, float in [0,1], default=0.2 / cols ):
564
582
Space between subplot columns.
565
-
566
583
Applies to all columns (use 'specs' subplot-dependents spacing)
567
584
568
585
vertical_spacing (kwarg, float in [0,1], default=0.3 / rows):
569
586
Space between subplot rows.
570
587
Applies to all rows (use 'specs' subplot-dependents spacing)
571
588
572
- specs (kwarg, list ( of lists) of dictionaries):
589
+ specs (kwarg, list of lists of dictionaries):
573
590
Subplot specifications.
574
591
592
+ ex1: specs=[[{}, {}], [{'colspan': 2}, None]]
593
+
594
+ ex2: specs=[[{'rowspan': 2}, {}], [None, {}]]
595
+
575
596
- Indices of the outer list correspond to subplot grid rows
576
597
starting from the bottom. The number of rows in 'specs'
577
598
must be equal to 'rows'.
578
599
579
600
- Indices of the inner lists correspond to subplot grid columns
580
601
starting from the left. The number of columns in 'specs'
581
- must be equal to 'columns '.
602
+ must be equal to 'cols '.
582
603
583
604
- Each item in the 'specs' list corresponds to one subplot
584
- in a subplot grid. The subplot grid has exactly 'rows'
585
- times 'columns ' cells.
605
+ in a subplot grid. (N.B. The subplot grid has exactly 'rows'
606
+ times 'cols ' cells.)
586
607
587
608
- Use None for blank a subplot cell (or to move pass a col/row span).
588
609
589
- - Note that specs[0][0] has the specs for the bottom-left subplot
610
+ - Note that specs[0][0] has the specs of the 'start_cell' subplot.
590
611
591
612
- Each item in 'specs' is a dictionary.
592
613
The available keys are:
593
614
594
615
* is_3d (boolean, default=False): flag for 3d scenes
595
- * colspan (int, default=1): span across grid columns
596
- from left to right
597
- * rowspan (int, default=1): span across grid rows
598
- from bottom to top
616
+ * colspan (int, default=1): number of subplot columns
617
+ for this subplot to span.
618
+ * rowspan (int, default=1): number of subplot rows
619
+ for this subplot to span.
599
620
* l (float, default=0.0): padding left of cell
600
621
* r (float, default=0.0): padding right of cell
601
622
* t (float, default=0.0): padding right of cell
602
623
* b (float, default=0.0): padding bottom of cell
603
624
625
+ - Use 'horizontal_spacing' and 'vertical_spacing' to adjust
626
+ the spacing in between the subplots.
627
+
604
628
insets (kwarg, list of dictionaries):
605
629
Inset specifications.
606
630
607
631
- Each item in 'insets' is a dictionary.
608
632
The available keys are:
609
633
610
- * cell (tuple, default=(0,0)) subplot cell indices
634
+ * cell (tuple, default=(1,1)): (row, col) index of the
635
+ subplot cell to overlay inset axes onto.
611
636
* is_3d (boolean, default=False): flag for 3d scenes
612
637
* l (float, default=0.0): padding left of inset
613
638
in fraction of cell width
0 commit comments