@@ -653,6 +653,27 @@ def make_subplots(rows=1, cols=1,
653
653
if not isinstance (cols , int ):
654
654
raise Exception ("Keyword argument 'cols' must be an int" )
655
655
656
+ # Dictionary of things start_cell
657
+ START_CELL_all = {
658
+ 'bottom-left' : {
659
+ # 'natural' setup where x & y domains increase monotonically
660
+ 'col_dir' : 1 ,
661
+ 'row_dir' : 1
662
+ },
663
+ 'top-left' : {
664
+ # 'default' setup visually matching the 'specs' list of lists
665
+ 'col_dir' : 1 ,
666
+ 'row_dir' : - 1
667
+ }
668
+ # TODO maybe add 'bottom-right' and 'top-right'
669
+ }
670
+
671
+ # Throw exception for invalid 'start_cell' values
672
+ try :
673
+ START_CELL = START_CELL_all [start_cell ]
674
+ except KeyError :
675
+ raise Exception ("Invalid 'start_cell' value" )
676
+
656
677
# Throw exception if non-valid kwarg is sent
657
678
VALID_KWARGS = ['horizontal_spacing' , 'vertical_spacing' ,
658
679
'specs' , 'insets' ]
@@ -752,12 +773,17 @@ def _checks(item, defaults):
752
773
width = (1. - horizontal_spacing * (cols - 1 )) / cols
753
774
height = (1. - vertical_spacing * (rows - 1 )) / rows
754
775
755
- # Build subplot grid (tuple of starting coords for each cell)
756
- grid = [[((width + horizontal_spacing ) * column ,
757
- (height + vertical_spacing ) * row )
758
- for column in range (columns )]
759
- for row in range (rows )] # all we need
760
-
776
+ # Built row/col sequence using 'row_dir' and 'col_dir'
777
+ col_dir = START_CELL ['col_dir' ]
778
+ col_seq = range (cols )[::col_dir ]
779
+ row_dir = START_CELL ['row_dir' ]
780
+ row_seq = range (rows )[::row_dir ]
781
+
782
+ # [grid] Build subplot grid (coord tuple of cell)
783
+ grid = [[((width + horizontal_spacing ) * c ,
784
+ (height + vertical_spacing ) * r )
785
+ for c in col_seq ]
786
+ for r in row_seq ]
761
787
# Initialize the grid's string representation
762
788
if print_grid :
763
789
grid_str = [['' for column in range (columns )] for row in range (rows )]
0 commit comments