40
40
import pandas as pd
41
41
import os
42
42
43
- # Example
44
- # fig, (ax1, ax2) = stereoplot(number=2, nrows=1, ncols=2)
45
- # fig, (ax1, ax2, ax3) = stereoplot(number=3, nrows=3, ncols=1)
43
+ # Examples
44
+ # fig, ax = stereoplot()
45
+ # fig, (ax1, ax2) = stereoplot(nrows=1, ncols=2)
46
+ # fig, (ax1, ax2, ax3, ax4) = stereoplot(nrows=2, ncols=2)
46
47
47
48
48
- def stereoplot (number = 1 , nrows = 1 , ncols = 1 ):
49
+ def stereoplot (nrows = 1 , ncols = 1 ):
49
50
"""Automatically generate a defined number of stereoplots (between 1 and 5)
50
51
using the matplotlib library
51
52
52
53
Parameters
53
54
----------
54
- form: integer between 1 and 5
55
- the number of stereos, up to 5
56
-
57
55
nrows: integer
58
56
the number of rows of the subplot grid
59
57
60
58
ncols: integer
61
- the number of columns of the subplot grid
62
-
63
- Assumptions
64
- -----------
65
- - nrows * ncols must be equal to the number of stereos
59
+ the number of columns of the subplot grid
66
60
67
61
Call functions
68
62
--------------
@@ -72,12 +66,9 @@ def stereoplot(number=1, nrows=1, ncols=1):
72
66
------
73
67
TODO
74
68
"""
69
+ num_plots = nrows * ncols
75
70
76
- if nrows * ncols != number :
77
- print ('nrows times ncols must be equal to the number of stereos!' )
78
- return None
79
-
80
- if number == 1 :
71
+ if num_plots == 1 :
81
72
fig , ax = plt .subplots ()
82
73
set_stereo (ax )
83
74
fig .tight_layout ()
@@ -89,7 +80,7 @@ def stereoplot(number=1, nrows=1, ncols=1):
89
80
fig , ax = plt .subplots (nrows = nrows , ncols = ncols , sharey = True )
90
81
elif ncols == 1 :
91
82
fig , ax = plt .subplots (nrows = nrows , ncols = ncols , sharex = True )
92
- else : # not yet implemented
83
+ else :
93
84
fig , ax = plt .subplots (nrows = nrows , ncols = ncols )
94
85
95
86
for item in fig .axes :
0 commit comments