Skip to content
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

Make markerfacecolor work for 3d scatterplots #10693

Closed

Conversation

jinshifen33
Copy link
Contributor

@jinshifen33 jinshifen33 commented Mar 5, 2018

PR Summary

This pull request is a fix for issue 9725 color issue on 3D scatter plots. Invoking the set color method after the initial creation of a scatter 3D plot would not change the color; these changes fix this issue.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

1. PEP8 compliant
2. 1 more test case
3. doc for new methods
@jinshifen33
Copy link
Contributor Author

One thing I noticed is that, the edge_color will never equal to "face" in 3D, this fix also introduces a workaround for it, I am not sure whether this is desired behaviour .

@@ -449,24 +450,62 @@ def set_3d_properties(self, zs, zdir):
self._edgecolor3d = self.get_edgecolor()
self.stale = True

def set_facecolor(self, colors):
# override setter for facecolor so that 3dfacecolor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use triple-quote docstrings instead of comments for documenting functions. This is the standard pep8 style we're aiming for (even if historically there are other styles in the code base).

# In providing consitentcy in 2dcolor and 3dcolor setter.
# Note: will also update edgecolor if it follows facecolor

PathCollection.set_facecolor(self, colors)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this will by py3 only, use super().

self._edgecolor3d = PathCollection.get_edgecolor(self)
set_edgecolors = set_edgecolor

def _set_facecolors_on_project(self, colors):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is project? Should this rather be _set_facecolors_on_projection or _set_facecolors_on_2d_projection?

set_edgecolors = set_edgecolor

def _set_facecolors_on_project(self, colors):
# A sepearted method that changes edgecolor in drawing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

facecolor

def do_3d_projection(self, renderer):
xs, ys, zs = self._offsets3d
vxs, vys, vzs, vis = proj3d.proj_transform_clip(xs, ys, zs, renderer.M)

fcs = (zalpha(self._facecolor3d, vzs) if self._depthshade else
self._facecolor3d)
fcs = mcolors.to_rgba_array(fcs, self._alpha)
self.set_facecolors(fcs)
# now uses setter on project
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment does not add information and thus can be left out.

@jklymak jklymak added this to the v3.0 milestone Mar 5, 2018
@jklymak jklymak changed the title Bugfix for issue 9725 Make markerfacecolor work for 3d scatterplots Mar 5, 2018
@jklymak
Copy link
Member

jklymak commented Mar 5, 2018

Milestoning 3.0 because this isn't fixing a regression.

@jklymak
Copy link
Member

jklymak commented Mar 6, 2018

Thanks a lot for your contribution.

However, this conflicts with an existing PR: #10489 I'm going to close this PR to reduce confusion. If you want to help, you can make comments on #10489. (Also if you want to see if someone else has made a PR based on an issue, its usually cross-linked at the bottom of the issue.)

@jklymak jklymak closed this Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants