You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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?
The text was updated successfully, but these errors were encountered:
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
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.
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?
The text was updated successfully, but these errors were encountered: