@@ -642,8 +642,8 @@ def do_3d_projection(self, renderer=None):
642
642
643
643
644
644
def _update_scalarmappable (sm ):
645
-
646
- """ Update a 3D ScalarMappable.
645
+ """
646
+ Update a 3D ScalarMappable.
647
647
648
648
With ScalarMappable objects if the data, colormap, or norm are
649
649
changed, we need to update the computed colors. This is handled
@@ -657,40 +657,40 @@ def _update_scalarmappable(sm):
657
657
handled in the ``do_3d_projection`` methods which are called from the
658
658
draw method of the 3D Axes. These methods:
659
659
660
- - do the projection from 3D -> 2D
661
- - internally sort based on depth
662
- - stash the results of the above in the 2D analogs of state
663
- - return the z-depth of the whole artist
660
+ - do the projection from 3D -> 2D
661
+ - internally sort based on depth
662
+ - stash the results of the above in the 2D analogs of state
663
+ - return the z-depth of the whole artist
664
664
665
665
the last step is so that we can, at the Axes level, sort the children by
666
666
depth.
667
667
668
- The base `draw` method of the 2D artists unconditionally call
668
+ The base `draw` method of the 2D artists unconditionally calls
669
669
update_scalarmappable and rely on the method's internal caching logic to
670
670
lazily evaluate.
671
671
672
672
These things together mean you can have the sequence of events:
673
673
674
- - we create the artist, to the color mapping and stash the results in a 3D
674
+ - we create the artist, do the color mapping and stash the results in a 3D
675
675
specific state.
676
676
- change something about the ScalarMappable that marks it as in need of an
677
677
update (`ScalarMappable.changed` and friends).
678
678
- We call do_3d_projection and shuffle the stashed colors into the 2D version
679
679
of face colors
680
680
- the draw method calls the update_scalarmappable method which overwrites our
681
681
shuffled colors
682
- - we get a render this is wrong
682
+ - we get a render that is wrong
683
683
- if we re-render (either with a second save or implicitly via
684
- tight_layout / constairned_layout / bbox_inches='tight' (ex via
684
+ tight_layout / constrained_layout / bbox_inches='tight' (ex via
685
685
inline's defaults)) we again shuffle the 3D colors
686
686
- because the CM is not marked as changed update_scalarmappable is a no-op and
687
687
we get a correct looking render.
688
688
689
689
This function is an internal helper to:
690
690
691
- - sort out if we need to do the color mapping at all (has data!)
692
- - sort out if update_scalarmappable is going to be a no-op
693
- - copy the data over from the 2D -> 3D version
691
+ - sort out if we need to do the color mapping at all (has data!)
692
+ - sort out if update_scalarmappable is going to be a no-op
693
+ - copy the data over from the 2D -> 3D version
694
694
695
695
This must be called first thing in do_3d_projection to make sure that
696
696
the correct colors get shuffled.
0 commit comments