FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Mplot3d/collection cmap fix by WeatherGod · Pull Request #762 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
13 changes: 12 additions & 1 deletion lib/mpl_toolkits/mplot3d/art3d.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def do_3d_projection(self, renderer):
segments_2d = [zip(xs, ys) for (xs, ys, zs) in xyslist]
LineCollection.set_segments(self, segments_2d)

# FIXME
minz = 1e9
for (xs, ys, zs) in xyslist:
minz = min(minz, min(zs))
Expand Down Expand Up @@ -300,6 +301,9 @@ def set_sort_zpos(self,val):
self._sort_zpos = val

def set_3d_properties(self, zs, zdir):
# Force the collection to initialize the face and edgecolors
# just in case it is a scalarmappable with a colormap.
self.update_scalarmappable()
offsets = self.get_offsets()
if len(offsets) > 0:
xs, ys = zip(*self.get_offsets())
Expand Down Expand Up @@ -416,6 +420,9 @@ def set_verts(self, verts, closed=True):
PolyCollection.set_verts(self, [], closed)

def set_3d_properties(self):
# Force the collection to initialize the face and edgecolors
# just in case it is a scalarmappable with a colormap.
self.update_scalarmappable()
self._sort_zpos = None
self.set_zsort(True)
self._facecolors3d = PolyCollection.get_facecolors(self)
Expand All @@ -429,7 +436,7 @@ def do_3d_projection(self, renderer):
'''
Perform the 3D projection for this object.
'''

# FIXME: This may no longer be needed?
if self._A is not None:
self.update_scalarmappable()
self._facecolors3d = self._facecolors
Expand Down Expand Up @@ -572,6 +579,10 @@ def get_colors(c, num):

def zalpha(colors, zs):
"""Modify the alphas of the color list according to depth"""
# FIXME: This only works well if the points for *zs* are well-spaced
# in all three dimensions. Otherwise, at certain orientations,
# the min and max zs are very close together.
# Should really normalize against the viewing depth.
colors = get_colors(colors, len(zs))
if zs.size > 0 :
norm = Normalize(min(zs), max(zs))
Expand Down

Back | FazBrowse Home | New Git URL