- 
 
 - 
  Notifications
 
You must be signed in to change notification settings  - Fork 2.7k
 
Revamp tls.get_subplots #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
 
  Merged
 
 
 
 
  Merged
 Changes from 1 commit
 Commits
 
 
 Show all changes
 
 
 104 commits
 
 
 Select commit
 Hold shift + click to select a range
 
 9b2f4c0
 
 add specs to revamped get_subplots()
 
 
 etpinard 637c5de
 
 sync latest graph ref master
 
 
 etpinard 55637e0
 
 update get_subplots() docstring
 
 
 etpinard 1b1d23a
 
 remove old get_subplots() code
 
 
 etpinard 76c6d4e
 
 add Exception if rows or/and columns are not integers
 
 
 etpinard 9f1c240
 
 make h/v spacing depend on the number of rows/columns:
 
 
 etpinard 5406fb3
 
 initialize specs list of lists:
 
 
 etpinard 26f704e
 
 compute some common distances
 
 
 etpinard d9341c8
 
 loop through specs:
 
 
 etpinard 8705058
 
 add _get_shared()
 
 
 etpinard 842ff88
 
 add _add_domain() and _add_domain_is3D()
 
 
 etpinard c55a92f
 
 add _fill_grid()
 
 
 etpinard 34ee502
 
 initialize looping variables
 
 
 etpinard 97145a5
 
 (oops) get_shared -> _get_shared
 
 
 etpinard 5dfcfad
 
 add print_grid
 
 
 etpinard f72a249
 
 modify computed domain in existing tests (because of rounding errors)
 
 
 etpinard 857a7d7
 
 modify arguments in existing tests:
 
 
 etpinard e64794b
 
 test galore git diff --cached !
 
 
 etpinard ab661f4
 
 improve algorithm (part 1):
 
 
 etpinard eced9a3
 
 improve algorithm (part 2):
 
 
 etpinard 55a9b3f
 
 improve algorithm (part 3):
 
 
 etpinard 3eba0d7
 
 improve algorithm (part 4):
 
 
 etpinard 79c9868
 
 improve algorthm (part 5):
 
 
 etpinard ca08227
 
 remove _get_shared()
 
 
 etpinard 4efbb4f
 
 add _get_label()
 
 
 etpinard 69214c6
 
 add _get_anchors
 
 
 etpinard 0497009
 
 update _add_domain and _add_domain_is3D
 
 
 etpinard a83ad48
 
 code aesthetics
 
 
 etpinard 2d781f6
 
 modify expected values in tests due to rounding errors
 
 
 etpinard b8e9f53
 
 add 2nd rowspan test (that discovered the bug)
 
 
 etpinard 46ed9d7
 
 more test updating due to rounding errors
 
 
 etpinard 540b734
 
 update shared axis tests
 
 
 etpinard 7b0e8fb
 
 add 1 shared_xaxes=True, shared_yaxes=True test
 
 
 etpinard f6a64d1
 
 sub isEmpty -> is_empyt , is3D -> is_3d
 
 
 etpinard bed60db
 
 add info about 'insets' in docstring
 
 
 etpinard 50eeb8f
 
 add try/except block for kwargs['insets']
 
 
 etpinard 1a2192e
 
 aesthestic in SPEC_defaults
 
 
 etpinard 443217e
 
 add functions checking and filling keys (for 'specs' & 'insets')
 
 
 etpinard a72f043
 
 send specs to _check_keys_and_fill()
 
 
 etpinard 8e3e83d
 
 check and fill 'insets'
 
 
 etpinard d30e7b9
 
 raise Exception if non-valid kwarg is sent to get_subplots
 
 
 etpinard f9235b3
 
 loop through insets!
 
 
 etpinard dfa47f7
 
 add inset str reprensation
 
 
 etpinard 3ef8116
 
 add wrong key & wrong type tests
 
 
 etpinard ec25258
 
 add 2 insets tests
 
 
 etpinard 25c8d85
 
 update 'specs' docstring
 
 
 etpinard 330eeac
 
 raise Exception if specs dims not equal to 'rows' and 'columns'
 
 
 etpinard 12cdffd
 
 rm 'is_empty' from SPEC_defaults
 
 
 etpinard e52ff4f
 
 add cond for spec == None case in check_and_fill
 
 
 etpinard bad84cd
 
 pep8 tuple
 
 
 etpinard 0c83b9d
 
 move spec is None cond at top of spec loop
 
 
 etpinard 45229d2
 
 re-align specs loop
 
 
 etpinard fa286a0
 
 move right by one column:
 
 
 etpinard f0c3997
 
 add under/over-specified specs tests
 
 
 etpinard feea0cc
 
 update tests:
 
 
 etpinard 98b955f
 
 add a colspan>1 + rowspan>1 in the same cell test
 
 
 etpinard e5d753f
 
 [need some feedback] add start_cell docstring
 
 
 etpinard 0d74fb3
 
 add back the old get_subplots :
 
 
 etpinard 6df366e
 
 mv get_subplots argument checks tests to the top of file
 
 
 etpinard 5bcbaaa
 
 move make_subplots tests to test_make_subplots.py
 
 
 etpinard 2edb810
 
 pep8 get_subplots docstring
 
 
 etpinard 421dd5f
 
 improve make_subplots docstring
 
 
 etpinard af67e90
 
 replace 'columns' with 'cols'
 
 
 etpinard 7bb6ba2
 
 rm '>>>' in docstring
 
 
 etpinard 67672dd
 
 force 'specs' to be list of lists
 
 
 etpinard a311719
 
 force items in 'specs' to be either dicts or None
 
 
 etpinard dd16fa2
 
 define START_CELL and build grid using it
 
 
 etpinard 254cf13
 
 sub 'grid_str' -> 'grid_ref':
 
 
 etpinard 46b6c73
 
 fill in a layout obj, not a figure obj directly
 
 
 etpinard 4a6b718
 
 remove i, j indices
 
 
 etpinard 1cb0026
 
 improve and generalize algorithm:
 
 
 etpinard 964daff
 
 rm grid_str code (taken care outside specs loop now)
 
 
 etpinard 7463f60
 
 update (r, c) convention:
 
 
 etpinard f0eea15
 
 update _add_domain (accepts layout not fig)
 
 
 etpinard 95cded8
 
 update insets loop:
 
 
 etpinard 7b0e5d1
 
 improve 'grid_str' code
 
 
 etpinard 3f7572a
 
 pep8 and add TODO
 
 
 etpinard e9c2e01
 
 test galore !!!
 
 
 etpinard bfa69ce
 
 add exception for out of range 'insets.cell'
 
 
 etpinard 0f75a2d
 
 add tests for prev commit
 
 
 etpinard 9c34d84
 
 sync for graph ref (trace 'scene')
 
 
 etpinard d39a0be
 
 make print_grid=True the default for make_subplots
 
 
 etpinard 87d645a
 
 sub '!' -> ':' in print grid msg
 
 
 etpinard 08892a9
 
 update shared_{x,y}axes docstring
 
 
 etpinard e4d4936
 
 capitalize ROW_DIR
 
 
 etpinard 2de9ad7
 
 update get_anchors logic:
 
 
 etpinard bd16672
 
 add shared axes tests
 
 
 etpinard 6b2465b
 
 paste grid_ref and grid_str to fig in make_subplots
 
 
 etpinard 0437513
 
 add print_grid method to Figure
 
 
 etpinard 9a2767b
 
 add append_trace method to Figure
 
 
 etpinard f13a408
 
 make _grid_ref and _grid_str attributes
 
 
 etpinard 857013c
 
 fix typo in exception msg
 
 
 etpinard 7e2d3e0
 
 better test name
 
 
 etpinard ff0a112
 
 add exception for row/col =< 0
 
 
 etpinard 8dc3f80
 
 add tests for append_trace
 
 
 etpinard 87501d8
 
 force set axis.position when anchor == 'free'
 
 
 etpinard cebfae2
 
 update tests
 
 
 etpinard 68aee36
 
 update make_subplot docstring
 
 
 etpinard 4ee9b59
 
 add docstring to append_trace and print_grid
 
 
 etpinard d2d7a92
 
 add Exception if rows / cols <= 0
 
 
 etpinard 1f1960d
 
 add tests about last commit
 
 
 etpinard e0301ad
 
 add example in Figure.append_trace docstring on ref in make_subplots
 
 
 etpinard 3ac711f
 
 v 1.5.0
 
 
 etpinard 5536194
 
 Merge branch 'master' into revamp-get_subplots
 
 
 etpinard File filter
Filter by extension
Conversations
 Failed to load comments. 
 
 
 
  Loading
 
 Jump to
 
 Jump to file
 
 
 
 Failed to load files. 
 
 
 
  Loading
 
 Diff view
Diff view
 remove old get_subplots() code
 
 - Loading branch information
 
There are no files selected for viewing
 
 
 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
 Learn more about bidirectional Unicode characters
 
 
 
 
 | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
 
 
 
  | 
 @@ -386,7 +386,6 @@ def mpl_to_plotly(fig, resize=False, strip_style=False, verbose=False): | |
| 
  | 
||
| ### graph_objs related tools ### | ||
| 
  | 
||
| # TODO: Scale spacing based on number of plots and figure size | ||
| def get_subplots(rows=1, columns=1, | ||
| shared_xaxes=False, shared_yaxes=False, | ||
| print_grid=False, **kwargs): | ||
| 
 
 
 
  | 
 @@ -484,37 +483,9 @@ def get_subplots(rows=1, columns=1, | |
| * b (float, default=0.0): padding bottom of cell | ||
| 
  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. an example or two in here would be fantastic There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍  | 
||
| """ | ||
| 
  | 
||
| fig = dict(layout=graph_objs.Layout()) # will return this at the end | ||
| plot_width = (1 - horizontal_spacing * (columns - 1)) / columns | ||
| plot_height = (1 - vertical_spacing * (rows - 1)) / rows | ||
| plot_num = 0 | ||
| for rrr in range(rows): | ||
| for ccc in range(columns): | ||
| xaxis_name = 'xaxis{0}'.format(plot_num + 1) | ||
| x_anchor = 'y{0}'.format(plot_num + 1) | ||
| x_start = (plot_width + horizontal_spacing) * ccc | ||
| x_end = x_start + plot_width | ||
| 
  | 
||
| yaxis_name = 'yaxis{0}'.format(plot_num + 1) | ||
| y_anchor = 'x{0}'.format(plot_num + 1) | ||
| y_start = (plot_height + vertical_spacing) * rrr | ||
| y_end = y_start + plot_height | ||
| 
  | 
||
| xaxis = graph_objs.XAxis(domain=[x_start, x_end], anchor=x_anchor) | ||
| fig['layout'][xaxis_name] = xaxis | ||
| yaxis = graph_objs.YAxis(domain=[y_start, y_end], anchor=y_anchor) | ||
| fig['layout'][yaxis_name] = yaxis | ||
| plot_num += 1 | ||
| if print_grid: | ||
| print("This is the format of your plot grid!") | ||
| grid_string = "" | ||
| plot = 1 | ||
| for rrr in range(rows): | ||
| grid_line = "" | ||
| for ccc in range(columns): | ||
| grid_line += "[{0}]\t".format(plot) | ||
| plot += 1 | ||
| grid_string = grid_line + '\n' + grid_string | ||
| print(grid_string) | ||
| return graph_objs.Figure(fig) # forces us to validate what we just did... | ||
| 
  | 
||
| 
 
 
 
  | 
 
 ||
 Add this suggestion to a batch that can be applied as a single commit.
 This suggestion is invalid because no changes were made to the code.
 Suggestions cannot be applied while the pull request is closed.
 Suggestions cannot be applied while viewing a subset of changes.
 Only one suggestion per line can be applied in a batch.
 Add this suggestion to a batch that can be applied as a single commit.
 Applying suggestions on deleted lines is not supported.
 You must change the existing code in this line in order to create a valid suggestion.
 Outdated suggestions cannot be applied.
 This suggestion has been applied or marked resolved.
 Suggestions cannot be applied from pending reviews.
 Suggestions cannot be applied on multi-line comments.
 Suggestions cannot be applied while the pull request is queued to merge.
 Suggestion cannot be applied right now. Please check back later.