Closed dburkhardt closed 4 years ago
You can achieve this with legend_anchor=(1,1) to scatter. However I believe scatter should already be doing ncol=2 for more than 10 labels - I'll look into that part.
What in particular is confusing about the generate_legend syntax?
Forgot to mention - the default placement is matplotlib's 'best'
and I have no obvious game plan on how to improve on that. If you wanted you could dig into the API and work out if you can detect whether or not the legend plots over more than x% of points and if so use legend_anchor=(1, 1) by default, but that's beyond my time commitment.
@scottgigante I'm okay with the matplotlib 'best' placement by default, but the legend isn't splitting into two columns by default. I just installed from dev today:
There's also no way to set the legend ncol from the scprep.plot.scatter()
call
Any idea what's going on here? I can try to test stuff
Sorry, it got lost because it didn't have a milestone attached. I'll have a dig.
Turns out I was using ncol = n // max_rows
instead of ncol = ceil(n / max_rows)
. That's one part solved. The other part is should there be an API to access this from scatter
. I'm open to input on that - there shouldn't be everything in the generic API because you can always do ax = scatter(legend=False)
and then scprep.plot.tools.generate_legend(ax, ...)
for super fine tuning, but this might be something that's common enough to want to include. Thoughts?
Desired result:
Also this syntax was confusing