All examples listed in Seaborn's regplot
documentation show the same color for dots and the regression line. Changing the color
argument changes both. How can one set a different color for the points as the line?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
You already have a good answer. DavidG's suggestion to use
line_kws
andscatter_kws
has the side-effect that the regression line and the confidence interval colors are the same (though the ci is alpha-ed). Here is a way to have distinct colors. If there's a better way, I'd like to know!Create a seaborn
FacetGrid
, then add layers with themap()
function:I was inspired by this question
Remark in passing (off topic): set the size of the figure early on, because usual methods don't seem to apply here.
You are right in that the
color
argument changes all the plot elements. However, if you read the last bit of the relevant sentence in the documentation:Therefore, using
scatter_kws
orline_kws
we can change the color of them individually. Taking the first example given in the documentation:Gives: