Add panels as parasite child axes instead of embedding them in the gridspec #46
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.
This is a major refactor I am just considering for now. It might make more sense to add axes panels, legends, and colorbars as parasites of the original subplot(s) instead of modifying the underlying subplotspec.
There is some existing similar code for this in the
axes_grid1
toolkit. I could borrow this code so that panel, colorbar, and legend long-axis coordinates are automatically updated when subplot positions change.There are several advantages here.
axes_grid
legend, colorbar, and text methods that draw legends and colorbars or labels along the sides of arbitrary contiguous axes, instead of just along the figure edge.Figure._insert_rows_columns
function.rowlabels
andcollabels
with the same API, allow "stacking" arbitrary outer text objects just like colorbars/legends/panels.The difficulty is that I would have to figure out how to specify axes bounds so that their long axis is locked to another axes (probably similar to the
inset_axes
locator) and their short axes has locked physical width (i.e. is not in physical units). Also, currently, thetight_layout
algorithm works to separate panels and subplots alike by just inspecting axes in adjacent rows/columns of the gridspec. With this PR, an additional step in the algorithm that separates "stacked" objects will have to be written.This should probably be a v2.0 feature. Really not sure how many people would find it useful/how often someone will run into issues with requiring different panel widths on the same GridSpec row/column. But, I'm leaving this open to discussion.