-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
API Discussion for Figures and Axes #826
Comments
This is going to be a bit of a rambling answer (sorry). This is a sticky API problem (that gets worse if you want to think about how to return "artists" that span multiple
💯 agree with this. AxesGrid is not going anywhere and there is currently on going work to document and harden that part of the code base. Riffing a bit, it sounds like the information that should go into the visualizers is "this area on this figure is for your use" which is currently being expressed as an Another axis of composition that maybe of interest is to put multiple models on the same (set of) axes. In that case it may be worth having a compatibility layer with an api that is half dictionary / half GridSpec. Something like def viz_method(data, fit, **style, axes_source):
# make named Axes objects where we want them
if not len(axes_source):
# The position would be relative to the space given to the axes_source
axes_source.add('data', (.1, .2, .8, .7)) # left, bottom, width, height
# want to share the xaxis of data and residual to keep synched
axes_source.add('residual', (.1, .1, .8, .1), share_x='data')
# or rely on them existing
else:
pass
# do the plotting
d = axes_source['data'].plot(data, **style)
f = axes_source['data'].plot(fit, **{**style, alpha=.5})
r = axes_source['residual'].plot(fit - data, **style)
# return the artists in a structured way
return {'data': d, 'fit': f, 'residual': r} This lets you pass the same https://github.com/matplotlib/grid-strategy may be of interest. I am a bit skeptical of mixing the ML logic into the same objects so you can delay the decision of what you want to plot until after you have done everything (but I could also imagine that Is interactivity on the radar at all? |
Note that gridspecs can be nested, so your "axes" vis can still have multiple subplots inside it while participating in a larger axes layout in a figure. The nesting can be as many levels as you like: |
@tacaswell and @jklymak thank you so much for your responses - very helpful information! Based on this I think that we would be happy to continue down the path of using I will also consider the compatibility layer - I think Seaborn has something like this with FacetGrid? I do like the idea that the layout is something handled at a higher level rather than in each viz method - this will make things a lot easier for our contributors who want to focus on developing a specific visual tool. We could hook into a custom layout system in our Interactivity is definitely on the radar - we've experimented some but need to dive deeper into it. Thank you for the pointers to grid-strategy and the nested gridspec; we will definitely check those out! |
AxesGrid is not compatible with either tight_layout or constrained_layout so that is another drawback. I would tend to avoid its use unless very necessary. The only use case that I know that it is crucial for is when you want axes with equal aspect ratios to be close to each other on a figure that is too wide or too high. Other layout managers tend to spread the axes whereas axes grid puts the blank space on the sides. |
@jklymak can you elaborate on these limitations? GridSpec works with both of these, though, right?
|
Yes, The reason I don't see anything in your list of requirements that would require |
this seems also relevant: https://github.com/matplotlib/grid-strategy |
Indeed! Thanks @amueller! |
@rebeccabilbro I think this will require us to modify our matplotlib dependency to |
In #957 we added a |
This issue is to discuss the open letter regarding Yellowbrick's API roadmap. To summarize, we currently attempt to only manage matplotlib
Axes
objects so that visualizers can be embedded into more complex plots and reports. However, many of our visualizers are getting increasingly complex, requiring subplots of their own. For a complete discussion of the API issue please see:https://www.scikit-yb.org/en/develop/api/figures.html
The questions at hand are:
The text was updated successfully, but these errors were encountered: