0

I am trying to do some EDA on the sklearn breast cancer dataset.

I can successfully create a scatterplot matrix with a legend using the hack outlined here: https://github.com/holoviz/hvplot/issues/210

hv.extension("bokeh")
matrix = hvplot.scatter_matrix(df.drop("target_name",axis=1),c="target")
legend_cheat=df.drop("target_name",axis=1).hvplot.scatter("mean area", "worst area", by="target", legend="right", 
                                                         width=150, height=150
                                                         ).opts("Scatter", size=0, xaxis=None, yaxis=None, 
                                                         show_frame=False, toolbar=None)
matrix + legend_cheat

The plot is too large to show in full, however here is the top right hand corner with the legend: enter image description here

Is there a way to set the scatter plots,histograms and legend to use the same colours? I thought that setting c="target" for the scatter matrix and by="target" for the legend scatterplot would make the colours match as per the example in the link above.

Thanks

mmTmmR
  • 573
  • 2
  • 8
  • 20

1 Answers1

0

Maybe seaborn and pairplot?

# importing packages
import seaborn
import matplotlib.pyplot as plt
  
############# Main Section ############
# loading dataset using seaborn
df = seaborn.load_dataset('tips')
# pairplot with hue sex
seaborn.pairplot(df)
# to show
plt.show()

enter image description here

The argument named 'hue' controls the color. See this link for more info.

https://indianaiproduction.com/seaborn-pairplot/

ASH
  • 20,759
  • 19
  • 87
  • 200