Как добавить метки в парный графикPython

Программы на Python
Гость
Как добавить метки в парный график

Сообщение Гость »


I have a dataframe with the following form:

0 1 2 3 ... 9 10 11 output 0 2.451775 1.9565675 0.843128 -0.007820 ... 0.74554812 0.090777 -1.90625 a 1 -0.855458 -0.8444604 -0.619685 0.2273399 ... 1.3771857 4.089319 -0.16289 a 2 1.554580 1.9164567 0.643128 -0.0077550 ... 0.7771542 5.090777 -1.90625 b which was the result of normalizing a numpy´s array and adding the last column named output. I add the last column to be able to use it in a sns.pairplot with the hue=output.

The problem that I have is that my pairplot is displayed with numbers like this:
Изображение


so I what I want is to display instead of numbers 0,1,2,..,n a set of labels, for that reason I have a list of labels like:

labels=["label 1","label 2",...,"label n" ] that I want to add into my pairplot to have the labels names instead of the index numbers 0, 1,...n-1. I have done the following:

sns.pairplot(df,vars=labels,hue="output") but I got the following error:

KeyError: 'label 1' I have tried the option of `reset_index(drop=True), but no results at all. How can I fix this?


Источник: https://stackoverflow.com/questions/630 ... a-pairplot

Вернуться в «Python»