3
$\begingroup$

My dataframe looks similar to this

enter image description here

I am using the following line to graph the pairplot

sns.pairplot(iris, hue = 'States', height=7, aspect=0.8 )

The graph is good but I am confused why do the labels on the side have no color corresponding to the graph?

enter image description here

$\endgroup$
1
$\begingroup$

So, the question is asking about why the legend of the plot displayed here is not displaying any colours.

Without looking at the code you have used to generate the pair plot, I can see that, for example, the column name which inputted as the "hue" to the pair plot function should be used as the legend title. However, the title of this legend on the plot is not the same as the given column name. So, my first intuition leads to me to believe that you might have overwritten the legend attributes after this line sns.pairplot() line (maybe using plt.legend() after the pairplot line). Hence, maybe why the colours do not appear as well.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.