Conversation
|
@timhoffm The implementation here is inspired by your comment #30982 (comment) I realized |
5bba200 to
5f78c20
Compare
|
@trygvrad I just had a quick look. Overall this looks reasonable. I'm a bit worried on the deep nesting we create here: Do we need all of these? Can we answer the questions: What exactly does each class bring additionally to the table? Why can't that functionality live in the parent or child class. |
Currently we have
In order to have a mappable that is not an artist, we need all the functionality of I would personally prefer I don't think there is currently any use case for |
|
This sounds reasonable. We can always recreate a _ColorizerInterface at the top of the hierarchy later if needed. Could you do these architectural changes as a separate PR? I believe it's easier to review/discuss the architecture without the voxels in between. |
scottshambaugh
left a comment
There was a problem hiding this comment.
This threads the needle much more cleanly than the last PR, thanks for putting it together. Could you please add a test with a new baseline image, as well as a whats new entry?
| if filled.dtype == np.float64: | ||
| scalars = filled | ||
| filled = np.isfinite(filled) | ||
| #colorizer.autoscale_None(scalars[filled]) |
There was a problem hiding this comment.
| #colorizer.autoscale_None(scalars[filled]) |
There was a problem hiding this comment.
Thank you @scottshambaugh
I will come back to this PR after we figure out #31039
PR summary
This PR is in response to and closes #22969 [ENH]: Voxels as mappable for colorbar
The technical implementation builds upon the discussion in PR #30982 (closed)
This change allows axes3d.voxels() to take scalar data as input, and map it to color using a colorbar. The colors are applied to the voxels before shading.
The following code demonstrates the new functionality:
The technical implementation is such that:
filledargumentTechnical implementation
This technical implementation changes the return type of
ax.voxel()fromdictto the new classVoxelDict.Where
VoxelDictis valid input forfig.colorbar(), butVoxelDictis not itself an artist.VoxelDictinherits from_ColorbarMappable, a new class introduced in the class hierarchy ofColorizingArtist(colorizer.py).with these changes, this hierarchy is now:
I believe this change in the class hierarchy is suitable, because it makes explicit the requirements for colorbar.
Next step
First we need a discussion about the merits of the technical implementation.
Note that this implementation allows the user to set new data on existing voxels (which will update the colors), but it does not allow for adding/removing the voxels themselves [this will require more complicated methods, and can be implemented later].
If there is agreement that this implementation is suitable, I will need to add more tests.