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

Fix: tuple linetypes work as documented. #353

Merged
merged 1 commit into from Feb 8, 2020

Conversation

TyberiusPrime
Copy link
Contributor

This makes the line types work as documented with tuples.

Fixes #352 .

key = pd.DataFrame({
aesthetic: scale.map(breaks),
aesthetic: mapped,
Copy link
Owner

Choose a reason for hiding this comment

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

This change can be omitted. See below.

# Otherwise it uses the first entry of each tuple
# and throws away the rest
mapped = [tuple(x) for x in mapped]
df[ae] = mapped
Copy link
Owner

Choose a reason for hiding this comment

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

I think we can limit the change to the specific code path for manual linetypes. That is in scale_linetype_manual.map

def map(...):
    result = super().map(...)
    # ...
    if len(result) and hasattr(result[0], '__hash__'):
        result = [tuple(x) for x in result]
    return result

This way there is no need to make changes to guide_legend.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. It's marginally more complicated since we still want to support mixed string/tuple linetype definitions, but it's done.

@TyberiusPrime
Copy link
Contributor Author

Made the changes as requested.

@has2k1 has2k1 merged commit 1a3d653 into has2k1:master Feb 8, 2020
@has2k1
Copy link
Owner

has2k1 commented Feb 8, 2020

Thanks @TyberiusPrime.

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.

Linetype tuples don't work.
2 participants