10000 Fix scatter legend with numpoints == 1 by mdboom · Pull Request #6883 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix scatter legend with numpoints == 1 #6883

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

Closed
wants to merge 2 commits into from

Conversation

mdboom
Copy link
Member
@mdboom mdboom commented Aug 2, 2016

Fix inconsistency between Agg and vector backends

Fix #6845.

Fix incinsistency between Agg and vector backends
@mdboom mdboom added this to the 2.0 (style change major release) milestone Aug 2, 2016
@@ -293,13 +293,14 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
"""
path_ids = []
for path, transform in self._iter_collection_raw_paths(
master_transform, paths, all_transforms):
master_transform, paths, all_transforms, offsets):
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't the transform for the offsets need to be applied first?

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case the offsets are independent of the transforms (the latter used primarily for marker size). Way down underneath they are combined for the Agg backend. The vector backends can't however, because those formats would scale the stroke width as a result.

But maybe I don't understand your question/concern?

Copy link
Member

Choose a reason for hiding this comment

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

I honestly don't know if there is a problem or not. Only that typically elsewhere in mpl, we have the transforms for the offset independent of the transform for other aspects of an artist, I think. So, to see the offsets passed into a function, but not the transform for the offset, I start wondering if this might be subtly broken?

@WeatherGod
Copy link
Member

Is it just me, or is the dot a little low in the legend?

@mdboom
Copy link
Member Author
mdboom commented Aug 2, 2016

Is it just me, or is the dot a little low in the legend?

I saw that too, but it's really just a matter of pixel snapping not being as advantageous with the slightly different size. Not sure what we can do about that...

8000
@@ -356,7 +357,7 @@ def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
self.draw_gouraud_triangle(gc, tri, col, transform)

def _iter_collection_raw_paths(self, master_transform, paths,
all_transforms):
Copy link
Member

Choose a reason for hiding this comment

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

I do not understand, this does not use offsets in the function?

@tacaswell
Copy link
Member

This probably needs an api_changes entry an it could break third-party backends.

@mdboom mdboom force-pushed the multiple-legend-handles branch from fc13922 to 6f03d53 Compare August 29, 2016 20:03
@WeatherGod
Copy link
Member

power-cycling to see if failures go away.

@WeatherGod
Copy link
Member

So, the only thing left that has me concerned is the point @tacaswell brought up. If I read this all correctly, this does have the potential to break 3rd-party backends. Even worse, it would be hard for such a backend to support multiple versions of matplotlib because the new argument is in the middle of the call signature.

Does it make sense to at least provide some example code for 3rd party backends to copy-n-paste into their own code to paper over this change?

@tacaswell
Copy link
Member

@WeatherGod I think the change that broke things (adding an offset arg) were actually development debris and removed.

@WeatherGod
Copy link
Member

No, I am talking about the new arguments to self._iter_collection(). While it is a private method, it is in the base class. Right now, only the svg, pdf and ps backends use it, but I don't know what 3rd-party backends might be using it, if at all.

return (N + Npath_ids - 1) // Npath_ids

def _iter_collection(self, gc, master_transform, all_transforms,
path_ids, offsets, offsetTrans, facecolors,
paths, path_ids, offsets, offsetTrans, facecolors,
Copy link
Member

Choose a reason for hiding this comment

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

@WeatherGod Right, I noticed the new arg at the end, but not the one in the middle.

@QuLogic
Copy link
Member
QuLogic commented Oct 18, 2016

So can this be closed what with #7214 being merged instead?

@NelleV
Copy link
Member
NelleV commented Oct 19, 2016

Yes.

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.

5 participants
0