Mis a jour le 2024-06-16, 21:52

Pairplot

Pour visualiser les relations par paires d'un dataframe pandas : df = pandas.DataFrame({'A': [0, 3, 5, 10, 15], 'B': [3, 4, 5, 6, 7], 'C': [8, 6, 5, 4, 3], 'D':['a', 'b', 'a', 'b', 'a']}) seaborn.pairplot(df, hue = 'D', palette = {'a': 'red', 'b': 'green'}, markers = ['x', '+'])
Exemple plus complet :
fg = seaborn.pairplot(df, plot_kws = {'color': 'blue', 'size': 0.5}, diag_kws = {'bins': 20, 'color': 'blue'})
for ax in fg.axes.flat:
  ax.set_title(ax.get_title().replace('_', ' ')
  ax.title.set_backgroundcolor('lemonchiffon')
  ax.title.set_color('red')
  ax.set_xscale('symlog', linthresh = 0.1)
  ax.set_yscale('symlog', linthresh = 0.1)
  ax.set_xlim(0, 10)
  ax.set_ylim(0, 10)
  

Copyright python-simple.com
programmer en python, tutoriel python, graphes en python, Aymeric Duclert