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

Use a different marker for each hue in sns.lmplot #1030

Closed
rgpdx opened this issue Sep 30, 2016 · 1 comment
Closed

Use a different marker for each hue in sns.lmplot #1030

rgpdx opened this issue Sep 30, 2016 · 1 comment

Comments

@rgpdx
Copy link

rgpdx commented Sep 30, 2016

Hello

I use the makers feature extensively in sns.lmplot but I have this new issue where I have a list of indefinite number of categories, so I can't use the makers = [item1, item2, ... itemn] since the number n can be different for each datafile I'm plotting. Is there a way to use itertools.cycle in seaborn where I can have a list of 10 or 20 makers and have the markers pulled from this list? I'm envisioning something like this

import itertools
mks = itertools.cycle(['o', 'x', '^', '+', '*', '8', 's', 'p', 'D', 'V'])

ax = sns.lmplot(x = "X", y = "Y", data = df, hue = "CATEGORY", makers = next(mks), , scatter_kws={"s": 150})

THe idea being that the various categories will cycle through the mks list to assign up to 10 different maker types and then cycle through them again if number of categories is greater than len(mks)

This code above obviously doesn't work, but can you let me know how I can achieve something like this?

@rgpdx rgpdx changed the title Use a different maker for each hue in sns.lmplot Use a different marker for each hue in sns.lmplot Sep 30, 2016
@mwaskom
Copy link
Owner

mwaskom commented Sep 30, 2016

I'm not sure I fully understand the question, but at the time you're plotting you know how many markers you need, right? Why not pass a list with that number? e.g. [next(marker_cycle) for _ in df["CATEGORY"].unique()]?

FWIW, without seeing it, this sounds like it's going to be a very hard plot to understand in any case.

@mwaskom mwaskom closed this as completed Oct 26, 2016
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

No branches or pull requests

2 participants