-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add Bar3DCollection
for 3d bar graphs.
#26075
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
base: main
Are you sure you want to change the base?
Conversation
Also works with cmap, so #23265 becomes trivial: # with x, y, z as above
fig, ax = plt.subplots(subplot_kw={'projection': '3d'}, layout='tight')
bars = ax.bar3d_grid(x, y, z, cmap='Spectral') |
Nice! I am not sure about the API-aspects, so I'll ask @timhoffm to chip in, but I assume that we in the long run would like (Edit: I guess that there should be tests and examples as well, but better to settle the bar3d-connection first.) |
Now I am guessing a bit here, but I think that the hexbin-helper-function probably should go somewhere else than in a new module. Does this work with alpha-values for the bars? There are also some issues related to voxels, like #9745 and #26106 Not that I expect a solution as part of the PR, but do you think that the approach here may help that as well? @scottshambaugh can you please have a look? (And really nice new features!) |
If nothing else, I believe that I'll be able to attend the dev-call next week (feel free to join if you want, see https://hackmd.io/@matplotlib/BJj3XFU1h ) and then I hope we can provide some feedback. |
Ye, I wasn't too sure where to put that, but I've moved it into
Yes it does. If
I'm not familiar with the voxels code, but there will likely be some overlap. Will take a look.
Thanks! 🤓 |
I can't figure out how to parametrize the image comparison tests correctly. The current failures are due to the tests returning a figure instance, as expected by pytest-mpl's |
If I recall it correctly, it is not possible to parameterize the tests using Not sure what you are trying to obtain, but a rather common approach to this is to just use multiple subplots as some sort of parameterization. |
This would be for looping over combinations of (bar/hexbar, alpha/no-alpha, cmap/color). Doing the combinations as subplots makes sense tough, thanks for the pointer 🧙🏽 |
This looks great! A couple suggestions to round this out:
|
@scottshambaugh Thanks for the pointers. Finally getting back to this...
I'm not actually sure why this is happening. Guessing there's some implicit change to the default values being passed through to the base class. Will investigate.
This new So itegrating this into
I'm happy to add this, but I think the API details should probably be clarified first since the above argument holds here as well.
[Edit: Done]
Thanks, will use that in future. |
I think this is ready for review now 🦄. I've added an API that runs parallel with the existing bar3d plotting. Let me know what you think. |
Can you please squash this into logical commits (or even split into multiple PRs)? From quickly skimming over, this at least does 3 independent things:
|
FIX: add camera distance functions FIX: spelling FIX: logic error with cmap DEV: rename function FIX: remove duplicate function
MNT: add stub def for newly added functions FIX: `hexbin` to return grid info FIX: add omitted function, import, remove whitespace FIX: yscaling MNT: move `hexbin` helper to `cbook` FIX: whitespace FIX: whitespace FIX: stub FIX spelling (again!) FIX: whitespace
MNT: rename variadic keywords for consistency DOC: udate docstrings TST: refactor tests
FIX: remove scipy dependency FIX: y scaling correction FIX: whitespace
MNT: lint DOC: update whats new
Would it be possible to invite me to the matplotlib org on circleCI so i can view the build logs please? |
Just bumping this again for comments / testing. I've cleaned up the commits, so should be more clear what's going on now. The remaining build failures are for the docs which I could use some hints on how to fix. TIA |
I can see the logs without logging in(?). (No idea how to add you anyway, sorry.) Not clear which is the actual error, but these are the candidates:
I think this is the one and we have set it up so that warnings are errors. Unlike some of the other classes, Axes3D does not generate documentation for all methods. You will probably have to add the new methods in https://github.com/matplotlib/matplotlib/tree/main/doc/api/toolkits maybe both mplot3d.rst and mplot3d/axes3d.rst The other option is:
but I doubt that is it as it seems unrelated. |
Hey @astromancer, once you get those docs errors fixed I can get a review in for you. |
PR summary
Fixes a long standing issue with z-sorting in 3d bar graphs. The demo below shows the fixed version on the left.
Closes #13728
Code for demo:
PR checklist