X Tutup
Skip to content

Fix scatter legend with numpoints == 1#6883

Closed
mdboom wants to merge 2 commits intomatplotlib:masterfrom
mdboom:multiple-legend-handles
Closed

Fix scatter legend with numpoints == 1#6883
mdboom wants to merge 2 commits intomatplotlib:masterfrom
mdboom:multiple-legend-handles

Conversation

@mdboom
Copy link
Copy Markdown
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
path_ids = []
for path, transform in self._iter_collection_raw_paths(
master_transform, paths, all_transforms):
master_transform, paths, all_transforms, offsets):
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@mdboom
Copy link
Copy Markdown
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...

self.draw_gouraud_triangle(gc, tri, col, transform)

def _iter_collection_raw_paths(self, master_transform, paths,
all_transforms):
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

power-cycling to see if failures go away.

@WeatherGod
Copy link
Copy Markdown
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
Copy Markdown
Member

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

@WeatherGod
Copy link
Copy Markdown
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.


def _iter_collection(self, gc, master_transform, all_transforms,
path_ids, offsets, offsetTrans, facecolors,
paths, path_ids, offsets, offsetTrans, facecolors,
Copy link
Copy Markdown
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
Copy Markdown
Member

QuLogic commented Oct 18, 2016

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

@NelleV
Copy link
Copy Markdown
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

X Tutup